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 CCS Technical Support

A small rs232 receive issue

 
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: Wed Nov 28, 2007 1:49 pm     Reply with quote

To check if RS232 is working correctly, try a very simple test program.
In the following program, any character that you type on the PC keyboard
will be sent back to the PC and displayed in the terminal window. Make sure that you configure the terminal program to disable "local echo".
Code:

#include <18F4620.h>
#fuses XT,NOWDT,BROWNOUT,PUT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

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

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

}
jojos



Joined: 30 Apr 2007
Posts: 64

View user's profile Send private message

PostPosted: Thu Nov 29, 2007 3:25 am     Reply with quote

Pcm i cant see anything on the screen of Hyperterminal.What could be wrong?.I can transmit but i cant recieve.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Nov 29, 2007 3:32 am     Reply with quote

Check all the connections in your MAX232 circuit.
jojos



Joined: 30 Apr 2007
Posts: 64

View user's profile Send private message

PostPosted: Thu Nov 29, 2007 5:27 am     Reply with quote

I checked all my connection they appear to be O.K.

Using the oscilloscope i can see in the Rx pin of the pic that when i press a button on the pc keyboard there are pulses of max. 2V,but from the Tx pin it doesn't appear anything.I would expect that form the putc(c); instruction there had to be something.
Are the 2volts pulses to low or they are the nominal voltage?
jojos



Joined: 30 Apr 2007
Posts: 64

View user's profile Send private message

PostPosted: Thu Nov 29, 2007 7:38 am     Reply with quote

Found the problem.The capacitor on pin 16 and pin 2 of the max232 has failed. Guess everything is possible Shocked

Thanks for the respond.
Ttelmah
Guest







PostPosted: Thu Nov 29, 2007 7:38 am     Reply with quote

jojos wrote:
I checked all my connection they appear to be O.K.

Using the oscilloscope i can see in the Rx pin of the pic that when i press a button on the pc keyboard there are pulses of max. 2V,but from the Tx pin it doesn't appear anything.I would expect that form the putc(c); instruction there had to be something.
Are the 2volts pulses to low or they are the nominal voltage?

The signal at PIC, should be _high_ when no data is arriving, and drop when data is received. It needs to be reaching at least 0.8*the PIC supply rail (4v, for a 5v PIC). 2v, would normally imply something is badly wrong, and if the data is positive going, something else is wrong as well...

Best Wishes
Ttelmah
Guest







PostPosted: Thu Nov 29, 2007 8:00 am     Reply with quote

I see the hardware problem was found, while I posted. :-)

Best Wishes
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