I am working on a project which requires reading from four sensors simultaneously with time stamps down to millisecond.
Right now the best I can come up with is to use four PICs to read from each sensor and output through four RS232 to a laptop. So those sensors don't interfere with each other. For time stamps, I use a mechanical switch to trigger a external pin voltage change interrupt to start timers in all PICs at the same time. Timers increment every one millisecond and I just simply append the value from timers at the end of every measurement and output them through serial ports.
It works but I just want to know if there is a better solution since this project is kind of time critical (1000 measurements per second required). And also internal timer for each PIC varies which defeats the purpose of synchronizing timers.
I also thought about just reading from one additional chip's timer using SPI so all time stamps come from one source. However, I don't know when those PICs will read the time from that source chip. There could be four PICs reading from it at the same time which will mess up time stamps.
Sensor 1: Quadrature encoder (channel A B and Index)
Sensor 2: Laser (sending measurement back through Rs232 interface)
Sensor 3: accelerometer (analogue)
Sensor 4: inclinometer (RS232 interface)
I am using four DSPIC30f4011 chips. They have QIEs enough UARTs and also support four channel simultaneous ADC.
For Quadrature encoder, I use an on chip QIE to read from it and send measurement to a laptop through UART.
For Lazer and inclinometer, I read from them through UART1 and send measurements to a laptop through UART2.(one chip for each of them)
For accelerometer, x y and z information are being collected using four channel simultaneous mode. Measurements are sent to a laptop through UART.