Last active
May 20, 2016 13:55
-
-
Save MaciejLisCK/faaf4a724c469131e1aed7695e27964e to your computer and use it in GitHub Desktop.
Microcontroller Serial in Keil, RS232, Serial Communication, C, avr, atmel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <REGX52.H> | |
void Serial() interrupt 4 | |
{ | |
if(RI == 1) | |
{ | |
P1 = SBUF; | |
RI = 0; | |
} | |
} | |
main() | |
{ | |
SCON = 0x50; | |
TH2 = RCAP2H = 0xFF; | |
TL2 = RCAP2L = 0xDC; | |
T2CON = 0x34; | |
ES = 1; | |
EA = 1; | |
while(1) | |
; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <REGX52.H> | |
unsigned char i = 0; | |
void main() | |
{ | |
SCON = 0x50; | |
TH2 = RCAP2H = 0xFF; | |
TL2 = RCAP2L = 0xDC; | |
T2CON = 0x34; | |
ES = 1; | |
while(1) | |
{ | |
TI = 0; | |
P1 = i; | |
SBUF = i; | |
while(TI==0) | |
{;} | |
i++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment