Page 1 of 1

Define variable in asm

Posted: Tue Nov 25, 2008 10:21 pm
by bert
I want to define a variable called asmtest in asm. I thought I could do this in a C block (for an 18F4455 PIC):

asm{
asmtest equ 0x00000006
// rest of the asm code
}

But I get a syntax error. Could you tell me what the proper syntax is please?

Cheers,
Bert

Re: Define variable in asm

Posted: Wed Nov 26, 2008 10:04 am
by Benj
Hello Bert

You can create a C variable and then call it in assembler by using an underscore in front of the variable name. Would that work?

char varname

asm{
movlw _varname
// rest of the asm code
}

Re: Define variable in asm

Posted: Wed Nov 26, 2008 11:46 am
by bert
Hello Ben,

Yes that does work prerfectly, but I would prefer to declare the variable in assembler. Is that possible?

Cheers,
Bert

Re: Define variable in asm

Posted: Wed Nov 26, 2008 1:19 pm
by Benj
Hello Bert

Its probably possible but I dont know how to do it off the top of my head, I avoid assembler where ever possible :P . It may say how to do it in the BoostC manual available from the Flowcode V3/BoostC folder.