H-tech C PIC16f877a - getting UART input without getch()

Status
Not open for further replies.

ericyeoh

Member level 2
Joined
Jun 3, 2009
Messages
46
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Location
malaysia
Visit site
Activity points
1,635
H-tech C PIC16f877a

hai, i need programer help here,i want to get input from PC (portC 6,7) but not using getch(); function! Because my program i expect is that with no input/input from the computer the automation is working but because of the getch(); my program will just stuck on waiting until keypress input from computer.
this make me mad....

Please i need help here..!
 

Re: H-tech C PIC16f877a

You can assign the port value to a variable and then mask the reading to get the values of portc

Or you can read individual bits like:

unsigned char Input1;
unsigned char Input2;

Input1 = RC6;
Input2 = RC7;
 

Re: H-tech C PIC16f877a - getting UART input without getch(

your mathode also can use..but finally i looked at the datasheet i found a way the to get the input already

For more info please take a look in the datasheet for PIC16F877A

example to receive a data in PORTC bit 7

RCIE=1;
GIE=1;
PEIE=1;
RCSTA=0x90;
TXSTA=0x24;

void interrupt usart(void)
{
if(RCIE&&RCIF)
{
(Please declare globar variable)DATA=RCREG;
}
}
remember to off the RCIF everytime a data is received
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…