View previous topic :: View next topic |
Author |
Message |
cfernandez
Joined: 18 Oct 2003 Posts: 145
|
PORTC & RS232 Question |
Posted: Fri Feb 04, 2005 10:23 pm |
|
|
Hi,
I have a 18F4620 25Mhz and I need to control a serial device, for this job I use the pins C1-RX & C2-TX and for terminal debug use the pins B7-RX & B6-TX.
Code: | #use rs232( BAUD = 115200, INVERT , PARITY = N, XMIT = PIN_B6, RCV = PIN_B7, BITS = 8, STREAM = DEBUG)
#use rs232( BAUD = 115200, PARITY = N, XMIT = PIN_C2, RCV = PIN_C1, BITS = 8, STREAM = DEVICE)
|
The DEBUG work fine, but the DEVICE not work, I test this connect to a Terminal windows and I see only garbage. The electrical conection is OK.
I see that the C1 & C2 are CCP Ports, Is possible that this cause the gargabe problem?
Somebody use the C1 & C2 for Serial communication?
Is neccesary to set some FUSE for this?
Somebody know the answer to my problem?
Thank you very much!!
Best Regards, |
|
![](templates/subSilver/images/spacer.gif) |
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Fri Feb 04, 2005 11:04 pm |
|
|
I see that you use the invert option for the debug stream. This leads me to believe that you are not using an RS232 transceiver. However, you do not use the invert for the Device stream. Are you using a transceiver on these pins? |
|
![](templates/subSilver/images/spacer.gif) |
cfernandez
Joined: 18 Oct 2003 Posts: 145
|
|
Posted: Sat Feb 05, 2005 7:03 am |
|
|
Mark,
For the DEVICE I not use 232 Transceiver. Is not necesary. The same circuit with 18F8720 work OK, the only difference is that in the 18F8720 use H6 y H7 for connect my DEVICE.
The 18F4620 have any problem with this? |
|
![](templates/subSilver/images/spacer.gif) |
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Sat Feb 05, 2005 1:48 pm |
|
|
Well you must have something in the hardware then to do the inversion. |
|
![](templates/subSilver/images/spacer.gif) |
drh
Joined: 12 Jul 2004 Posts: 192 Location: Hemet, California USA
|
|
Posted: Sat Feb 05, 2005 6:47 pm |
|
|
Just a suggestion. The word "DEVICE" is a pre-processor directive. The compiler might be confused by your your usage and rather than issue an error, just do something strange. _________________ David |
|
![](templates/subSilver/images/spacer.gif) |
cfernandez
Joined: 18 Oct 2003 Posts: 145
|
|
Posted: Sun Feb 06, 2005 11:04 am |
|
|
The name DEVICE is only a example.
I found the solution, I add the SAMPLE_EARLY to #use RS232 and work fine in 115K
#use rs232( BAUD= 115200, PARITY = N, XMIT = PIN_C2, RCV = PIN_C1, BITS = 8, STREAM = DEVICE, SAMPLE_EARLY ) |
|
![](templates/subSilver/images/spacer.gif) |
|