How do signed integer division operate?

General discussion on mikroC for dsPIC30/33 and PIC24.
Post Reply
Author
Message
freewheel
Posts: 17
Joined: 01 Oct 2008 10:36

How do signed integer division operate?

#1 Post by freewheel » 24 Apr 2009 04:18

Hello everyone!

I have an application with fixed-point math. I am trying to implement division between a 32-bit signed and 16-bit signed by using div.sd, namely:
asm{
mov #0x2500,W10
mov #0xFF42,W11
mov #0x2200,W12
mov #0x0,SR
repeat #17
;div.ud W10, W12
div.sd W10, W12
}

With the 'div.ud W10,W12', the result is right!
But 'div.sd W10,W12' return the result is terrible!
I don't know how do signed integer divide instruction in dsPIC30 work?
Anyone can explain about it?
:D

Post Reply

Return to “mikroC for dsPIC30/33 and PIC24 General”