Data memory - explanation please


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Uhmm maybe I spoke too soon...

    I have a menu section, which in tern selects sub menus to set the various variables up and then return back to the main menu. The last option of the main menu is this

    Code:
    LCDOUT $FE,1 
    Gosub SetButtonRelease
    Lcdout $FE,2
    LCDOUT $FE,$80,"Saving Settings"
    for fn= 0 to 3
      write (10*fn + 80),lightsetHR[fn]
      write (10*fn + 81),lightsetMN[fn]
      write (10*fn + 82),lightoffHR[fn]
      write (10*fn + 83),lightoffMN[fn]
      write (10*fn + 84),droptemp[fn]
      write (10*fn + 85),normtemp[fn]
      write (10*fn + 86),StartHour[fn]
      write (10*fn + 87),StartMin[fn]
      write (10*fn + 88),StopHour[fn]
      write (10*fn + 89),StopMin[fn]
      write (10*fn + 90),alarmhigh[fn]
      Write (10*fn + 91),alarmlow[fn]
      
    next fn
    pause 150
    goto main
    which when selected should write all the variables to memory before going to the main program.

    On powerup the values are read back in as part of the initialisation

    Code:
    for fn= 0 to 3
      read (10*fn + 80),lightsetHR[fn]
      Read (10*fn + 81),lightsetMN[fn]
      Read (10*fn + 82),lightoffHR[fn]
      Read (10*fn + 83),lightoffMN[fn]
      Read (10*fn + 84),droptemp[fn]
      Read (10*fn + 85),normtemp[fn]
      Read (10*fn + 86),StartHour[fn]
      Read (10*fn + 87),StartMin[fn]
      Read (10*fn + 88),StopHour[fn]
      Read (10*fn + 89),StopMin[fn]
      Read (10*fn + 90),alarmhigh[fn]
      Read (10*fn + 91),alarmlow[fn]
      
    next fn
    the strange thing is that the normaltemp, alarmhigh and alarmlow values don't appear to of been saved (or are being misread in some way).

    Interestingly, the data view doesn't show anything at 80
    Last edited by malc-c; - 4th August 2010 at 16:04. Reason: added image

  2. #2
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    I think I've discovered part of the problem, in that I'm using word rather than bytes.

    The manual states:
    To write a word, each of the 2 bytes that make up the word must be
    written separately:
    w Var Word
    WRITE 0,w.BYTE0
    WRITE 1,w.BYTE1
    I'm a little stumped as to how I need to write and read back a mixture of byte and word, the values which are words are typically represented as three digit numbers eg: 567 thus represents 56.7 degrees, so the alarmhigh(fn) will all be three digit numbers

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts