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.

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:
What PIC is that?
 
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
.
.
.

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 :p
 
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.
 
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.

New Articles From Microcontroller Tips

Back
Top