put values to multiple variables (asm)

Status
Not open for further replies.

krpz

New Member
i want to put 0x2a value to 10 variables

i try this:

Code:
movlw  0x2a
movwf  a1,a2,a3,a4,a5,a6,a7,a8,a9,a10

but assembler says "illegal character(,)"

is there a different method i can use instead of

Code:
movlw  0x2a
movwf  a1
movwf  a2
.
.
.
 
Last edited:

Not as far as I know, but what's the problem with doing it that way? - it's what the assembler would produce, even if it accepted the commas.

You could have typed it all in faster than you asked the question
 
It depends on the assembler, your code imples that the comma is a directive instructing the assembler to repeat the movwf opcode.
This works when defining data registers, and some assembler versions accept commas when using retlw so you dont have to type it out every line when constructing lookup tables.
 
If you are going to do this alot.... You can use the FSR ind INDF registers in a loop.
 
The only problem with doing this from experience is when you count up the number of lines to work out how long execution will take its tricky without looking at the list file.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…