Define variable in asm

Any general or miscellaneous queries that do not fit into the other forum catagories

Moderators: Benj, Mods

Post Reply
bert
Posts: 23
Joined: Wed Feb 28, 2007 11:58 pm
Location: The Netherlands
Contact:

Define variable in asm

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Define variable in asm

Post 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
}

bert
Posts: 23
Joined: Wed Feb 28, 2007 11:58 pm
Location: The Netherlands
Contact:

Re: Define variable in asm

Post by bert »

Hello Ben,

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

Cheers,
Bert

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Define variable in asm

Post 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.

Post Reply