electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

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


Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> H-tech C PIC16f877a - getting UART input without getch()
Author Message
ericyeoh



Joined: 03 Jun 2009
Posts: 24


Post26 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


Post28 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
Google Adsense




Post28 Oct 2009 3:00   

Ads




Back to top
ericyeoh



Joined: 03 Jun 2009
Posts: 24


Post30 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
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> H-tech C PIC16f877a - getting UART input without getch()
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
UART configuration help for PIC16F877A (1)
UART source code in Hi-tech C! (3)
altera UP2 board - getting 19.2kHzclock for UART (1)
Interface external USB & UART with PIC16F877A (2)
HELP!! Control dc motor speed with PIC16F877a using hi-tech (2)
Msp430F2274: How to use UART without interrupt? (4)
data exchange between 2 microcontrollers without UART usage (10)
UART Rx function without precisely knowledge of clock freq (1)
programming PIC16F877A PORTB as input... (3)
HI-TECH PIC C input() and output() function? (2)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS