Jul 5, 2009 #1 V vlappe Newbie level 3 Joined Apr 5, 2008 Messages 4 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,306 read 2 characther pic16f877 Hi I want some help on how to receive more than one character when send over RS232 from my PC to PIC16f877. I can only recieve one character at the moment. Im using ccs c compiler.
read 2 characther pic16f877 Hi I want some help on how to receive more than one character when send over RS232 from my PC to PIC16f877. I can only recieve one character at the moment. Im using ccs c compiler.
Jul 6, 2009 #2 GSM Man Banned Joined Apr 15, 2009 Messages 670 Helped 168 Reputation 338 Reaction score 94 Trophy points 1,308 Location New Jersey, USA Activity points 0 read 2 character pic16f877 If you want some help you're going to have to post more details - maybe show us you code.
read 2 character pic16f877 If you want some help you're going to have to post more details - maybe show us you code.
Jul 7, 2009 #3 V vlappe Newbie level 3 Joined Apr 5, 2008 Messages 4 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,306 Re: Please help!! receiving more than one character on PIC16 hi, sorry it took so long. here is the code im using. #include <16F877.H> #device ICD=TRUE #fuses HS,NOLVP,NOWDT,PUT #use delay(clock=20000000) #use rs232(baud=9600, xmit=PIN_C7, rcv=PIN_C6) void main(void) { char x; x=" "; while(1) { char x; if (kbhit()) { x = getc(); } } }
Re: Please help!! receiving more than one character on PIC16 hi, sorry it took so long. here is the code im using. #include <16F877.H> #device ICD=TRUE #fuses HS,NOLVP,NOWDT,PUT #use delay(clock=20000000) #use rs232(baud=9600, xmit=PIN_C7, rcv=PIN_C6) void main(void) { char x; x=" "; while(1) { char x; if (kbhit()) { x = getc(); } } }
Jul 7, 2009 #4 Kurenai_ryu Advanced Member level 2 Joined Jun 10, 2006 Messages 694 Helped 164 Reputation 326 Reaction score 112 Trophy points 1,323 Location Bolivia Activity points 6,157 why do you define "char x;" twice? it should be just once... I think the code works very well, it will read all the characters in "x" maybe you need to read two characters at time??? duh!
why do you define "char x;" twice? it should be just once... I think the code works very well, it will read all the characters in "x" maybe you need to read two characters at time??? duh!
Jul 8, 2009 #5 G garg29 Advanced Member level 1 Joined Nov 17, 2004 Messages 443 Helped 25 Reputation 50 Reaction score 10 Trophy points 1,298 Activity points 3,593 Re: Please help!! receiving more than one character on PIC16 Code: void uart_gets(char *s) // Get String from UART { while(((*s)=uart_getc())!=13)s++;//until last character is carriage return *s=0; } enjoy!
Re: Please help!! receiving more than one character on PIC16 Code: void uart_gets(char *s) // Get String from UART { while(((*s)=uart_getc())!=13)s++;//until last character is carriage return *s=0; } enjoy!