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

PORTC & RS232 Question

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



Joined: 18 Oct 2003
Posts: 145

View user's profile Send private message

PORTC & RS232 Question
PostPosted: Fri Feb 04, 2005 10:23 pm     Reply with quote

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,
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Fri Feb 04, 2005 11:04 pm     Reply with quote

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?
cfernandez



Joined: 18 Oct 2003
Posts: 145

View user's profile Send private message

PostPosted: Sat Feb 05, 2005 7:03 am     Reply with quote

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?
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Sat Feb 05, 2005 1:48 pm     Reply with quote

Well you must have something in the hardware then to do the inversion.
drh



Joined: 12 Jul 2004
Posts: 192
Location: Hemet, California USA

View user's profile Send private message

PostPosted: Sat Feb 05, 2005 6:47 pm     Reply with quote

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
cfernandez



Joined: 18 Oct 2003
Posts: 145

View user's profile Send private message

PostPosted: Sun Feb 06, 2005 11:04 am     Reply with quote

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 )
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