Shop OBEX P1 Docs P2 Docs Learn Events
ROBO Games medal with DS18S20 temp, Vars exceed avaliable ram — Parallax Forums

ROBO Games medal with DS18S20 temp, Vars exceed avaliable ram

kf4ixmkf4ixm Posts: 529
edited 2010-03-05 14:24 in General Discussion
Hi all, i am working on interfacing a DS18S20 temp sensor to the robo games medal to scroll out the temperature. I'm using the Badge.sbx code as a building block and seeding this code with code from Bean's post,

http://forums.parallax.com/showthread.php?p=724654
I've had to take out alot of the badge.sbx animations and such, (leaving ascii and nums data) to try to free up memory. im pretty sure i haven't took out anything i need, the only errors i get are from when i try to add the 7 VARS from Beans code, telling me i've exceeded avaliable ram. if i take out the vars, it compiles and from the memory usage window, it seems like i should have enough.·here is a screenshot...

attachment.php?attachmentid=68299

Attached is my code that i have so far. hopefully someone with more sx/b experience can tell me what im doing wrong.

Also, i haven't added the code to actually read the ds18s20 yet, i have just added the pin, con's and vars, compiling as i go to check for errors. i read in the manual that this may be due to too many variables, are there a maximum number of vars in a program, depending on if it's a bit, byte or word? I've read the thread about using an array...
http://forums.parallax.com/showthread.php?p=592633

·to overcome running out of var space, but im not sure if this would apply to what im trying to do, or if it would work, or how to go about doing it

Post Edited (kf4ixm) : 3/3/2010 7:49:44 PM GMT
1024 x 576 - 144K

Comments

  • kf4ixmkf4ixm Posts: 529
    edited 2010-03-03 20:48
    ok, i changed the above to:
    owStatus VAR BYTE (1)
    owTempLSB VAR BYTE (7)
    owTempMSB VAR BYTE (7)
    DegSign VAR BYTE (1)
    DegreesC VAR BYTE (7)
    DegFrac VAR BYTE (7)
    P1 VAR BYTE (1)

    and those ram errors went away (not to say they're correct)·during compile, now i added the rest of the ds1820 code and imcoming up with multiple invalid parameter errors...
    attachment.php?attachmentid=68302

    Any ideas? also attached is the updated code. i suspect it's because of how i declared the vars as an array, and i need to do lookup/lookdown on those vars now in order to extract data, can someone confirm this? (or debunk as the case may be?)

    Post Edited (kf4ixm) : 3/3/2010 9:32:19 PM GMT
    1024 x 576 - 154K
  • Shawn LoweShawn Lowe Posts: 635
    edited 2010-03-04 01:23
    No, the problems are because you are declaring the subroutines wrong. Attached is my update that fixes that error, but there are (many)others. Whe you read the scratchpad, what are you trying to find? As you know, when you issue a read scratchpad command the 1820 sends 9 bytes of information, so you will have to put that command in a FOR NEXT loop and save the bytes to their respective places.
    FWI- I'm no Guru, just a student like you trying to understand the SX and programming in general.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Shawn Lowe


    When all else fails.....procrastinate!
  • kf4ixmkf4ixm Posts: 529
    edited 2010-03-04 14:35
    i think im gonna ditch seeding the badge code with the premade ds1820 code and just write the one-wire code from scratch. I'm beginning to realize that there maybe too much code involved between the code todisplay and the code to read the ds1820 to fit in memory. i·may later·go instead to the ds1620. i really wanted to use the ds18s20 because it fits the badge perfectly, (plus i already have it soldered in circuit). Not giving up yet, just changing my game plan.

    Post Edited (kf4ixm) : 3/4/2010 3:12:43 PM GMT
  • kf4ixmkf4ixm Posts: 529
    edited 2010-03-04 15:53
    Ok, im stumped on why a declared byte var would give me an error saying a bit is expected? i have the var as:

    owTempLSB··· VAR·· BYTE (8)

    ·attachment.php?attachmentid=68339

    I refuse to give up now, i know it looks like im just throwing stuff at it and seeing what sticks, and in a way i am, but i want to understand how the code works, or don't and if it don't why it doesn't.

    BTW, yes this is my first SX/b Program, im letting my brain rest from the propeller at the current time.

    Post Edited (kf4ixm) : 3/4/2010 4:03:48 PM GMT
  • JonnyMacJonnyMac Posts: 9,211
    edited 2010-03-04 20:36
    I think you're going to want to code an ISR that can handle the display multiplexing and OW code. 1-Wire is very time-specific, so you can't use the built-in 1-Wire routines while you have an interrupt in play. A possible solution is to move to a synchronous temperature sensor (e.g. DS1307) which won't be bothered by the ISR.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
  • kf4ixmkf4ixm Posts: 529
    edited 2010-03-05 14:24
    Thanks JonnyMac. im thinking i will go to another sensor.

    Ughh, i think my brain is bleeding... ok, back to the prop!
Sign In or Register to comment.