 | Discussion Forum |  |
|
|
Extended Inline AssemblyNext Thread | Thread List | Previous Thread Start a Thread | Settings | Details | Message |
|---|
Read-Only Author Sunil Viswanath Posted 5-May-2005 08:24 GMT Toolset C166 |  Extended Inline Assembly Sunil Viswanath Hi,
I am using extended inline assembly functionality in Keil with keyword __asm.
The compiler is giving error!!!!
For the following code, __asm { mov GPT12E_T5,#0x3CB0 }
The following error is coming.....
GPT2.C(195): error C195: inline-asm: invalid expression token GPT2.C(195): error C195: inline-asm: missing ')' GPT2.C(195): error C195: inline-asm: Invalid instruction operand(s)
My question is, in order to use extended inline assembly any seetings has to be done in the Keil. Or is anything wrong with the code.
Regards Sunil | | Read-Only Author Jon Ward Posted 9-May-2005 12:55 GMT Toolset C166 |  RE: Extended Inline Assembly Jon Ward I thought the MOV instruction only worked with constants and registers.
Jon | | Read-Only Author Peter Holzer Posted 9-May-2005 14:59 GMT Toolset C166 |  RE: Extended Inline Assembly Peter Holzer Looks like you forgot to include the sfr declarations which causes 'GPT12E_T5' being undefined. Otherwise the examples compiles fine here:
C166 COMPILER V5.20a, COMPILATION OF MODULE X
OBJECT MODULE PLACED IN x.OBJ
COMPILER INVOKED BY: C:\keil\c166\bin\c166.exe x.c CODE MOD167
stmt lvl source
1
2 #include <\keil\c166\inc\xc16X.h>
3
4 //sfr GPT12E_T5 = 0xFF46;
5
6 void Test (void) {
7 1 __asm { mov GPT12E_T5,#0x3CB0 }
8 1 }
; FUNCTION Test (BEGIN RMASK = @0x8000)
; SOURCE LINE # 6
; SOURCE LINE # 7
0000 E623B03C mov GPT12E_T5,#0x3CB0
; SOURCE LINE # 8
0004 CB00 RET
; FUNCTION Test (END RMASK = @0x8000)
C166 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
| | Read-Only Author Sunil Viswanath Posted 9-May-2005 15:12 GMT Toolset C166 |  RE: Extended Inline Assembly Sunil Viswanath Actually I defined the sfr like this...
#define GPT12E_T5 (*((uword volatile *) 0xFE46))
Is there any problem in that
--Sunil | | Read-Only Author Peter Holzer Posted 9-May-2005 15:23 GMT Toolset C166 |  RE: Extended Inline Assembly Peter Holzer Yes, there is a problem: the inline assembler cannot deal with 'C' expressions such as '*((unsigned int *) 0xFE46)' etc. It can handle identifers, numbers and assembly language operators only. | | Read-Only Author Sunil Viswanath Posted 9-May-2005 15:28 GMT Toolset C166 |  RE: Extended Inline Assembly Sunil Viswanath Thanks Peter....
--Sunil | |
Next Thread | Thread List | Previous Thread Start a Thread | Settings |
|