View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Nov 28, 2007 1:49 pm |
|
|
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
|
|
Posted: Thu Nov 29, 2007 3:25 am |
|
|
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
|
|
Posted: Thu Nov 29, 2007 3:32 am |
|
|
Check all the connections in your MAX232 circuit. |
|
|
jojos
Joined: 30 Apr 2007 Posts: 64
|
|
Posted: Thu Nov 29, 2007 5:27 am |
|
|
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
|
|
Posted: Thu Nov 29, 2007 7:38 am |
|
|
Found the problem.The capacitor on pin 16 and pin 2 of the max232 has failed. Guess everything is possible
Thanks for the respond. |
|
|
Ttelmah Guest
|
|
Posted: Thu Nov 29, 2007 7:38 am |
|
|
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
|
|
Posted: Thu Nov 29, 2007 8:00 am |
|
|
I see the hardware problem was found, while I posted. :-)
Best Wishes |
|
|
|