Multiple ADC's
Hello again all,
So I am trying to get reading from 4 lt1298 - 12 bit adc's. I seem to be struggling trying to get them all to interface up with out burning up 4+ cogs in the process.
So here is the problem I think if I use the standard object for this adc, CD-LT1298 from the OBEX, each time I initialize a new adc it starts up a new Full duplex Serial set, taking up 2 cogs. I think.... Unless its not working that way and just changing the send receive pins each time I call the ADC to get the data. THis would be ideal and how I would treat it if going to re write the driver.
I just wanted to check before I tried to re write the drivers, is there a neat trick work around for this? Or would it be worth it to Start the adc, get data, stop it.. open next one repeat. it is not that speed critical, but I only have 2 free cogs in the app as of now.
It leaves to a side note question, there are many objects that call full duplex serial, each time one of these is called does it start up a new cog or 2 to run the communications? Or is full duplex serial smarter than me, and just looks for the send receive data for what ever set of pins that object wants it to?
Thanks again and as always,
TJ
So I am trying to get reading from 4 lt1298 - 12 bit adc's. I seem to be struggling trying to get them all to interface up with out burning up 4+ cogs in the process.
So here is the problem I think if I use the standard object for this adc, CD-LT1298 from the OBEX, each time I initialize a new adc it starts up a new Full duplex Serial set, taking up 2 cogs. I think.... Unless its not working that way and just changing the send receive pins each time I call the ADC to get the data. THis would be ideal and how I would treat it if going to re write the driver.
I just wanted to check before I tried to re write the drivers, is there a neat trick work around for this? Or would it be worth it to Start the adc, get data, stop it.. open next one repeat. it is not that speed critical, but I only have 2 free cogs in the app as of now.
It leaves to a side note question, there are many objects that call full duplex serial, each time one of these is called does it start up a new cog or 2 to run the communications? Or is full duplex serial smarter than me, and just looks for the send receive data for what ever set of pins that object wants it to?
Thanks again and as always,
TJ
Comments
So go ahead and disregard that adc's problem, they never call full duplex serial... Doh, all i need to do is change it slightly to change the com pins when I need to go to a different adc...
Sorry
Each declaration (instance) of FullDuplexSerial starts up a new cog when you call the "start" method. The instance saves the cog number used and, if you call the "stop" method or if you call the "start" method again, it first stops the running cog before starting a new one. The reason for this is that there are shared variables and the buffers and it wouldn't work to have two cogs trying to change the same variables at the same time.
You can have more than one instance of FullDuplexSerial (or any other driver) running at the same time. This works because there's a separate copy of the variables for each declared instance. They do have to be initialized to use different I/O pin numbers as you might expect.