View previous topic :: View next topic |
Author |
Message |
Guest
|
RS232 Question |
Posted: Tue Aug 16, 2005 2:00 pm |
|
|
I have a PIC18F452 and a MAX232 connected to PC RS232.
When I send data from PC to PIC it works fine. But, when I try to receive data from PC it doesn't work. It remain waiting forever in getc() function.
Im using:
#USE_RS232(BAUD=9600, XMIT=PIN_C6, RCV=PIN_C7)
Is necessary to use the MAX232 IC with PIC18F452 or can I connect it directly to PIN 2, 3 of DB9 connector?
I have verified the pin levels PIN_C7 is high and PIN_C6 is low.
Thank you. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Aug 16, 2005 2:28 pm |
|
|
Quote: | Im using:
#USE_RS232(BAUD=9600, XMIT=PIN_C6, RCV=PIN_C7)
Is necessary to use the MAX232 IC with PIC18F452 ? |
Yes. You are using the hardware UART. It does not have
an option to invert the output signal. So, you must provide
the inversion by adding a MAX232-type chip to your circuit. |
|
|
Guest
|
|
Posted: Tue Aug 16, 2005 2:38 pm |
|
|
Ok. thank you.
any suggestion to solve my problem ?. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Aug 16, 2005 2:50 pm |
|
|
1. Check the connections in your MAX232 circuit.
2. Add the ERRORS parameter to your #use rs232() statement.
Example:
#USE RS232(BAUD=9600, XMIT=PIN_C6, RCV=PIN_C7, ERRORS) |
|
|
Guest
|
|
Posted: Tue Aug 16, 2005 2:58 pm |
|
|
I tried with my desktop instead of my notebook and it runs ok.
I guest that is related to the different volt levels to each other.
Does anyone has experience with that ?
Thak you |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1635 Location: Perth, Australia
|
|
Posted: Tue Aug 16, 2005 6:46 pm |
|
|
Anonymous wrote: | I tried with my desktop instead of my notebook and it runs ok.
I guest that is related to the different volt levels to each other.
Does anyone has experience with that ?
Thak you |
If you have used a max232 chip then the most likely cause of the problem is that the max 232 chip is not generating the -ve correctly. This happens if there is a soldering problem between the MAX chip and the 4 x 1uF capacitors. Meaure the voltage between pin 6 and gnd. It should be -9volts when run from a 5v supply. Similarly the voltage between pin 2 and ground should be +9 volts. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
|