Heath
Joined: 21 Dec 2007 Posts: 41
|
RS485 general questions |
Posted: Fri Dec 21, 2007 10:56 am |
|
|
Hello folks,
I looked over the rs485.c file in the picc/drivers folder to get some ideas on how I want to design my software. I had a few questions that I would like some answers to help me get a grasp on the CCS SCI.
The RS485.c has the following lines for non-external:
Code: | --removed per the guidelines on the forums.--
|
The above directives are creating two streams that will be used later. One question that first pops in my mind is, why? If you only used the first one (the h/w uart), would you not have the collision detection that the 'multi_master' gives you? A quote from the CCS help about MULTI_MASTER: Quote: | Uses the RETURN pin to determine if another master on the bus is transmitting at the same time. If a collision is detected bit 6 is set in RS232_ERRORS and all future PUTC's are ignored until bit 6 is cleared. The signal is checked at the start and end of a bit time. May not be used with the UART. |
I played around with the code a little bit to see what would work. I first used both directives, in part, like so:
Code: | #use rs232(baud=9600, xmit=RS485_TX_PIN, rcv=RS485_RX_PIN, enable=RS485_ENABLE_PIN, errors, stream=RS485)
#use rs232(baud=9600, xmit=RS485_TX_PIN, rcv=RS485_RX_PIN, enable=RS485_ENABLE_PIN, errors, stream=RS485_CD)
|
I was able to send data out of the PIC to my PC.
Then, I changed the second directive to use the s/w uart. (shown in the first code block) I was not able to transmit any data though. Why would this be?
I'm on a PIC18F6526.
Thanks for the information. Merry Christmas! |
|