Stepping through the Simulator in the Programming Editor 5.4.3 while testing code to stop a motor by setting the pwm output low, I have observed the following:
This code sample performs as expected:
'08M chip
'setfreq m4
symbol k = b0
one:
k=1 'no change
low 2 'no change
high 2 'pin 2 set high
low 2 'pin 2 set low
k=2 'no change
low 2 'no change
goto one
but this code sets the pwm output active when a seemingly unrelated process occurs:
two:
k=1 'pin 2 set high except the first time
low 2 'pin 2 set low
pwmout 2,249,500 'pin 2 set high
low 2 'pin 2 set low
k=2 'pin 2 set high
low 2 'pin 2 set low
goto two
As the actual code I am writing has a residual pwm value I want to return to without complexity, so don't want to use 'pwmout 2,0,0' can youse guyz advise if
a) this is an 'undocumented feature' of the simulator alone,
b) this behaviour will also occur live,
c) I am a dunderhead and need a gentle talking to.
Additionally, is there any way of seeing the actual current PWM values in the simulator, not just the current variable values?
Many thanks,
Laurie.
This code sample performs as expected:
'08M chip
'setfreq m4
symbol k = b0
one:
k=1 'no change
low 2 'no change
high 2 'pin 2 set high
low 2 'pin 2 set low
k=2 'no change
low 2 'no change
goto one
but this code sets the pwm output active when a seemingly unrelated process occurs:
two:
k=1 'pin 2 set high except the first time
low 2 'pin 2 set low
pwmout 2,249,500 'pin 2 set high
low 2 'pin 2 set low
k=2 'pin 2 set high
low 2 'pin 2 set low
goto two
As the actual code I am writing has a residual pwm value I want to return to without complexity, so don't want to use 'pwmout 2,0,0' can youse guyz advise if
a) this is an 'undocumented feature' of the simulator alone,
b) this behaviour will also occur live,
c) I am a dunderhead and need a gentle talking to.
Additionally, is there any way of seeing the actual current PWM values in the simulator, not just the current variable values?
Many thanks,
Laurie.