Hi Try MOVWF INDF ; Now I try to move W into the address in PTR -- END ASM CODE -- Dave > ----- Original Message ----- From: "Metis Adrastea" To: "Microcontroller discussion list - Public." Sent: Thursday, September 28, 2006 2:38 PM Subject: [PIC]Basic (I think) pointers in asm > Hello all piclisters! > > I've tried to solve this problem by myself, as I think the solution > should be trivial, but I've spent all my free time this week on this > issue and I now feel that I can't solve this by myself; so, there goes > my code snippet: > > -- BEGIN ASM CODE -- > ; I initialise some variables like those below: > > var_a equ 020H > var_b equ 021H > var_c equ 022H > ... > var_g equ 026H > > DATA equ 030H > PTR equ 031H > > ; Then, I load a value into DATA > MOVLW 0x69 ; Great number :-) > MOVWF DATA > MOVLW 0x21 ; This is the address where I want to put the 0x69 in (ie, > var_b) > MOVWF PTR > > MOVF DATA,W ; Ok, I load the value in DATA into W > MOVWF PTR ; Now I try to move W into the address in PTR > -- END ASM CODE -- > > Obviously, this doesn't work because the last instruction (movwf ptr) > moves W into _the address of_ PTR (ie 0x31) and not into 0x21. Have to > say that in the real application the value of PTR is dynamic, so it > isn't as easy as putting "movwf var_b". > > Any ideas? > > Thanks in advance > > Metis Adrastea > -- > He comentado ya que tengo un blog? O:-) > http://metisadrastea.blogspot.com/ > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist