Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Please help!! receiving more than one character on PIC16f877

Status
Not open for further replies.

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 character pic16f877

If you want some help you're going to have to post more details - maybe show us you code.
 

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();
}
}
}
 

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!
 

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!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top