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

Communication between PIC 16f628A and hyperterminal

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



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 19, 2009 5:03 pm     Reply with quote

His original concept should work. The terminal program sends ASCII
numbers. Also, atoi() expects a string as a parameter. It doesn't accept
a char variable such as 'dado'.

My advice is to first prove that your communications work with the PC.
Try a simple program like this, in which the PIC receives a character
sent by the PC and then sends it back to the PC. You can type in
characters and see them on the terminal window. Be sure to disable
the option for "local echo" in the setup screen of your terminal program.
Then you won't see double characters.
Code:
#include <16F628A.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
#use rs232(baud=9600, xmit=PIN_B2, rcv=PIN_B1, ERRORS)

//======================================
void main()
{
char c;

while(1)
  {
   c = getc();
   putc(c);
  }
}


Also, let the compiler set the TRIS. It will do it automatically for you.
It will set pins to inputs or outputs as required by the peripheral device
(UART) or the CCS function that is used. You don't need the fast_io
and set_tris_x() statements.
ECACE



Joined: 24 Jul 2006
Posts: 94

View user's profile Send private message

PostPosted: Thu Feb 19, 2009 5:26 pm     Reply with quote

OOPS! You're right. I was using a gets() in mine, not getc() like he is using.

Let's see the result of his test program.

I would suggest you try using the SIO program that comes with CCS.
_________________
A HW Engineer 'trying' to do SW !!! Run!!!
Blima



Joined: 13 Feb 2009
Posts: 3

View user's profile Send private message

PostPosted: Tue Feb 24, 2009 4:38 pm     Reply with quote

The program is now running thanks to your advice. Smile

Regards,
Bruno
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