I am trying to use a TI C2000 microcontroller to access data from an external adc using I2C. This ADC has multiple channels so I would like to be able to retrive data from all of them. Right now I have code setup to pull data from one channel and it works great. It can communicate with the ADC, retrieve the data, and show it on a matlab scope in real time (using external mode). I can even switch between channels with a manual switch that changes the I2C TX block's data command.
However, I am lost as to how to cycle between these channels periodically and see them both simultaneously. I've seen this example which uses function calls to sequence multiple TX blocks, but it still only uses one recieve block as it seems the data from both sensors comes at the same time. In my case I need to send a seperate command to the ADC for each channel (e.g. 255 for channel 8 and 223 for channel 4) and read the value sent by the ADC after each command. I tried doing a similar approach with function calls chaining together multiple TX and RX blocks in subsystems, but I could not get data from either channel when I tried that.
If someone has an example of something like this being done or any advice on what direction to take I would very much appreciate it. I am also curious how these blocks work (I am actually surprised that the given example works.) Does each block trigger repeatedly? If so is once per the sample rate or some other speed? Does the RX block wait for the TX block to complete before it tries to read and vice versa? Also, how does this change when you put the blocks in a subsystem? Does each one go once and then move on to the next subsytem or is there more to it?
I have attached files for both of my attempts, let me know if you see what is going wrong in the sequeced function call version. When I probe the sda line I can see some action, so it is doing something, but it's not quite there.
Thanks in advance,