At 09:04 PM 30/07/01 -0600, you wrote: >I am working on a project using a 16F877 and am having difficulty in >indirectly addressing RAM locations. I would like to send a byte of data >to RAM location 0x120, by using the following: > >movfw Offset ;contains the value 20h >movwf FSR >movfw Data1 >bcf STATUS,RP0 >bsf STATUS,RP1 >movwf INDF > >YET...when simulated, Data1 is moved to 0x020. >It seems that no matter which page I switch to prior to executing the >movwf INDF statement, Data1 is placed into 0x020. >Can anyone help? You need to use IRP for the FSR page (not RP0 & RP1) The FSR covers 2 ram banks at a time (0/1 OR 2/3) Try the following code: (should be right) movf offset,w ;get the offset into w bsf status,irp ;take fsr pointer into banks 2/3 movwf fsr ;point to 'offset' in bank 2 movf data1,w ;get the data to save into w movwf indf ;and put it where the fsr is pointing to bcf status,irp ;bring fsr pointer back into banks 0/1 Regards... -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads