Shop OBEX P1 Docs P2 Docs Learn Events
lean code for DS2760 Thermocouple Kit — Parallax Forums

lean code for DS2760 Thermocouple Kit

l8_apex_itl8_apex_it Posts: 16
edited 2005-03-10 15:34 in BASIC Stamp
I just picked up the DS2760 Thermocouple Kit along with a BS2P. Everything went great. I ran the demo source·code and was able to get it working. I then stripped much of the menu's and features I didn't need. I then added it to an existing program I have(which was small and uses RCtime and displays the reading to a 2x16 LCD display)· and it was out of variable space. So I did what I could and changed some of the variables from word to nib or byte where I could. I was able to get it working. My main concern is that I don't have much room for additional use.

I figure there are·some excellent programmers out there who are very efficient at coding. Has anyone written a subroutine·with minimal variables to read temperature from the DS2760?

More info... I am using the K thermocouple and obviously the Ktablepos.bpe

Thanks

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-03-10 04:47
    I spent a week writing that program ... I would LOVE to see you make it more efficient -- and maintain all its features and functionality.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • l8_apex_itl8_apex_it Posts: 16
    edited 2005-03-10 06:05
    I am sensing sarcasm...
    I apologize if my post came across the wrong way. I was not criticizing the coding at all. I am a complete newbie and was hoping to use two of the DS2760's··(one for tank temperature and one room temperature) and use it to control my reef tank main lighting, cooling fans, LCD display, etc... After running the demo program last night and having the variable out of space message I had the realization that maybe I would not be able to do what I had wanted it to do. Just learning and not really having much experience I was assuming·that maybe some variables could be reused and that they were put in place to make it easier for newbies to see what was going on.

    For example I eliminated tempf and changed tempf=....· to tempc=tempC.... in order to eliminate one variable and still convert the reading to Degrees F. I thought maybe more could be done along those lines.

    Once again... I apologize if my post came across the wrong way. I appreciate the fact that there is demosource code provided. I am a hack and would have never got it working if it weren't for the demosource coding provided by Parallax and their wonderful documentation.
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2005-03-10 08:02
    I don't know if you realize this, but your BS2p has additional RAM in the form of "scratchpad". You can name locations in the scratchpad and put a bunch of your measured temperatures there. Reuse the same code to get each temperature. When you are not taking temperatures, you can recycle the same variable used by the DS2760 for other purposes. As you use the Stamp, you will become adept at recycling and aliasing variables!

    ' something like this...
    channel = 1
    GOSUB DS2760
    PUT tankTemp, Word result
    channel = 2
    GOSUB DS2760
    PUT roomTemp, Word result
    GET tankTemp, Word AA
    GET roomTemp, Word BB
    IF AA>BB THEN DEBUG "it's hot in here",CR

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • kb2hapkb2hap Posts: 218
    edited 2005-03-10 12:38
    On another note on the BS2P:
    You have multiple pages you could put parts of your program on
    each page you can have new variables on each page.
    I belive the BS2P has 8 pages of 2K each

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    DTQ
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-03-10 14:51
    l8_apex_it: In all my time of being on these forums I have always been sure to keep tabs on Jon's posts because he's always insightful and I respect him. I have never known him to use sarcasm in any of his posts, he always shoots from the hip. Sarcasm is a very difficult to express and usually comes across overly harsh in the written word. Lastly as an employee of Parallax, it would do no service to the wonderful reputation of the company for him to use sarcasm. So I really believe he is being sincere.

    Post Edited (Paul Baker) : 3/10/2005 2:54:53 PM GMT
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-03-10 15:01
    I was being sincere. I work very hard at writing good, clean, efficient code, and am ALWAYS looking for better solutions -- whether they come from somebody new or somebody with experience.·· And do pay attention to what Tracy has to say ... I've "liberated" countless lines of code from his programs.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • l8_apex_itl8_apex_it Posts: 16
    edited 2005-03-10 15:34
    Thanks for the replies as the information given will give me more keywords to research further. I'm enjoying learning more of the electronics side of things as my background is a ME. Parallax has done· a great job at making it fun and relatively easy to learn!·
Sign In or Register to comment.