Help;; eeprom won't read/write beyond address 255


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Dec 2009
    Location
    Kalamazoo
    Posts
    42

    Default Help;; eeprom won't read/write beyond address 255

    hi everyone.
    im trying a memory intensive app on a 18f2620, where i need to read/write ascii characters onto eeprom. this pic has 1024 eeprom bytes, but for some reason, i cannot read/write beyond address 255.

    program compiles ok but it shows black pixels on an lcd when i use this command:

    data @300, "a","s","c","i","i"

    i try to read at any of the above locations, and i get no values. works ok if i use any address under 255.

    what im i missing?

    thanks for reading
    NAG CON WIFE!
    WIFE VAR MOOD

  2. #2
    Join Date
    Dec 2009
    Location
    Kalamazoo
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    im reading the datasheet, and im thinking that it has something to do with the EEADR register, that controls the address, being 8 bit (256 values).

    so, is there life after address 255 in picbasic, or do i have to use external memory?

    thanks
    NAG CON WIFE!
    WIFE VAR MOOD

  3. #3
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    I notice that in my PBP file, the 18f2620.bas file of mine has this line commented out. Have you tried uncommenting it out? This is the line that tells pbp how big the EEProm is, so without it, PBP can't know its larger than usual.

    Code:
    'EEPROM  $F00000, $F003FF
    http://www.scalerobotics.com

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default

    Hi, DDDvvv

    EDIT : 300dec <> 300 hex !!! ... ::lol::

    300 dec = $12C ...

    no bug on my side ... just need to have a new pair of glasses ( it's true ! ) and scroll slowlier through MPLAB Window ...
    I had tested it for the 2525 too ... didn't see anything nor ...

    Alain
    Last edited by Acetronics2; - 30th August 2010 at 19:24.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Ah, now I see why it is commented out....

    WARNING Line 29: $F00000 Numeric overflow, value truncated. (18F2620.BAS)
    WARNING Line 29: $F003FF Numeric overflow, value truncated. (18F2620.BAS)

    Right you are Alain.
    http://www.scalerobotics.com

  6. #6
    Join Date
    Dec 2009
    Location
    Kalamazoo
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    thanks for replying guys.
    i get the same error if i uncomment the eeprom line.

    im sure there's some workaround in assembly, but for now, its off to i2c external memory and a pic with no eeprom. hopefully, i dont get the same error on using external memory.
    NAG CON WIFE!
    WIFE VAR MOOD

  7. #7
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    This works fine with PBP 2.60a and MPLAB ver 8.53.
    Code:
    DATA @300, "a","s","c","i","i"
     
    Dat VAR BYTE
    Index VAR WORD
     
    Main:
        FOR Index = 300 TO 304
            READ Index,Dat
            HSEROUT [Dat,13,10]
        NEXT
    Here:
        GOTO Here
    Spits it out as expected in the serial output window, and MPLAB shows all data in the EEPROM view window.

    Of course you need a word size variable for the index pointer when the address is > 255.
    Last edited by Bruce; - 30th August 2010 at 17:51.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  8. #8
    Join Date
    Oct 2007
    Location
    Vancouver, BC, Canada
    Posts
    33


    Did you find this post helpful? Yes | No

    Default

    hi I bring this thread up because i have trouble compiling eeprom passed the 256 bytes
    chip used 18f2620 it has 1024x8 byte of eeprom

    pbp pro version 2.60a
    mplab ide 8.63
    mpasm v5.39
    microcode studio 4.0.0.0

    so please point out what i did wrong.
    Please help and thank you.

    I have tried both the DATA and EEPROM, both cannot compile more than 256 byte of eeprom

    my code is enclosed.
    Code:
     '****************************************************************
    '*  Name    : UNTITLED.BAS                                      *
    '*  Author  : KVLV                                              *
    '*  Notice  : Copyright (c) 2010 VANCOUVER                      *
    '*          : All Rights Reserved                               *
    '*  Date    : 12/27/2010                                        *
    '*  Version : 1.0                                               *
    '*  Notes   :                                                   *
    '*          :                                                   *
    '****************************************************************
    'chip use 18F2620
    '
    DEFINE LOADER_USED 1 'for bootstrap loader
    define OSC 20
    'define HSER_BAUD 19200  ' on pc side set to 19200 8N1 (8 data bits, no parity bit, 1 stop bit)
    define HSER_BAUD 19200
    ' Set receive register to receiver enabled
    DEFINE HSER_RCSTA 90h  
    ' Set transmit register to transmitter enabled
    DEFINE HSER_TXSTA 20h  
    
    INCLUDE "Modedefs.bas"
    
    L var word
    B var word
    M var word
    temp var word
    'Mask var byte
    X var word  '[5]
    'Y VAR BIT[40]
    C VAR word
    S var byte[5]
    
    data %00000000, %00000000, %00000000, %00000000, %00000000 'space
    data %00000000, %00000000, %01111001, %00000000, %00000000 '!
    data %00000000, %01110000, %00000000, %01110000, %00000000 'double_quotes
    data %00010100, %01111111, %00010100, %01111111, %00010100 'hash
    data %00010010, %00101010, %01111111, %00101010, %00100100 'dollar_sign
    data %01100010, %01100100, %00001000, %00010011, %00100011 'percent
    data %00110110, %01001001, %01010101, %00100010, %00000101 'ampersand
    data %00000000, %01010000, %01100000, %00000000, %00000000 'apostrophe
    data %00000000, %00011100, %00100010, %01000001, %00000000 'left_parenthesis
    data %00000000, %01000001, %00100010, %00011100, %00000000 'right_parenthesis
    data %00010100, %00001000, %00111110, %00001000, %00010100 'asterisk
    data %00001000, %00001000, %00111110, %00001000, %00001000 'plus
    data %00000000, %00000101, %00000110, %00000000, %00000000 'comma
    data %00001000, %00001000, %00001000, %00001000, %00001000 'minus
    data %00000000, %00000011, %00000011, %00000000, %00000000 'full_stop
    data %00000010, %00000100, %00001000, %00010000, %00100000 'forward_slash
    data %00111110, %01000101, %01001001, %01010001, %00111110 'zero
    data %00000000, %00100001, %01111111, %00000001, %00000000 'one
    data %00100001, %01000011, %01000101, %01001001, %00110001 'two
    data %01000010, %01000001, %01010001, %01101001, %01000110 'three
    data %00001100, %00010100, %00100100, %01111111, %00000100 'four
    data %01110010, %01010001, %01010001, %01010001, %01001110 'five
    data %00011110, %00101001, %01001001, %01001001, %00000110 'six
    data %01000000, %01000111, %01001000, %01010000, %01100000 'seven
    data %00110110, %01001001, %01001001, %01001001, %00110110 'eight
    data %00110000, %01001001, %01001001, %01001010, %00111100 'nine
    data %00000000, %00110110, %00110110, %00000000, %00000000 'colon
    data %00000000, %00110101, %00110110, %00000000, %00000000 'semicolon
    data %00001000, %00010100, %00100010, %01000001, %00000000 'less_than
    data %00010100, %00010100, %00010100, %00010100, %00010100 'equals
    data %00000000, %01000001, %00100010, %00010100, %00001000 'greater_than
    data %00100000, %01000000, %01000101, %01001000, %00110000 'question_mark
    data %00100110, %01001001, %01001111, %01000001, %00111110 'at
    data %00111111, %01000100, %01000100, %01000100, %00111111 'A
    data %01111111, %01001001, %01001001, %01001001, %00110110 'B
    data %00111110, %01000001, %01000001, %01000001, %00100010 'C
    data %01111111, %01000001, %01000001, %00100010, %00011100 'D
    data %01111111, %01001001, %01001001, %01001001, %01000001 'E
    data %01111111, %01001000, %01001000, %01001000, %01000000 'F
    data %00111110, %01000001, %01001001, %01001001, %00101111 'G
    data %01111111, %00001000, %00001000, %00001000, %01111111 'H
    data %00000000, %01000001, %01111111, %01000001, %00000000 'I
    data %00000010, %00000001, %01000001, %01111110, %01000000 'J
    data %01111111, %00001000, %00010100, %00100010, %01000001 'K
    data %01111111, %00000001, %00000001, %00000001, %00000001 'L
    data %01111111, %00100000, %00011000, %00100000, %01111111 'M
    data %01111111, %00010000, %00001000, %00000100, %01111111 'N
    data %00111110, %01000001, %01000001, %01000001, %00111110 'O
    data %01111111, %01001000, %01001000, %01001000, %00110000 'P
    data %00111110, %01000001, %01000101, %01000010, %00111101 'Q
    data %01111111, %01001000, %01001100, %01001010, %00110001 'R
    data %00110001, %01001001, %01001001, %01001001, %01000110 'S
    data %01000000, %01000000, %01111111, %01000000, %01000000 'T
    data %01111110, %00000001, %00000001, %00000001, %01111110 'U
    data %01111100, %00000010, %00000001, %00000010, %01111100 'V
    data %01111110, %00000001, %00001110, %00000001, %01111110 'W
    data %01100011, %00010100, %00001000, %00010100, %01100011 'X
    data %01110000, %00001000, %00000111, %00001000, %01110000 'Y
    data %01000011, %01000101, %01001001, %01010001, %01100001 'Z
    data %00000000, %01111111, %01000001, %01000001, %00000000 'left_square
    data %00100000, %00010000, %00001000, %00000100, %00000010 'back_slash
    data %00000000, %01000001, %01000001, %01111111, %00000000 'right_square
    data %00010000, %00100000, %01000000, %00100000, %00010000 'circumflex
    data %00000001, %00000001, %00000001, %00000001, %00000001 'underscore
    data %00000000, %01000000, %00100000, %00010000, %00000000 'grave_accent
    data %00000010, %00010101, %00010101, %00010101, %00001111 'a
    data %01111111, %00001001, %00001001, %00001001, %00000110 'b
    data %00001110, %00010001, %00010001, %00010001, %00010001 'c
    data %00000110, %00001001, %00001001, %00001001, %01111111 'd
    data %00001110, %00010101, %00010101, %00010101, %00001101 'e
    data %00000000, %00001000, %00111111, %01001000, %00100000 'f
    data %00001001, %00010101, %00010101, %00010101, %00011110 'g
    data %01111111, %00001000, %00001000, %00001000, %00000111 'h
    data %00000000, %00000000, %00101111, %00000000, %00000000 'i
    data %00000010, %00000001, %00000001, %01011110, %00000000 'j
    data %00000000, %01111111, %00000100, %00001010, %00010001 'k
    data %00000000, %01000001, %01111111, %00000001, %00000000 'l
    data %00011111, %00010000, %00001110, %00010000, %00011111 'm
    data %00011111, %00001000, %00010000, %00010000, %00001111 'n
    data %00001110, %00010001, %00010001, %00010001, %00001110 'o
    data %00011111, %00010100, %00010100, %00010100, %00001000 'p
    data %00001000, %00010100, %00010100, %00010100, %00011111 'q
    data %00011111, %00001000, %00010000, %00010000, %00001000 'r
    data %00001001, %00010101, %00010101, %00010101, %00010010 's
    data %00010000, %00010000, %01111110, %00010001, %00010010 't
    data %00011110, %00000001, %00000001, %00000001, %00011110 'u
    data %00011100, %00000010, %00000001, %00000010, %00011100 'v
    data %00011110, %00000001, %00000110, %00000001, %00011110 'w
    data %00010001, %00001010, %00000100, %00001010, %00010001 'x
    data %00010000, %00001001, %00000110, %00001000, %00010000 'y
    data %00010001, %00010011, %00010101, %00011001, %00010001 'z
    data %00001000, %00110110, %01000001, %01000001, %00000000 'leftcurly
    data %00000000, %00000000, %01111111, %00000000, %00000000 'vertline
    data %00000000, %01000001, %01000001, %00110110, %00001000 'rightcurly
    data %00000100, %00001000, %00001000, %00001000, %00010000 'tilde
    data %01111111, %01000001, %01000001, %01000001, %01111111 'del 
    
    
    TRISA=%00000000       '0=output
    TRISB=%00000000       '1 = input
    TRISC=%00000000
    ADCON0=%11000000
    ADCON1=%00000111
    CMCON =%00000111                   ' Comparators = off
    
    INTCON2.7=0 ' Enable Pull-Up's    PIC18F2620   'VERIFIED
    
    Main:
        
    '    temp=l
        
    '    'display data sideway
    '    for M=0 to 4
    '        read l,x
            
    '        hserout ["L:",dec3 l, " X:",bin8 x,13,10]
    '        l=l+1
    '        if l>175 then 
    '            l=170
    '        endif
           
    '    next m   
    '    s[0]= %01111111     'these lines work
    '    s[1]= %01000001
    '    s[2]= %01000001
    '    s[3]= %01000001
    '    s[4]= %01111111
        
    '      for c=470 to 474
    '           write c,s[c-470]
    '           pause 1
    '      next c
          
          
          
          for c=0 to 475 step 5
            hserout ["C:", dec c,13,10]
            gosub rotate
          next c
          
          hserout ["That's all folk!",13,10]
        
        END 
    
    
    
    
    
    goto main
    
    
    '-----------------
    'setup variable
    'set c as location of 
    'call this
    'ex:
    ' c=0
    ' gosub rotate
    '
    Rotate:   'rotate 90 counterclockwise
        l=c
        temp=l
        for m=0 to 4
            read l, x
            hserout [bin x.7]
            l=l+1
        next m
        hserout [13,10]
     
        l=temp
        for m=0 to 4
            read l, x
            hserout [bin x.6]
            l=l+1
        next m
        hserout [13,10]
    
        l=temp
        for m=0 to 4
            read l, x
            hserout [bin x.5]
            l=l+1
        next m
        hserout [13,10]
    
        l=temp
        for m=0 to 4
            read l, x
            hserout [bin x.4]
            l=l+1
        next m
        hserout [13,10]
    
        l=temp
        for m=0 to 4
            read l, x
            hserout [bin x.3]
            l=l+1
        next m
        hserout [13,10]
    
        l=temp
        for m=0 to 4
            read l, x
            hserout [bin x.2]
            l=l+1
        next m
        hserout [13,10]
    
        l=temp
        for m=0 to 4
            read l, x
            hserout [bin x.1]
            l=l+1
        next m
        hserout [13,10]
    
        l=temp
        for m=0 to 4
            read l, x
            hserout [bin x.0]
            l=l+1
        next m
        hserout [13,10,13,10]  
    
    return
    Attached Files Attached Files
    ________________
    KV

  9. #9
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    KVLV, Are you sure you are compiling it with the right chip selected? I have been using 18F2620's for the last few years with almost all of the eeprom used. I have never had such a problem. Your code at first glance looks as though it should work.

    Dave Purola,
    N8NTA

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