The available I2C ports on the mbed support the 400kbit/s datarate. They still work at around 500kbit/s. Depending on the portexpander type that you use, it costs about 20bits/byte outputdata. Updating all 6 portexpanders takes 120 bittimes (0.24 ms). You should be OK as far as resolution is concerned. However, the standard mbed libs for I2C are blocking and you loose some processing time. You may also need to run at lower speeds depending on the capacitive load on the I2C bus (number of devices, wire distance).
SPI comms work in a similar way, faster bitrates but no addressing, so you need separate CS lines to each expander. You can simplify that by just daisy-chaining them or using plain shiftregisters like a 74595.
The portupdating process could be linked to a ticker (5 ms rate) that sends the next 6 databytes from the active half of a double buffer. The mainloop checks for new data received via ethernet, updates the inactive half of the double buffer and switches the two buffers at the appropriate moment.
Hi.
I need to develop a controller for a group of 48 valves (Turn on off in a sequence). The resolution is 5 ms. The faster cycle is 350ms.
I´m planning to use a group of 6 port expanders 8 output each via ISP or I2C.
Is it possible to change the timing (ON OFF) via ethernet on the fly. I mean, change the ON OFF timing while the valves are working, without retarding the trigger of the valves?
Thanks for your help.