8051 uart2 8051/4051 UART Interrupt #include /* Include x51 header file */ void Ext_int_Init() { EA = 1;/* Enable global interrupt */ ES = 1; /* Enable serial interrupt */ } void UART_Init() { TMOD = 0x20;/* Timer 1, 8-bit auto reload mode */ TH1 = 0xFD;/* Load value for 9600 baud rate */ SCON = 0x50;/* Mode 1, reception enable */ TR1 = 1;/* Start timer 1 */ } void Serial_ISR() interrupt 4 { P1 = SBUF;/* Give received data on port.. 공학속으로/마이컴 2020. 3. 3. 8051/4051 UART 8051 UART Serial communication Registers SBUF: Serial Buffer Register SCON: Serial Control Register Bit 7:6 - SM0:SM1: Serial Mode Specifier SM1 SM0 0 0 1/12 of Osc frequency shift register mode fixed baud rate 0 1 8-bit UART with timer 1 determined baud rate 1 0 9-bit UART with 1/32 of Osc fixed baud rate 1 1 9-bit UART with timer 1 determined baud rate /* * 8051_Serial_UART */ #include /* Incl.. 공학속으로/마이컴 2020. 3. 3. 이전 1 다음 💲 추천 글