CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

getch()

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
asunca



Joined: 09 Sep 2005
Posts: 36

View user's profile Send private message

getch()
PostPosted: Fri Oct 14, 2005 8:12 am     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Fri Oct 14, 2005 11:55 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Oct 14, 2005 5:44 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Oct 15, 2005 1:22 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Oct 17, 2005 7:45 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group