ok gotcha - i'm writing my buffer now - thanks dennis nish ---- Dennis Frost wrote: > > Hi Nishant > > There is a register called the FSR (I think that stands for File Select > Register). You load the address of the start of the buffer into this > register. Then you read register 0 (I think it is called INDF) this > register will now hold the value of the register pointed to by the FSR. > > Thus you would do something like this: > > movlw Buffer ;this places the address of you 'Buffer' into w > movwf FSR ;place the address into FSR > > Now you can work with the buffer: > > movfw INDF ;This will put the value at Buffer into w > > incf FSR ;Point to buffer+1 > > clrf INDF ;clear the data at Buffer+1 > > You can increment, decrement, add to & subtract from the FSR like with any > other register > > I often use this method when I have a piece of code that performs a similar > function of a lot of registers. > > Here is an example of how I define my variables: > > CBLOCK 0ch > SaveW ;01 holds W register durring interrupt > SaveS ;02 holds Status register durring interrupt > SaveFSR ;03 Holds copy of FSR durring interrupt > T1 ;04 Timer values > T2 ;05 > T3 ;06 > T4 ;07 > ENDC > > I like using this method because if I want to add a variable say between > SaveS and SaveFSR (it makes more visual sense for whatever reason) the I > don't have to renumber all the variables. The compiler will renumber > consecutively them from 0ch until it reaches ENDC. > > As for setting up the buffer, I have not had to do that so I couldn't tell > you for sure but I think you are right. > > Cheers > Dennis > ____________________________________________________ > FROST - Electronic Design, Manufacture & Consulting. > Dennis Frost > Tel: +27 331 965125 > Cel: +83 2275216 > Email: dennis.frost@pixie.co.za > Pietermaritzburg, South Africa > Products: Medical Motivational equipment > Timers for food processing > Random number generator > Temperature controllers > ____________________________________________________ > > PS Anyone looking for someone in the hardware/software development fields, > I am available. I intend leaving South Africa for the West coast of the US > early this year. > ---------- > > > From: Nishant Deshpande > > To: PICLIST@MITVMA.MIT.EDU > > Subject: programming question > > Date: 02 March 1997 09:57 > > > > hi all, > > > > i've just started programming the pic - i've got the led's lit up > > etc etc now moving on to bigger & better things.. > > > > a couple of questions regarding common practice : > > > > - i started off assigning my own registers just using > > CTR EQU 20h > > (for example) > > what i meant was i wanted to use address 20h > > now is it usual to use the 'DS' command to do this > > kind of thing? i.e. > > ORG 20h > > CTR DS 1 > > ORG 21h > > CTR2 DS 1 > > > > i'm kinda unsure about the direct/indirect addressing.. > > > > - say i want a small buffer (i.e. maybe 12/16 bits) - i do this > > ORG 30h > > BUFFER DS 16 > > > > now how do i get at this buffer? i know i can do BUFFER+ > > but i want to use 'a variable' for the offset, increment it, > > etc etc as i would in a high level language... > > > > i thought of having another memory location holding a 'pointer' > > to my buffer and then incrementing/decrementing this - but > > trying to implement this seems kinda unnecessarily complex.. > > > > any tips? i guess i'm still thinking high level language... > > > > thanks > > > > nishant > > ISE III BEng > > Incremental Sanity Erosion at Imperial College