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 CCS Technical Support

Multidrop RS232

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



Joined: 07 Sep 2003
Posts: 5
Location: Scotland

View user's profile Send private message

Multidrop RS232
PostPosted: Thu Jul 17, 2003 4:39 pm     Reply with quote

Hi I have project where I have to communicate with 2 pic16f876's via the rs232 connection from the one computer. I have used the 16f876 and rs232 in the past but only singly. On checking the past posts I have seen articles on using 9 data bits to indicate the presence of an address, unfortunately I have to use visual basic for the computer side of the project, and according to the comm control only a maximum of 8 data bits can be used. I thought of emmbedding the address in the data and downloading it to the two micros then decoding it but this seems wasteful, the other method I thought of was to use one micro to receive/transmit the rs232 the data then communicate between the two using the spi interface(they are on the same board). If anybody has any suggestions I would wellcome them as I work mainly with hardware and dip into the software/micro side of things on occasion.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516113
Steve H.
Guest







What I do...
PostPosted: Thu Jul 17, 2003 10:05 pm     Reply with quote

I have a VHF Source and Network Analyzer project that can have 4 instruments on one serial line. I send a packetized message where the first byte is the address. This wastes one byte but it is easily done. Another thintg that could be done is to embed the address into the first byte with the command to preform. This would save a byte. At anyrate you can download the code from my site at the link below.

Steve H.

Web Page: www.AnalogHome.com
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516123
Sherpa Doug
Guest







Re: Multidrop RS232
PostPosted: Fri Jul 18, 2003 8:12 am     Reply with quote

:=Hi I have project where I have to communicate with 2 pic16f876's via the rs232 connection from the one computer. I have used the 16f876 and rs232 in the past but only singly. On checking the past posts I have seen articles on using 9 data bits to indicate the presence of an address, unfortunately I have to use visual basic for the computer side of the project, and according to the comm control only a maximum of 8 data bits can be used. I thought of emmbedding the address in the data and downloading it to the two micros then decoding it but this seems wasteful, the other method I thought of was to use one micro to receive/transmit the rs232 the data then communicate between the two using the spi interface(they are on the same board). If anybody has any suggestions I would wellcome them as I work mainly with hardware and dip into the software/micro side of things on occasion.

Two established protocols for this that I have used, but not with PICs, are SAIL (Serial Ascii Intereface Loop) which is an old protocol adapted from 4-20mA to voltage driven, and VISCA which is used by high end video equipment especially Sony cameras.

You might also look at Modbus, though I have never used it.

___________________________
This message was ported from CCS's old forum
Original Post ID: 144516141
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

Re: Multidrop RS232
PostPosted: Fri Jul 18, 2003 8:36 am     Reply with quote

:=Hi I have project where I have to communicate with 2 pic16f876's via the rs232 connection from the one computer. I have used the 16f876 and rs232 in the past but only singly. On checking the past posts I have seen articles on using 9 data bits to indicate the presence of an address, unfortunately I have to use visual basic for the computer side of the project, and according to the comm control only a maximum of 8 data bits can be used. I thought of emmbedding the address in the data and downloading it to the two micros then decoding it but this seems wasteful, the other method I thought of was to use one micro to receive/transmit the rs232 the data then communicate between the two using the spi interface(they are on the same board). If anybody has any suggestions I would wellcome them as I work mainly with hardware and dip into the software/micro side of things on occasion.

Have a look at the spec for Modbus at www.modbus.org. Modbus uses addressed packets to comunicate between a master and slave devices. This is not hard to implement with VB through a serial port. If you two pics are in the same circuit you can use some and/or gates to allow them both access to the same RS232 driver. This is a cheep and effective solution. They would not be able to transmit at the same time but master slave protocol means slaves only transmit in responce to a masters request.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516144
Mark



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

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

Re: Multidrop RS232
PostPosted: Mon Jul 21, 2003 6:26 pm     Reply with quote

If you want to fake the 9 data bits, then you could do it by using even or odd parity. You would have to change the parity setting based on each byte. You would also have to make sure that the data had been sent before changing the parity from within VB. It is kinda tricky but a savy programmer can figure it out. If you want an easy way to detect an address, send it as your first byte. To signal the start of a new message, send a "break" signal. This will appear as a framing error on the pic with the data being 0x00.

Regards,
Mark

:=Hi I have project where I have to communicate with 2 pic16f876's via the rs232 connection from the one computer. I have used the 16f876 and rs232 in the past but only singly. On checking the past posts I have seen articles on using 9 data bits to indicate the presence of an address, unfortunately I have to use visual basic for the computer side of the project, and according to the comm control only a maximum of 8 data bits can be used. I thought of emmbedding the address in the data and downloading it to the two micros then decoding it but this seems wasteful, the other method I thought of was to use one micro to receive/transmit the rs232 the data then communicate between the two using the spi interface(they are on the same board). If anybody has any suggestions I would wellcome them as I work mainly with hardware and dip into the software/micro side of things on occasion.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516236
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