LCD displays, rotary encoders, and the WRITE statement


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Aug 2011
    Posts
    460


    Did you find this post helpful? Yes | No

    Default Re: LCD displays, rotary encoders, and the WRITE statement

    write preset_counter, encoder1_counter, encoder2_counter, encoder3_counter
    Each time you write you're writing three bytes of data, but you're only incrementing the address (preset_counter) by one.
    The next time you write you'll be overwriting part of the previously saved data.

    When you go to write/read, multiply preset_counter by 4 and use that as the address so the three bytes are preserved.
    Make sure preset_counter is never more than 255/4 or the address will wrap since it's a byte value.

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: LCD displays, rotary encoders, and the WRITE statement

    Yes! That fixed it. I didn't realize that each data space had its own address. I thought everything in the statement was stored at the designated address.

    write 4, 1, 2, 3

    So 1 is stored at address 4, 2 is stored at address 5, and 3 is stored at address 6? And then if I want to write something else, it would have to be "write 7, 4, 5, 6" if I didn't want to overwrite the other data? Is that how it works?

  3. #3
    Join Date
    Aug 2011
    Posts
    460


    Did you find this post helpful? Yes | No

    Default Re: LCD displays, rotary encoders, and the WRITE statement

    Basically, yes, as long as you're talking about bytes.

    EEPROM is byte-addressable, and each byte has its own address. Muti-byte variables like words and longs take multiple bytes (addresses) for each value.

Similar Threads

  1. Replies: 10
    Last Post: - 29th June 2010, 21:58
  2. 2 LCD Displays, one Pic
    By Art in forum General
    Replies: 10
    Last Post: - 10th April 2010, 14:56
  3. Rotary encoders
    By mister_e in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 21st February 2007, 17:57
  4. LCD Displays
    By Roland in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 16th August 2005, 10:43
  5. Melanie's LCD displays
    By BobK in forum Adverts
    Replies: 1
    Last Post: - 24th October 2004, 12:27

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