//Single-signal machine model: PIC16F877A
//Function description: Application of PIC microcontroller USART, serial port debugging assistant sends data to 877, and 877 forwards it back to the serial port assistant after receiving it
//Assist work through "serial port debugging assistant"
#include
__CONFIG(0xf73a) of the internal resources of the MCU;
//Chip configuration word, watchdog off, power-on delay on, power-off detection off, low voltage programming off, encryption, 4M crystal HS oscillation
//=======================================================================
//Function description: main program
//Function name: void main()
void main()
{
TRISC=0XFF; //Set the direction of port C to all output
SPBRG=0XC; //Set the baud rate to 19200BPS
TXSTA=0X24; //Enable serial port sending, select high-speed baud rate
RCSTA=0X90; //Enable serial port work, continuous reception
RCIE=0X1; //Enable receive interrupt
GIE=0X1; //Open global interrupt
PEIE=0X1; //Enable external interrupt
while(1) //Wait for interrupt
{;}
}
//========================================================================
//Function description: interrupt function
//Function name: void interrupt usart(void)
void interrupt usart(void)
{
if(RCIE&&RCIF) //Judge whether it is a serial port receive interrupt
{
TXREG=RCREG; //Send the received data back
}
}
Previous article:MCC18 platform code for frequency measurement based on PIC18F45K20
Next article:Use of LCD1602A
- Popular Resources
- Popular amplifiers
- Learn ARM development(14)
- Learn ARM development(15)
- 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)
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
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Notes and lessons about IAR installation
- [Open Source] Bluetooth module BT401 full set of information based on Bluetooth headset chip development ultra-low cost
- Microcontroller Programming Examples
- Please advise, the voltage of the 5V circuit drops after adding load
- Configuration example of ModbusTCP to Profinet gateway connecting to tightening shaft drive
- What books should Linux newbies read?
- C6000 embedded assembly C and assembly comparison and function description
- MicroPython 1.17 released
- EEWORLD University Hall----Live Replay: ADI's Vital Signs Monitoring Solutions in Wearable Products
- FPGA implementation of SPI42 interface.pdf