2005-11-21 07:22 AM
2005-11-10 01:36 AM
Why with this instruction, appears 2 errors?
LD A, #HIGH(Buffer_0) C5691 ''Instruction operand mismatch'' and C5686 ''undefined label 'HIGH' HIGH is an additional operator of assembly AST7...but don't work.. When i compile the project the label ''HIGH'' is undefined.... what i can do for using this assembly operator?? I use the ST7VD with metrowerks toolchain... please help me.. :-[ [ This message was edited by: liotro78 on 10-11-2005 16:44 ]2005-11-10 07:05 PM
try this:
LD A,#{HIGH Buffer_0} EtaPhi2005-11-10 10:53 PM
the problem remaining....the label HIGH is unknow...
but there's an alternative method for extracting the high byte of a variable of 2 bytes?2005-11-10 11:14 PM
The ST7 core is big endian, i.e. the the most significative byte is stored first, then it is followed by the less significant ones.
When you define a 16bit variable, say Buffer_0, the high byte of its value is stored at Buffer_0, while the least significative byte is stored at Buffer_0+1. HIGH is an assembler macro that returns the high address (i.e. page) of a label. I Hope I was clear... EtaPhi2005-11-11 02:47 AM
Hi liotro78,
in my opinion you make everything quite right - as you can compare with the Metrowerks assembler manual (Manual_Assembler_ST7.pdf) on page 206f. HIGH OperatorSyntax
Byte: HIGH()
Description
This operator returns the high byte of the address of a memory location.
Example
Assume data1 is a word located at address $1050 in the memory.
LD A,#HIGH(data1)
This instruction will load the immediate value of the high byte of the address of data1
($10) in register A.
LD A,HIGH(data1)
This instruction will load the direct value at memory location of the higher byte of the address of data1 (i.e. the value in memory location $10) in register A.I think, something else causes your error although I can't imagine what it is. If all else fails why not contact the MetroWerks support? Regards WoRo
2005-11-11 03:04 AM
My sfotware is this:
// Map user variables in BUFFER. #pragma DATA_SEG BUFFER0_EP2_512 // RAM BUFFER volatile char Buffer_0[512]; asm { LD A, #Buffer_0 LD pScan:1, A LD A, #HIGH(Buffer_0) <---error LD pScan, A } there are 2 errors : ERROR C5691: Instruction operand mismatch ERROR C5686: Undefined label 'HIGH' I use the ST7VD and Metrowerks Codewarrior for ST7 V. 2.0 . I asking you, do you know the code inside the macro HIGH() ? For the Assembly manual i have not this pdf,and i don't find it in the ST site, i have only the ''ST7 Assembler-Linker User Manual'', can you attach this file? [ This message was edited by: liotro78 on 11-11-2005 16:46 ]2005-11-11 03:40 AM
But Etaphi if the HIGH operator is don't know, if i overwrite this code:
asm { LD A, #Buffer_0 LD pScan:1, A LD A, #HIGH(Buffer_0) <---error LD pScan, A } with the next code, is exactly and similar with the previous HIGH operator? asm { LD A, #Buffer_0 LD pScan:1, A LD A, #(Buffer_0)+1 LD pScan, A } this code is exactly? [ This message was edited by: liotro78 on 11-11-2005 17:33 ] [ This message was edited by: liotro78 on 12-11-2005 12:47 ]2005-11-12 08:56 PM
No, liotro78, the code does not the same thing.
From your code I understand that you want to copy the address of Buffer_0 into a pointer variable. Therefore you need the HIGH operator. I don't know why the Codewarrior toolchain complains, perhaps it is the space between the operands [try LD A,#HIGH(Buffer_0)], who knows... However I suggest you to stick with C and use assembler only when there is a real need, such as in some reentrant interrupt handlers. In this mixed setting you lose the C portability and abstraction from hardware without a real improvement in speed and size. Regards, EtaPhi2005-11-13 10:25 PM
Hi Liotro78,
you can download the Metrowerks manuals from the MetroWerks homepage. It is a quite long selfextracting file (33.3M) and contains a lot of manuals and technical notes. But I didn't find a way to download only the manuals. To download the file go to MetroWerks' download page (click the following line):http://www.metrowerks.com/MW/Develop/Embedded/STM/CWST7Mspecial.htm
and then select Self-installing Manuals and Technical NotesIf you are a little familiar with C-programming, please try the C-code pScan = &Buffer_0; and then check the result by reading the .lst-file after compiling. It should be the same as your asm-code. Regards WoRo