View previous topic :: View next topic |
Author |
Message |
Lykos1986
Joined: 26 Nov 2005 Posts: 68
|
Can't understand assembly? |
Posted: Wed Jul 17, 2013 10:18 am |
|
|
Hi! I was creating a little bit of code and I wanted to use assembly language in different section of my firmware.
It seems that CCS (version 4.140) can't understand this code! For example I am writing:
Code: |
#asm
mov.w #0x766,0x0002
mov.w #0x55,0x0004
mov.w 0x0004,[0x0002]
mov.w #0xaa,0x0006
mov.w 0x0006,[0x0002]
...
#endasm
|
And I am getting:
Error 95 ... Expecting an opcode mnemonic mov
at the first line of my assembly code!
I was searching the forum and it seems that a few users are saying that this problem will be fixed in a latter version of CCS. But that was 2 years ago!
Any help here? |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Wed Jul 17, 2013 11:01 am |
|
|
It doesn't like the ...
mov.w ........... opcode.
I checked the 18F46k22 instruction set and mov.w is not there so you should tell us which PIC you're using.
It may be a valid opcode for your PIC that the compiler can't figure out due to a bug?
hth
jay |
|
|
Lykos1986
Joined: 26 Nov 2005 Posts: 68
|
|
Posted: Wed Jul 17, 2013 11:30 am |
|
|
I am using the 24F32KA304.
Basically I haven't used assembly language for more than 6 years now.
But because I am using MpLab (with CCS compiler plugin) I've compile a CCS example and then looked at the Disassembly Listing provided from the MpLab in order to understand what is going on with a problem I am facing.
The Disassembly Listing was using exactly this type of assembly language that it is diferent from the one I've learned for the PIC microcontrollers. Then I download a couple of manuals and start learning this instruction set believing that this is the correct one for PICs nowadays.
It seams that this instruction set is more for x86 architectures... but somehow it is the one that MpLab understands. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Wed Jul 17, 2013 2:47 pm |
|
|
Sorry, I don't use the 24 series PICs so I'm not familiar with their opcodes, but if 'mov.w' is correct, then it sounds more like a bug in the compiler version you're using.
Someone that use the 24s probably knows.. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Wed Jul 17, 2013 3:29 pm |
|
|
It isn't.
The PCD manual will list the opcodes. mov, and mov.d. Not mov.w.
Though CCS doesn't use Microchip assembler, the data sheet also does not give mov.w. Only the PIC33 chips have this instruction.
Best Wishes |
|
|
Lykos1986
Joined: 26 Nov 2005 Posts: 68
|
|
Posted: Wed Jul 17, 2013 4:16 pm |
|
|
If only the PIC33 chips have these instructions why the Disassembly Listing of a 24F PIC with CCS compiler is using only those instruction (mov.w) from top to bottom? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Thu Jul 18, 2013 12:40 am |
|
|
They use mov.w as the displayed mnemonic for mov.d. I know it is insane. Look at the list in the manual for the supported instructions.
This happens with the other chips as well. The 'asm' they generate, can not be typed in as 'input assembler'.....
You could close to what you seem to want by just word definitions and C.
Best Wishes |
|
|
Lykos1986
Joined: 26 Nov 2005 Posts: 68
|
|
Posted: Thu Jul 18, 2013 6:14 am |
|
|
Ok, I will try the old good assembly instructions and hopefully I will have good results.
Many thanks for your answers and your help! |
|
|
|