* Code adapted from Atmel AVR ApplICation Note AVR306
* PolLEDmode driver forUART, this is the similar to the
* library default putchar() and getchar() in ICCAVR
*/
#include
#include
#include “uart.h”
/* iniTIalize UART */
void InitUART( unsigned char baudrate )
{
UBRR = baudrate; /* set the baud rate */
UCR = BIT(RXEN) | BIT(TXEN); /* enable UART receiver and transmitter */
}
/* Read and write funcTIons */
unsigned char ReceiveByte( void )
{
while ( !(USR & (1《; /* return the data */
return UDR;
}
void TransmitByte( unsigned char data )
{
while ( !(USR & (1《; /* wait for empty transmit buffer */
UDR = data; /* start transmitTIon */
}
#ifdef TEST
/* main - a simple test program*/
void main( void )
{
InitUART( 11 ); /* set the baudrate to 19,200 bps using a
3.6864MHzcrystal */
while ( 1 ) /* forever */
{
TransmitByte( ReceiveByte() ); /* echo the received character */
}
}
#endif
Previous article:Design of Presettable Programmable Broadband DC Power Amplifier Circuit Based on AVR Microcontroller
Next article:AVR single chip microcomputer control method of switching power supply
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- ASML predicts that its revenue in 2030 will exceed 457 billion yuan! Gross profit margin 56-60%
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- Old Iron
- What are the losses in transformers? Explain eddy current, hysteresis, leakage flux, etc.
- DSP Implementation of Square Root Operation
- Problems with si4010
- [GD32L233C-START Review] Development Board Power Consumption Test
- Release an IoT core board, Tiny OS open source system
- DSP Program Structure Programming Notes
- Qorvo Online Design Conference - 5G Ecosystem and Next-Generation Infrastructure Deployment
- [Voice and vision module based on ESP32S3] Project submission
- MicroPython stm32 branch adds SD card option