How do I get DATA @ to work with a 18F452?


Closed Thread
Results 1 to 9 of 9

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    I didn't quite understand your explanation that it must be split WORD sized in 2 BYtes or how to do that for the particular word variables that I want to use in my DATA statements? If my DATA @ statements must work AS IS then why would the WORD sized variables have to be split into 2 bytes?
    It's just because, as far as i'm aware of, DATA statement don't accept the WORD sized data you enter in. I just re-check it, and if you use
    DATA @0, $1234,$5678

    The DATA will load $34 @0 and $78 @1. Just for that. You'll need to split your data like...
    DATA @0,$12,$34,$56,$78

    Now Read back the results to the var as i did in the previous example with .LowByte and HighByte.

    There's also other way to do it Using MPASM statement and few assembler lines... up to you.

    Darrel Did something interesting in the Code example section.
    http://www.picbasic.co.uk/forum/show...ghlight=EE_var

    There's also another way to do it
    Code:
    data           @0, $12,$34,$56,$78
    data           word $abcd
    data           word $A1B2
    This will load your EEPROM like this
    Code:
     Address  00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F      ASCII      
    
       0000   12 34 56 78 CD AB B2 A1 FF FF FF FF FF FF FF FF .4Vx.... ........
       0010   FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ........ ........
       0020   FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ........ ........
       0030   FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ........ ........
       0040   FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ........ ........
       0050   FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ........ ........
       0060   FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ........ ........
       0070   FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ........ ........
       0080   FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ........ ........
       0090   FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ........ ........
       00A0   FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ........ ........
       00B0   FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ........ ........
       00C0   FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ........ ........
       00D0   FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ........ ........
       00E0   FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ........ ........
       00F0   FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ........ ........
    But you still need to load you value with .LowByte and .HighByte
    Last edited by mister_e; - 2nd February 2006 at 05:26.
    Steve

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

  2. #2
    jessey's Avatar
    jessey Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks Steve,

    Yes I am just now trying Darrel's EE_Vars.pbp. Hopefully that will solve my problems.

    What about using the DATA @ for my BYTE sized variables? I'd still like to understand what could be causing them not to work. Any idea why their not working as expected? Do you think it would have anything to with the way I have my configuration fuse's set in my program or what other settings that could possibly be causing it?

    I'm using EPIC Version 2.46 beta programmer.

    Thanks
    jessey
    Last edited by jessey; - 2nd February 2006 at 05:19.

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


    Did you find this post helpful? Yes | No

    Default

    Look the previous edited post.

    For your Melabs programmer.. i can't say as i'm not using it... but i remind one post on this forum somewhere... maybe you already found it?
    http://www.picbasic.co.uk/forum/show...6&postcount=18
    Last edited by mister_e; - 2nd February 2006 at 05:40.
    Steve

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

  4. #4
    jessey's Avatar
    jessey Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks Steve,

    I'll read up on it, in the meantime I'll give Darrel's EE_Vars.pbp a try.

    Many Thanks
    jessey

  5. #5
    jessey's Avatar
    jessey Guest


    Did you find this post helpful? Yes | No

    Default Darrel Taylor's EEPROM Variables (EE_Vars.pbp)

    Hello Steve,

    I just tried Darrel's "EE_Vars.pbp" and it fixed everything. The include file and routines work great on my 18F452. I couldn't believe how easy it was to set-up and implement. Thanks Darrel!! And thank you Steve for mentioning it.

    http://www.picbasic.co.uk/forum/show...ghlight=EE_var

    Thanks Again
    jessey
    Last edited by jessey; - 2nd February 2006 at 11:40.

Similar Threads

  1. Char. LCD and 18F452 on 20 MHz not work
    By samettin in forum General
    Replies: 11
    Last Post: - 28th July 2008, 10:59
  2. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 03:30
  3. Internal EEPROM Read/write Addressing Errors with 18F PIC's
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 18
    Last Post: - 12th July 2005, 20:42
  4. help
    By zugvogel1 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th February 2005, 21:42
  5. Need once your help one please
    By zugvogel1 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 9th February 2005, 21:33

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