[ Log In ]
Serial to USB converter with Micro USB cable

USB to Serial Converter

Thumbnail: Crystal Oscillator 18.432 MHz for UART

18.432 MHz Crystal Oscillator 18pf 30ppm

Thumbnail: 22 pF Capacitor

22 pF Multilayer Ceramic Capacitor

Thumbnail: Quartz crystal oscillator - 16 MHz

16 MHz Crystal Oscillator 20 pF Through Hole

USB 2.0 Cable 10 Foot Type A Male to Type B Male

USB 2.0 Cable Type A Male to Type B Male - 10 FT

3 Foot USB Cable Type A to USB Cable Type A

USB Cable Type A Male to USB Type A Male - 3 FT

Tumbnail: 62 oz-in NEMA 17 Stepping motors (also called stepper motor)

NEMA 17 Stepping Motor (62 oz-in 5mm single shaft)

$19.95 Out of Stock
Image of the Atmega324p



10K timmer potentiometer

10K Trimmer Potentiometer (Through Hole)


Programming: UART/USART Creating a Transmit Data Function (Specifically for a Library or Include File)

Since we are transmitting data, not return is necessary, but we will need to include a parameter. The parameter will be the data that will be transmitted. The UDRE (USART Data Register Empty) is a flag that tells us when the data register is empty so we can populate the UDR (USART Data Register). When it is ready, we can assign the data to the UDR register. The following code is for microcontroller with more than one USART/UART and uses the first one (the 0's at the end of the registers):
void TransmitUART0(unsigned char data)
//Wait until the Transmitter is ready
while (! (UCSR0A & (1 << UDRE0)) );

//Get that data outa here!
UDR0 = data;

The following code is for microcontroller with only one UART/USART:

void TransmitUART(unsigned char data)
//Wait until the Transmitter is ready
while (! (UCSRA & (1 << UDRE)) );

//Get that data outa here!
UDR = data;

Comments and Additional Information

Have some code to share? Or additional information? Respond here:

You need to be logged in to save a response on this page. The response must be constructive, helpful, supplimentary or to correct the existing video, code or narrative content.


Code (optional):