Thank you, that is what I needed. :) Lembit ----- Original Message ----- From: "Tamas Rudnai" To: "Microcontroller discussion list - Public." Sent: Tuesday, September 05, 2006 5:22 PM Subject: Re: [PIC] MPASM - table write problem 18F4520 > Lembit, > > You can access to the RAM by its address: > > to read the register: > movf 0x2C,w > > to store to the register: > movwf 0x2C > > You can look up the datasheet where are the General Purpose Registers > (GPR) > and Special Purpose Registers (SPR), and be sure you do not use a speacial > register as it was a general one as you will be in trouble. It is very > ugly > to use numbers as addresses, and sometimes it is very hard to remember for > them, that's why you can define names for that. For example: > > myVariable equ 0x2C > > then you can say: > > movf myVariable,w > movwf myVariable > > The 'w' means the destination is the WREG register, which is also mapped > into the SPR area in some of the microcontrollers, like yours. All the SPR > are defined in the include file that you have to include somewhere in the > beginning of your asm file. Also you can declare variable names that you > do > not care where are they in your memory range, like: > > cblock 0x20 > variable1 > variable2 > ... > variableN > endc > > The 0x20 is the start of the memory block, and practically all the > variables > will be put next to each other, so it happens that variable1 will be at > 0x20 > and variable2 at 0x21, but you should not rely on this -- use the equ > instead it you need them in the exact location. > > The address space is limited, so there are several banks (like pages in a > book) that holds bunch of registers. You can 'turn pages' with special > purpose registers that are mapped to each and every pages. > > All of these are much more clear in the books, and even if you feel that > you > know all of these please, read it through, or at least have a glance at > every pages and if something unclear study it further. > > Tamas > > > On 05/09/06, Lembit Soobik wrote: >> >> I guess I should have said Bank, not GPR? >> >From your answer I take it that I have to address each byte (of 8 bits) >> and >> write just as I write to a variable. >> that leaves me to find out how to address it. >> >> thanks >> Lembit >> >> ----- Original Message ----- >> From: "Jan-Erik Soderholm" >> To: >> Sent: Tuesday, September 05, 2006 3:47 PM >> Subject: RE: [PIC] MPASM - table write problem 18F4520 >> >> >> > Lembit Soobik wrote : >> > >> >> Lets say I have 8 variables, each one Byte, named >> >> B1, B2, ... B8 >> >> and I want to write them into the first GPR >> > >> > Why do you want to write them into the *same* >> > (what you call the "first") GPR ? >> > >> > And where are B1-B8 stored if not in a 8 GPR's ? >> > >> > What is it that you call "variables" ?? >> > >> >> howdo I address the GPR and >> >> which instruction do I use to write (or read) >> > >> > As I said, any (almost) instruction can address the >> > GPR's. Some (like movf) reads and some (like movwf) >> > writes... >> > >> > You absolutely *HAVE* to study the data sheet again! >> > >> > In particular the part with the instruction set... >> > >> > Regards, >> > Jan-Erik. >> > >> > >> > >> > -- >> > http://www.piclist.com PIC/SX FAQ & list archive >> > View/change your membership options at >> > http://mailman.mit.edu/mailman/listinfo/piclist >> > >> > >> > -- >> > No virus found in this incoming message. >> > Checked by AVG Free Edition. >> > Version: 7.1.405 / Virus Database: 268.11.7/437 - Release Date: >> 04.09.2006 >> > >> > >> >> -- >> http://www.piclist.com PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist >> > > > > -- > unPIC -- The PIC Disassembler > http://unpic.sourceforge.net > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > > > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.405 / Virus Database: 268.11.7/437 - Release Date: 04.09.2006 > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist