WRITE error in 18l.lib


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2010
    Posts
    13

    Question WRITE error in 18l.lib

    Hi. I am trying to use WRITE to write to EEPROM on a 18F4620 using PBPL and MPASM but I get the following:

    Error[113] c:\pbp\pbppi18l.lib 723 : Symbol not previously defined (WRITE)

    I checked the pbpi18l library and it does include WRITE.

    Any ideas why this is happening? Should I just ignore the error messages?

    I'l try to write to eeprom an see what happens.

    Thanks!

    Rogerio

  2. #2
    Join Date
    Feb 2010
    Posts
    13


    Did you find this post helpful? Yes | No

    Exclamation

    Tried to comiple and test but it won't compile while error shows up.

    Any ideas?

    Thanks!

    Rogerio

  3. #3
    Join Date
    Feb 2010
    Posts
    13


    Did you find this post helpful? Yes | No

    Unhappy

    Ok, I am trying to store LONG variables. Tried using BYTE variables and it works. It's supposed to work for LONG's also.
    Found something at http://www.melabs.com/support/pbpissues.htm and tried it:

    """""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""" "

    Add the following define at the top of the code. This define will have no effect on unaffected code, nor will it increase code space usage.

    DEFINE WRITE_USED 1

    """""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""" """"

    Now it says 1 is an illegal character!

    Do I have to store the LONG var into BYTE vars before Writing-Reading?

    I hope not.

    Please help!

    Rogerio

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


    Did you find this post helpful? Yes | No

    Default

    Can you post the code you're getting these errors with?
    Regards,

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

  5. #5
    Join Date
    Feb 2010
    Posts
    13


    Did you find this post helpful? Yes | No

    Default

    Hello Bruce,

    Wrote a short test code, here are the different tests I made:


    1.- LONG variables

    Code:
    
    clear
    
    DEFINE  WRITE_USED 1             
    
    
    Number1 var Long
    Number2 var long
    
    
    
    Start:
    
    number1 = 70000
    lcdout $FE,1
    lcdout $FE,$80,dec number1
    write 0,number1
    pause 2000
    read 0,number2
    lcdout $FE,$C0,dec number2
    pause 5000
    goto start
    LCDOUT at the second row displays 112 instead of 70000, so I guess it's not writing or reading all bytes. Would not compile without "DEFINE WRITE_USED 1".



    2.- Word variables

    Code:
    
    clear
    
    DEFINE  WRITE_USED 1              
    
    
    Number1 var word
    Number2 var word
    
    
    
    Start:
    
    number1 = 7000
    lcdout $FE,1
    lcdout $FE,$80,dec number1
    write 0,number1
    pause 2000
    read 0,number2
    lcdout $FE,$C0,dec number2
    pause 5000
    goto start
    LCDOUT at the second row displays 88 instead of 7000, so I guess it's not writing or reading all bytes.


    3.- Long variables, no define, using modifiers

    Code:
    
    clear
    
    
    Number1 var long
    Number2 var long
    
    
    
    Start:
    
    number1 = 70000
    lcdout $FE,1
    lcdout $FE,$80,dec number1
    write 0,number1.byte0,number1.byte1,number1.byte2,number1.byte3   'byte1,number1.byte2,number1.byte3
    pause 2000
    read 0,number2.byte0,number2.byte1,number2.byte2,number2.byte3
    lcdout $FE,$C0,dec number2
    pause 5000
    goto start
    Did not work, got garbage.


    4.- Long variables no define, using different modifiers

    Code:
    
    clear
    
    
    Number1 var long
    Number2 var long
    
    
    
    Start:
    
    number1 = 70000
    lcdout $FE,1
    lcdout $FE,$80,dec number1
    write 0,number1.lowbyte,number1.highbyte,number1.byte2,number1.byte3   'byte1,number1.byte2,number1.byte3
    pause 2000
    read 0,number2.lowbyte,number2.highbyte,number2.byte2,number2.byte3
    lcdout $FE,$C0,dec number2
    pause 5000
    goto start
    This one worked with LowByte, HighByte, BYTE2 and BYTE3 modifiers, will not work with BYTE0, or BYTE1 modifiers. So you do have to use modifiers.

    Haven't slept since yesterday so maybe I don't read and write clearly myself, maybe that's how it's supposed to be done and not just typing the variable name, that's how I thought the manual said it could be done.

    At least it works, but I thought I could just write the var name and PBPL was supposed to do the rest.

    Any suggestions or ideas are welcome.

    Thanks Bruce!

    Rogerio

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


    Did you find this post helpful? Yes | No

    Default

    You do not need DEFINE WRITE_INT 1 unless you have interrupts enabled prior to issuing a WRITE statement.

    What do you get with this?

    Code:
    Number1 var Long
    Number2 var long
    
    Start:
        number1 = 70000
        lcdout $FE,1,dec number1
        write 0,LONG number1
        pause 2000
        read 0,LONG number2
        lcdout $FE,$C0,dec number2
        pause 5000
        goto start
    Works 100% on the 18F452 I just tested!
    Regards,

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

  7. #7
    Join Date
    Feb 2010
    Posts
    13


    Did you find this post helpful? Yes | No

    Smile

    Yes, it works just fine! I definetly have to sleep, did not notice you had to use LONG before the variable name, it's right there on the manual, sorry. As always, when something is not working it most be an error on my part, not PBP!

    Thanks a lot Bruce!

    Rogerio

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