writing 256 bytes to eeprom


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    Join Date
    Nov 2008
    Posts
    41

    Default writing 256 bytes to eeprom

    Say I want to write this 256 bytes of data to the eeprom of a 16F876A.

    $3C,$F0,$C0,$03,$04,$08,$3F,$FC
    $42,$08,$21,$04,$0C,$8C,$20,$82
    $81,$04,$12,$08,$14,$4A,$20,$81
    $81,$04,$02,$C8,$24,$49,$20,$81
    $81,$04,$02,$C8,$C4,$48,$20,$81
    $81,$04,$02,$08,$04,$88,$20,$82
    $81,$04,$02,$08,$04,$08,$3F,$FC
    $81,$04,$C2,$0B,$04,$08,$20,$C0
    $81,$04,$22,$0C,$04,$08,$20,$A0
    $81,$04,$12,$08,$04,$08,$20,$90
    $81,$04,$12,$C8,$04,$08,$20,$88
    $81,$04,$12,$C8,$04,$08,$20,$84
    $81,$04,$12,$08,$04,$08,$20,$82
    $42,$08,$21,$04,$04,$08,$20,$81
    $3C,$F0,$C0,$03,$04,$00,$20,$81
    $00,$00,$00,$00,$00,$00,$00,$00
    $00,$00,$00,$00,$00,$00,$00,$00
    $7F,$F8,$03,$0F,$80,$0F,$3F,$3E
    $80,$04,$80,$10,$40,$88,$20,$41
    $80,$04,$40,$20,$20,$48,$20,$80
    $80,$04,$40,$20,$13,$48,$20,$80
    $80,$04,$40,$20,$13,$48,$20,$80
    $80,$08,$40,$20,$10,$88,$20,$80
    $40,$10,$40,$20,$10,$08,$3F,$40
    $3C,$20,$40,$20,$10,$08,$20,$3C
    $02,$40,$40,$20,$10,$08,$20,$02
    $01,$80,$40,$20,$10,$08,$20,$01
    $01,$00,$41,$20,$13,$08,$20,$01
    $01,$00,$42,$20,$13,$08,$20,$01
    $81,$00,$42,$20,$20,$08,$20,$01
    $42,$00,$9A,$10,$40,$08,$20,$82
    $3C,$00,$1A,$0F,$80,$0F,$20,$7C

    How would this block sit in the code space? Surely not 32 variables defined and then these 32 lines. If it needs 32 lines then its as simple as incrementing the write command with a for loop. The manual says each eeprom write is 10ms long. Does that mean writing all 256 bytes takes 320ms?

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Not exactly sure what you're doing.

    But it might be easier to use EEPROM or DATA statements, and let the programmer write the data.
    <br>
    DT

  3. #3
    Join Date
    Nov 2008
    Posts
    41


    Did you find this post helpful? Yes | No

    Default

    The data is for that non addressable lcd I'm playing around with. Changing even one pixel requires all 256 bytes be written over again. Originally my plan was to have a default array loaded in ram and then write different parts to make changes and then send out the whole thing again.

    Doing some thinking now it makes more sense to have the template and digits all in codespace and selectively read out the right chunks. The display doesn't care what speed data is received, as long as it gets all 256 bytes.

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Oh, for the NKK display. I should have realized.

    Are you trying to display dynamic data like changing numbers, or just static labels for the button?
    <br>
    DT

  5. #5
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    967


    Did you find this post helpful? Yes | No

    Default

    If each of these 256 bytes is a fixed character, Icon, etc, you can just create a font table and place it in Code space as arrays of bytes and pull them out using the Lookup command. Much more easier than using EEPROM or DATA. There is an article of strings in code space out here. That might be a good starting point for you.

  6. #6
    Join Date
    Nov 2008
    Posts
    41


    Did you find this post helpful? Yes | No

    Default

    Darrel: Yes the data is changing numbers. Four digits would need updated. Its mostly for an initial setup of a piece of equipment. A user adjusts the speed to the correct level and then starts using it.

    Jerson: That answers one other question. A digit on the display is an array in code space. So the static part of the display is a large array and then each digit is a smaller array. Then lookup is used with shiftout to send the the right parts? I saw some postings about font tables but wasn't sure if they were right for this application.

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. Writing & Reading to iButton EEPROM
    By crhomberg in forum Code Examples
    Replies: 2
    Last Post: - 6th October 2008, 19:40
  3. How to write/read strings EEPROM/LCD
    By g-hoot in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 11th February 2007, 06:26
  4. I2CWRITE writing Strings to EEPROM
    By NavMicroSystems in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 27th March 2005, 19:45
  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 : 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