| Author |
Message |
ericyeoh
Joined: 03 Jun 2009 Posts: 24
|
26 Oct 2009 16:36 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..!
|
|
| Back to top |
|
 |
daviddlc
Joined: 11 Feb 2007 Posts: 196 Helped: 13
|
28 Oct 2009 3:00 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;
|
|
| Back to top |
|
 |
Google AdSense

|
28 Oct 2009 3:00 Ads |
|
|
|
|
|
|
| Back to top |
|
 |
ericyeoh
Joined: 03 Jun 2009 Posts: 24
|
30 Oct 2009 8:16 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
|
|
| Back to top |
|
 |