Compiler generates wrong opcode codes for SWAP and SL

Beta Testing discussion on mikroPascal for dsPIC30/33 and PIC24.
Post Reply
Author
Message
anton
Posts: 807
Joined: 23 Sep 2004 09:16
Location: South-Africa
Contact:

Compiler generates wrong opcode codes for SWAP and SL

#1 Post by anton » 19 Jun 2009 07:10

Hi,

I found that the mikroVirtualMachine - V. 5.0.0.3 generates the wrong operation codes for the SWAP and SL assembly instructions. When you compile the program and try to run it, the PIC will just restart. I tried debug the program in the software debugger and where the program will also crash.

After I manually edited the HEX file with the correct opcode, the program ran 100% on the PIC.

According to the datasheet the SWAP instruction should generate an opcode of

Code: Select all

1111 1101 1B00 0000 0000 ssss

where B is 1 for byte operation and ssss is the working register number as in the image below.
Image

I whoever found that the compiler generates an opcode of

Code: Select all

1111 1101 1110 0000 0000 ssss
          ||
          ||--> should be 0
          |---> should be B 
for both of the following commands

Code: Select all

     asm
       SWAP W6
     end;
and

Code: Select all

     asm
       SWAP.B W6
     end;
Thus it doesn't take the .B into consideration for bit 10 and the other problem is that bit 9 is 1 and should be 0.

Please take this into consideration for the next version and keep up the good work.

I can't wait for the beta version to be released.

Thank you
Anton
Another proud user of LV 24-33A Development System and mikroPascal PRO for dsPIC :)
PortA not working? Add CMCON := 7; PortD not working? Add ADCON1 := 6;
To paste code on the forum, please use the [b] Code [/b] button !! ;)

Post Reply

Return to “mikroPascal for dsPIC30/33 and PIC24 Beta Testing”