> Van: Andre Abelian > Aan: PICLIST@MITVMA.MIT.EDU > Onderwerp: fsr > Datum: maandag 6 april 1998 16:53 > > Hi to all engineers. > > I need to know more about fsr. > this is what I know. > Fsr is a software register that can hold up to 255 difference values or > registers. > you can store them and you can call them by using INDF instruction. > Am I right? Ehhh... Sort of. The FSR is an register that can (as all other registers) hold a number ranging from 0x00 (0 decimal) thru 0xFF (255 decimal). The INDF register does the same. Now the tricky part : The data stored into INDF will _not_ be stored at adres 0x00 (where INDF is located), but at the adres FSR points to. Example: movlw 0x50 movwf FSR incf INDF This will increment Register 0x50 by one. movlw 0x03 movwf FSR btfss INDF,0 goto {somewhere} This will branch to {somewhere} if the carry is not set. (register 0x03 is the Status-register, bit 0 is the Carry-flag) > this is what I do not know. > 1. what is the real purpose of this? when do you use it? Observe the next routine : movlw 0x20 movwf FSR goto CharOut2 CharOut1: movf INDF,w {write the character to LCD, RS232, etc} inc FSR CharOut2: movf INDF btfss STATUS,Z goto CharOut1 This routine will output bytes (the routine between {} ) found at 0x20 and on, stopping when it encounters a 0x00 byte (movf INDF , btfss STATUS,Z) Very handy if you want to write text from an internal buffer to a LCDisplay The other way around, you could receive bytes from an RS232 connection, and save them in internal memory by using an movwf INDF inc FSR combination. > 2. when you store values how does it organize. > > for example. > > movlw 0x01 > movwf fsr > movlw 0x02 > movwf fsr > movlw 0x03 > movwf fsr > > is this means that fsr (file select register) saved all 3 values or > only the last one? This example loads 0x03 in FSR. All other values where overwritten by the last one. In this way you are using the FSR register as a normal (not dedicated) storage register. > could you please explaine more. > See & read the above ;-) > Andre thank you Need to know more ? Just tell us/me ... Greetz, Rudy Wieser