Save a port number into the EEPROM?


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187

    Default Save a port number into the EEPROM?

    How can I store a port number into the on chip EEPROM and then read it back and do something like this,

    start:
    High portnumber
    pause 1000
    Low portnumber
    pause 1000
    goto start

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Not sure I understand what you want.
    Are you wanting to make the whole port high or just have certain pins go high based on a number value?
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default

    I want to make a certain pin high based on a number that can be stored into a variable and the EEPROM.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Here is how to set the variables up. The read/write part is in the manual.
    Code:
    TRISB = %00000000
    X   VAR BYTE
    X = %00000100
    PORTB = X
    The above will make PORTB.2 high.
    Change "X" and read/write to eeprom.

    Is that what you are after?
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default

    Do I understand this right?

    This will make PORTC.6 high?
    Code:
    TRISC = %00000000
    X   VAR BYTE
    X = %01000000
    PORTB = X
    And this will make PORTC.1 and PORTC.3 high?
    Code:
    X = %00001010
    PORTB = X
    Last edited by Fredrick; - 20th August 2009 at 09:07.

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Yes.
    That is after you change
    PORTB to PORTC
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default

    Yes of course, I missed that.
    Thank you for your help.

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. Save number cell in to EEprom
    By piombazzo in forum GSM
    Replies: 0
    Last Post: - 18th August 2008, 20:49
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  4. 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
  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 : 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