Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC ASM dynamic table storage

Status
Not open for further replies.

pepperell

New Member
Whats a good strategy in storing data into successive registers in PIC memory? I'm used to C code where you can just increment the pointer and write to the next memory location :| Does something like this exist for PICs?

My goal is reading in a port full of 8 bits of data and putting it into the next available register. A counter would be kept indicating the number of bytes stored. There has to be some obvioius solution I am overlooking...

Thanks for your time
 
to write to table

movlw h'20' ;set starting address of my table
movwf FSR ;point file select register to it
movf my_data,w
movwf 0
incf FSR

and so on...


reading is exactly the opposite

movlw h'20' ;set starting address of my table
movwf FSR ;point file select register to it
movf 0,w
movwf my_data
incf FSR

and so on...

hope this helps ya :)


Oh, I forgot to add, depending on which device you are using, and which register bank your table is in, you might need to take care or the IRP bits...
 
In the above examples, I would use symbolic symbols where possible to make
the code more readable.

Code:
movwf 0 --> movwf INDF
movf 0,w --> movf INDF,w
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top