Shop OBEX P1 Docs P2 Docs Learn Events
Trouble with a method using the ds1620 — Parallax Forums

Trouble with a method using the ds1620

lrtnorfolklrtnorfolk Posts: 19
edited 2012-02-23 23:29 in Propeller 1
Hello All,
Got just a slight problem with a spin program. I have a prop that is attached to a DS1620. The DS1620 is being used in the "HIGH RES Mode" (i.e. one shot). The attached "TEST" program works just fine, until the DS1620 reads below 31 Degrees F. When it gets below 31 degrees F, the "Dist_stack:=loop(tf)" method returns 0. This is main problem I am trying to fix. It should return a value of 99 (at 31 F)... or when it gets to 27 degrees F, it should read 104. I know that there are other errors, but I have "work-around" for them. Not sure if it has something to do with the DS1620 raw data at 31 degrees? If you noticed, when it reaches 31 degrees F, the DS1620 sends a value of 236. Thus I must compensate with the following "If tf>200...then tf:=tf-205". This value decreases in lock step with the actual value i.e. 236=31, 235=30, ect. Even with this compensation, it seems the "Dist_stack:=loop(tf)" method does not work (but works fine when the temp is above 31 degrees F). I only need to get this working between 15 to 115 degrees F. Thanks.

Renee

Comments

  • Mark_TMark_T Posts: 1,981
    edited 2012-02-23 09:36
    lrtnorfolk wrote: »
    Hello All,
    Got just a slight problem with a spin program. I have a prop that is attached to a DS1620. The DS1620 is being used in the "HIGH RES Mode" (i.e. one shot). The attached "TEST" program works just fine, until the DS1620 reads below 31 Degrees F. When it gets below 31 degrees F, the "Dist_stack:=loop(tf)" method returns 0. This is main problem I am trying to fix. It should return a value of 99 (at 31 F)... or when it gets to 27 degrees F, it should read 104. I know that there are other errors, but I have "work-around" for them. Not sure if it has something to do with the DS1620 raw data at 31 degrees? If you noticed, when it reaches 31 degrees F, the DS1620 sends a value of 236. Thus I must compensate with the following "If tf>200...then tf:=tf-205". This value decreases in lock step with the actual value i.e. 236=31, 235=30, ect. Even with this compensation, it seems the "Dist_stack:=loop(tf)" method does not work (but works fine when the temp is above 31 degrees F). I only need to get this working between 15 to 115 degrees F. Any help would be greatly appreciated.Attachment not found.

    Thanks.

    Renee

    The DS1620 object should be returning correct signed values for the high res modes - a glance at that object and your code doesn't suggest any obvious problem - suggest you print out the values you are getting from the object to see what's going on before you call loop() - loop has an indentation issue BTW, perhaps that's your problem?
  • lrtnorfolklrtnorfolk Posts: 19
    edited 2012-02-23 23:29
    SOLVED!!!
    Thanks Mark for your suggestion about printing the results before calling the loop. Turns out that when I wrote the value to eeprom, and then red it back, it gave a value of 236 (at 31 degrees F without correction). I decided to disabled reading and writing to eeprom and just print the values to PST. I discovered that the value that I was getting (at 31 degrees F) was 492. I think the incorrect value that I was getting had to do with writing the value to eeprom as a BYTE (and not a WORD or LONG, since the value was greater than 255). Sometimes, it's the stupid things you should check first. Anyway, my correction had to be "IF tf>200... then tf:=tf-461". This solved it. I put the DS1620 into the freezer to verify. Thanks for your help. Hope everyone has a good weekend.
    Renee
Sign In or Register to comment.