WRITE REAR eeprom Address ????'s


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2007
    Location
    Houston, TX
    Posts
    96

    Default WRITE REAR eeprom Address ????'s

    Hello,
    I would like to know how to put the Address (for WRITE, READ command) in a for loop such that I can write once to adress 0, and then roll into adress 1 and so on. I have tried creating am variable but an not able to do this. Basically I am reading a POT 10x a second, sampling the data once and storing that sample in my eeprom, then reading the values back out to my LCD. I would like to use all 256 bytes of space in my eeprom while data logging.

    It's probably a dumb question but....?

    here is the snippet of my code that does work but is obviously a space waster

    Code:
    loop1:
    LCDOUT 254,1
    for a = 0 to 20
    ADCIN 0, Value
    wriTE 0, Value
        y = ( Value *100 ) / 51   'divided down from * 255 / 130
        LCDOUT 254,Row1,"LOG SENSOR ",DEC1 (y / 100 ),".",DEC2 ( y // 100 )," VDC" 
        lcdout 254,Row3+2, "0......|......5"                     
        ; syntax- BARgraph   Value, Row, Col, Width, Range, Style
        @         BARgraph  _Value,   2,   2,    15,   255,  lines
        pause 100
        next a
        'FIRST DATA SAMPLE
        
    for b = 0 to 20    
    ADCIN 0, Value
    wriTE 1, Value
        y = ( Value *100 ) / 51   'divided down from * 255 / 130
        LCDOUT 254,Row1,"LOG SENSOR ",DEC1 (y / 100 ),".",DEC2 ( y // 100 )," VDC" 
        lcdout 254,Row3+2, "0......|......5"                     
        ; syntax- BARgraph   Value, Row, Col, Width, Range, Style
        @         BARgraph  _Value,   2,   2,    15,   255,  lines
        pause 100
        next b
        'SECOND DATA SAMPLE
    for c = 0 to 20
    ADCIN 0, Value
    wriTE 2, Value
        y = ( Value *100 ) / 51   'divided down from * 255 / 130
        LCDOUT 254,Row1,"LOG SENSOR ",DEC1 (y / 100 ),".",DEC2 ( y // 100 )," VDC" 
        lcdout 254,Row3+2, "0......|......5"                     
        ; syntax- BARgraph   Value, Row, Col, Width, Range, Style
        @         BARgraph  _Value,   2,   2,    15,   255,  lines
        pause 100
        next c
        'THIRD DATA SAMPLE
    for d = 0 to 20
    ADCIN 0, Value
    wriTE 3, Value
        y = ( Value *100 ) / 51   'divided down from * 255 / 130
        LCDOUT 254,Row1,"LOG SENSOR ",DEC1 (y / 100 ),".",DEC2 ( y // 100 )," VDC" 
        lcdout 254,Row3+2, "0......|......5"                     
        ; syntax- BARgraph   Value, Row, Col, Width, Range, Style
        @         BARgraph  _Value,   2,   2,    15,   255,  lines
        pause 100
        next d
    Padawan-78

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    The way you do it right now write 20 time on the same EEPROM adress... well your eeprom wil wear out pretty fast huh?

    Anyways, several way, the first that spring to mind is..
    Code:
    For EEPAddr=0 to 255
        for d = 0 to 20
            ADCIN 0, Value
            y = ( Value *100 ) / 51   'divided down from * 255 / 130
            LCDOUT 254,Row1,"LOG SENSOR ",DEC1 (y / 100 ),".",DEC2 ( y // 100 )," VDC" 
            lcdout 254,Row3+2, "0......|......5"                     
            ; syntax- BARgraph   Value, Row, Col, Width, Range, Style
            @         BARgraph  _Value,   2,   2,    15,   255,  lines
            pause 100
            next
    
        wriTE EEPAddr, Value
        next
    
    LCDOUT $FE,  1, "Thanks for shopping here",_
           $FE,$C0, "Come again :o)"
    HTH
    Last edited by mister_e; - 17th April 2008 at 22:46.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Jan 2007
    Location
    Houston, TX
    Posts
    96


    Did you find this post helpful? Yes | No

    Default

    Good call on the Eeprom wearing out fast.
    Thanks for the help Mister E I will give it a try!
    Padawan-78

Similar Threads

  1. Can't read sequential addresses in external EEPROM
    By tjkelly in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th February 2010, 14:46
  2. PIC16F684 + LCD to use the 256bytes of EEPROM - HELP
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th March 2008, 14:19
  3. Need the code to write to a memory
    By Hamlet in forum General
    Replies: 0
    Last Post: - 20th August 2007, 00:22
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. word variable to 25lc640
    By TONIGALEA in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th July 2004, 19:59

Members who have read this thread : 1

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