Author Topic: PIC Variables  (Read 4392 times)

0 Members and 1 Guest are viewing this topic.

Offline hazzer123Topic starter

  • Supreme Robot
  • *****
  • Posts: 460
  • Helpful? 3
PIC Variables
« 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?
Imperial College Robotics Society
www.icrobotics.co.uk

Offline Hal9000

  • Supreme Robot
  • *****
  • Posts: 338
  • Helpful? 0
Re: PIC Variables
« Reply #1 on: April 12, 2007, 01:47:47 PM »
This is what EEPROM is for, no?
"The truth is, you can't hide from the truth, cos the truth is all there is" - Handsome Boy Modeling School

Offline hazzer123Topic starter

  • Supreme Robot
  • *****
  • Posts: 460
  • Helpful? 3
Re: PIC Variables
« Reply #2 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
Imperial College Robotics Society
www.icrobotics.co.uk

Offline Hal9000

  • Supreme Robot
  • *****
  • Posts: 338
  • Helpful? 0
Re: PIC Variables
« Reply #3 on: April 13, 2007, 12:33:53 PM »
So ...... this is in assembly?
"The truth is, you can't hide from the truth, cos the truth is all there is" - Handsome Boy Modeling School

Offline hazzer123Topic starter

  • Supreme Robot
  • *****
  • Posts: 460
  • Helpful? 3
Re: PIC Variables
« Reply #4 on: April 13, 2007, 12:34:36 PM »
Yes it is :)
Imperial College Robotics Society
www.icrobotics.co.uk

Offline Kohanbash

  • Supreme Robot
  • *****
  • Posts: 430
  • Helpful? 1
Re: PIC Variables
« Reply #5 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
Robots for Roboticists Blog - http://robotsforroboticists.com/

Offline hazzer123Topic starter

  • Supreme Robot
  • *****
  • Posts: 460
  • Helpful? 3
Re: PIC Variables
« Reply #6 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
Imperial College Robotics Society
www.icrobotics.co.uk