Gavin Ross wrote:
Would serial comms handle using a single channel/port to address multiple linked devices. I want to send a bitstream which inludes, as the first two bytes, the address of the micro controller that it refers to. Only if the address matches its internal address, will the micro controller respond else it will ignore the comms. Or would I need to have each micro controller action the serial event and either respond or send it to the next device in the chain on a different port?
I am implementing a ring system using serial ports. Each device in the ring has an ID (in my case a letter in the range 'a' to 'z') and commands are sent along the ring and either swallowed by the device when the ID matches or passed to the next device in the ring. Devices send results along the ring to the computer which itself is a device (ID == 'z'). I have a
Java program on the PC which generates commands and displays the results. Currently I only have 5 devices in the ring (a PC as controller, a Raspberry Pi, a Mega 2560 and two devices based on PIC16F628A) but I hope to be able to expand this. I would like to have used I2C but the PIC16F628A chips do not have built-in I2C and I'm not keen on 'bit banging'. My protocol looks a bit like I2C with each record having the device ID as the first character and then the rest of the record depends on the device but terminated by a '\n'. I'm running this at 115200 Baud. Currently I don't have a checksum of any sort but I'm probably going to have to add one. I typically have about 10 commands of around 10 bytes per second which means I have plenty of spare capacity but I don't know how well this will scale; probably not well.