Hi,
One possible solution/Henrik.Code:Dummy VAR WORD Dummy = Red * Pot4 ScaledRed = DIV32 1024 Dummy = Green * Pot4 ScaledGreen = DIV32 1024 Dummy = Blue * Pot4 ScaledBlue = DIV32 1024
Hi,
One possible solution/Henrik.Code:Dummy VAR WORD Dummy = Red * Pot4 ScaledRed = DIV32 1024 Dummy = Green * Pot4 ScaledGreen = DIV32 1024 Dummy = Blue * Pot4 ScaledBlue = DIV32 1024
Hi Henrik,
I knew there had to be a simple way of doing this, I just couldn't figure it out on my own - thank you!
Will the DIV32 command be affected if I am using DT-Interrupts? What happens is an interrupt occurs between the two arithmetic operations?
Dummy = Red * Pot4
Interrupt occurs here
ScaledRed = DIV32 1024
Cheers
Barry
VK2XBP
It shouldn't have any effect. DT-INTS saves the system variables when entering the ISR so even if an interrupt happens in between the multiplication and the division AND the ISR happens to use the same system variables (R0 and R2 IIRC) holding the 32 bit result from the multiplication no harm is done since the content of those variables are restored by DT-INTS when exiting the ISR.
/Henrik.
Hi Henrik,
The DIV32 approach worked perfectly - thank you.
Cheers
Barry
VK2XBP
Bookmarks