Shop OBEX P1 Docs P2 Docs Learn Events
Get and Put Help using BS2SX — Parallax Forums

Get and Put Help using BS2SX

GuidoGuido Posts: 195
edited 2005-03-17 14:09 in BASIC Stamp
I seem to be as usual having problems with the GET and PUT statements using a [url=mailto:BS@SX]BS2SX[/url]. I am trying to save temperature (TEMPF) from Program Run0 and reading information on Run1.

RUN0 has TempF identified in it's program as a Word variable, so I use a simple:
PUT 0,TEMPF

In the RUN1 program I use the following:
GET 0, TEMPF
Debug DEC TEMPF

It does not work and I am wondering what I am forgetting?. Do I need to identify the Bank in the statements?
Thanks
Guido


·

Comments

  • kb2hapkb2hap Posts: 218
    edited 2005-03-17 12:31
    Is tempf a variable in slot 1 as well?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    DTQ
  • GuidoGuido Posts: 195
    edited 2005-03-17 12:46
    Yes it is. Forgot to mention the program has been shortened just to show the problem area, but switching banks is also working
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-03-17 14:09
    Keep in mind that PUT and GET usually work with bytes, and a word is two bytes. In your example you are only writing the low byte of the word. Here's what you need to do to make sure both bytes are put into the Scratchpad:

    PUT 0, Word tempF

    then, in slot 1:

    GET 0, Word tempF

    By adding the Word modifier to PUT and GET, the compiler will cause both bytes of the value to be used.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
Sign In or Register to comment.