FunFlyer
New Member
In an algorithm to come up with a value to be fed into a PWMOUT command, it has to do calculations of the type A=7/5. The result is clearly no integer, but should be stored correctly. I wrote a litte progam to test, wether the PWMOut command would accept it.
Symbol oPWM1 = c.2
symbol bPWMDuty = b0
main:
PWMOut oPWM1, 63, 0
bpwmduty = 12/5
debug bpwmduty
pause 5000
PWMDuty oPWM1, bPWMDuty
end
I have two questions:
1. Is there an (easy) way to convert my bPWMDuty value into an integer, e.g. round it to 0 decimals, or simply cut of the decimal part?
2. Can I "Debug" this program in the editor without the need for a connected PICAXE (in this case an 08M2)? I thougt the DEBUG command in the program would do the trick, but I was mistaken.
Symbol oPWM1 = c.2
symbol bPWMDuty = b0
main:
PWMOut oPWM1, 63, 0
bpwmduty = 12/5
debug bpwmduty
pause 5000
PWMDuty oPWM1, bPWMDuty
end
I have two questions:
1. Is there an (easy) way to convert my bPWMDuty value into an integer, e.g. round it to 0 decimals, or simply cut of the decimal part?
2. Can I "Debug" this program in the editor without the need for a connected PICAXE (in this case an 08M2)? I thougt the DEBUG command in the program would do the trick, but I was mistaken.