View previous topic :: View next topic |
Author |
Message |
asunca
Joined: 09 Sep 2005 Posts: 36
|
getch() |
Posted: Fri Oct 14, 2005 8:12 am |
|
|
in the main program where the getch() function is called, the program gets into trouble. i ve just used the example code ex_stwt.c and the simplest example ex_sqw but i couldnt make them work. and i couldnt use getch() with hyperterminal. ive tried using kbhit() option but it also didnt work. pic sends data but just a simple echo thing cannot be done.
while (true)
{
putc( getc() +1);
}
what should be done? |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Fri Oct 14, 2005 11:55 am |
|
|
First, why are you adding 1.
Second, post a complete small test program. |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Fri Oct 14, 2005 5:44 pm |
|
|
You say it doesn't work, but you don't tell us what it doesn't do. The code you show should run but we don't know what you are expecting. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
asunca
Joined: 09 Sep 2005 Posts: 36
|
|
Posted: Sat Oct 15, 2005 1:22 am |
|
|
Code: |
#include <16F877.h>
#fuses XT,NOWDT,NOPROTECT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, errors,BRGH1OK)
void main()
{
while(TRUE)
{
printf("start");
putc( getch()+1 );
}
}
|
when you write 'A' computer prints 'B'. this the 'not working small program' .
start is seen but no action on the receive pin. serial port works properly verified by the loopback. |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Mon Oct 17, 2005 7:45 am |
|
|
Code: |
#include <16F877.h>
#fuses XT, NOWDT,PUT, NOPROTECT, BROWNOUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
main()
{
char c;
printf("start");
while(1)
{
c = getc();
putc(c + 1);
}
}
|
Humberto |
|
|
|