Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: hazzer123 on April 12, 2007, 12:38:36 PM

Title: PIC Variables
Post by: hazzer123 on April 12, 2007, 12:38:36 PM
Hi

I have written a program to display a message that i hard-coded into it.

Next I want to write a program that will display a user inputted message. The user will input using 2 buttons, 1 to scroll through the alphabet and the other to confirm.

The problem is that the message will need to be stored even after the PIC is turned on and then off. Is this possible?
Title: Re: PIC Variables
Post by: Hal9000 on April 12, 2007, 01:47:47 PM
This is what EEPROM is for, no?
Title: Re: PIC Variables
Post by: hazzer123 on April 13, 2007, 12:32:21 PM
Yeh sorry that was a silly question  ::)

I have another though...

If i have the address of a byte in my W register, how can i copy the byte at the address into the w register.

It could be another silly question, but... ow well :D

Thank you

Harry
Title: Re: PIC Variables
Post by: Hal9000 on April 13, 2007, 12:33:53 PM
So ...... this is in assembly?
Title: Re: PIC Variables
Post by: hazzer123 on April 13, 2007, 12:34:36 PM
Yes it is :)
Title: Re: PIC Variables
Post by: Kohanbash on April 13, 2007, 05:43:11 PM
MOVF     f,w

where f  is the file and w says put the f value into the working register.
then you can simply save the w into whatever file you want using MOVWF
Title: Re: PIC Variables
Post by: hazzer123 on April 14, 2007, 02:27:36 AM
I found a solution :D

Theres aomething called an indirect address register.

You can copy an address to the FSR register. and then the byte at that address can be found at the INDF address.

VARIABLE      EQU          0X1C

                    MOVLW     VARIABLE
                    MOVWF     FSR
                    MOVF        INDF,W

Thanks