PDA

View Full Version : Save a port number into the EEPROM?



Fredrick
- 19th August 2009, 21:06
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

mackrackit
- 20th August 2009, 05:25
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?

Fredrick
- 20th August 2009, 07:26
I want to make a certain pin high based on a number that can be stored into a variable and the EEPROM.

mackrackit
- 20th August 2009, 08:15
Here is how to set the variables up. The read/write part is in the manual.


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?

Fredrick
- 20th August 2009, 08:31
Do I understand this right?

This will make PORTC.6 high?


TRISC = %00000000
X VAR BYTE
X = %01000000
PORTB = X


And this will make PORTC.1 and PORTC.3 high?


X = %00001010
PORTB = X

mackrackit
- 20th August 2009, 08:36
Yes.
That is after you change
PORTB to PORTC
:)

Fredrick
- 20th August 2009, 09:06
Yes of course, I missed that.
Thank you for your help. :)