Question about Jm_ds1822_demo
lockadoc
Posts: 115
I am working on a project that needs to display the Temperature of Four DS18B20 chips, I have the method working with one chip. Using JM_Ds1822_demo. I have 4 chips connected to ports 0,1,2,3 and they all work one at a time. Is there a example somewhere that I see how it polls the four different addresses then displats them on the Serial Terminal?
My end goal is to get them to display on something like the _ML_GraphicsDemo.
Thanks for any heads up that you can give me.
Billy S.
My end goal is to get them to display on something like the _ML_GraphicsDemo.
Thanks for any heads up that you can give me.
Billy S.
Comments
It would be easier for people to help you if you provide links to the objects in question.
What does "_ML_GraphicsDemo" look like? How is the data displayed now?
Both came from the OBEX on this site. Hopefully these links work, i will try a few differents ways.
http://obex.parallax.com/object/261
http://obex.parallax.com/sites/all/modules/pubdlcnt/pubdlcnt.php?file=http://obex.parallax.com/sites/default/files/obj/id/261/_ML_Graphics_demo_v02.zip&nid=261
I've attached code which "should" read from four sensors. I don't have any DS1822 sensors to test it with.
This is what the output of my "test" version with dummy data looks like.
I need to quit procrastinating and get back to my own program.
EXPECTED ","
the books I have Don't give me a clue as how to correct it.
You're right. I thought for sure I had test compiled it. Sorry about that.
I added a "sensorIndex" parameter to a lot of the methods, including "readsn".
Line 115 should be:
The version attached to this post does compile but I'm not sure it really works. The main thing I wanted to show is how to use multiple instances of an object. Instead of the one wire object only being used once, it's now used four times.
Since "SENSORS_IN_USE" was defined as 4, there are are four instances of the "ow" object. These objects are accessed by using "ow[0]" through "ow[3]".
Rather than having a number to define the instance you could have different aliases for the object.
IMO, it's easier to use the first technique since the object can be accessed with a variable (for example "sensorIndex").
My 1-Wire object handles all the basics. If you download the data sheet for the desired part (hint, hint), you'll see that the transactions are quite easy. What I haven't yet implemented in the Propeller is a 1-Wire search, though I know it's possible because I did it with a BS2p a long time ago. Most applications know the serial numbers of the attached devices. Those can be stored in a DAT table. If you do some kind of read-back of the serial # you can save it to the EEPROM with an I2C object. Using the address of the DAT table in the EEPROM writes will mean simplify the code for subsequent uses.
To your specific question about multiple sensors on one line -- setup the DAT table to hold four 1W serial numbers:
You will have to use the read_sn() method -- with just one sensor connected -- to get the senor #s you're using. You need to do this four times.
Once you have the serial numbers array populated, use the read_tca(p_sn) method to read the sensors in a simple loop:
Thanks
it compiled and seems to get the data.
Now to take it apart and try to fiquire out how it works so i can expand on it.
again thanks for the assist.
Bill S