Write Read And Words


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    44

    Default Write Read And Words

    I'm running out of code space so.... (16F628)

    What is the most efficient way to read & write a WORD using the READ, WRITE commands.

    I have a VAR WORD which holds the VAR 1234
    I need to write this and then read it at start up.

    Is it possible to write the whole word in one instructions as it is 2 bytes.

    I was hoping to do something like write [0,1],VAR
    then read [0,1],VAR

    But how do i get the whole WORD?
    Any suggestions

    Rob

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    You can only READ and WRITE a BYTE at a time. So your WORD must be split and handled in two steps...

    WRITE 0,MyWord.LowByte
    WRITE 1,MyWord.HighByte

    and similarly to Read and assemble back into a WORD...

    READ 0,MyWord.LowByte
    READ 1,MyWord,HighByte

    The PBP manual is quite explicit on the usage.

    Melanie

  3. #3
    Join Date
    Mar 2004
    Posts
    44


    Did you find this post helpful? Yes | No

    Default

    Hi Melanie

    I did read though the manual several time and didn't notice the byte0 command.
    Again searching though the archives didn't show anything till I found the byte0 command.
    It was only when I found the command I then found numerous postings.
    Please don't think I'm being lazy I spent 4hrs looking though the archives and didn't find anything under eeprom, word etc.

    Thanks for your helps once again

    Rob

Similar Threads

  1. Success! Are they 'words' or are they 'bytes'?
    By BitHead in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 27th December 2009, 16:54
  2. Maixium voltage on a input pin
    By Rob Martin in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 21st April 2008, 10:57
  3. 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
  4. Advice please - Warning message
    By malc-c in forum mel PIC BASIC Pro
    Replies: 50
    Last Post: - 23rd January 2007, 13:20
  5. data with wordvar?
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 18th January 2007, 00:35

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