Sanity check please!
28x1 based circuit at setfreq m8
Have a tacho and two motors.
Only one motor can run at a time.
There is a separate reflective sensor for each motor and the RPM is delivered via the count command on whichever input is selected by a PB.
All this works well.
Have adapted this circuit so it will switch automatically to whichever motor is running.
This is presently achieved by dropping into a do .. loop when the RPM is below a useful speed (Count =<2)
Inside the do .. loop, the two inputs are monitored in turn (by counting the pulses) until one reaches a useful speed and the tacho is switched to that output. This is a relatively slow process as at the minimum speed, the count for each input needs to be for a .5sec duration to obtain a reliable count.
I would rather use an interrupt but understand the interrupt condition is not stored and may not be present when inside the interrupt: subroutine.
At the maximum rotational speed, the interrupt input condition should be present for around 50us and at the threshold speed for up to 2ms
1. Is there any register/system variable etc that retains the interrupt input byte?
2. As the motor ramps up to speed the tests are done at the low RPM end so one would expect the interrupt input condition to be long enough to reliably test the pin;
Proposed code is;
Would this expected to be reliable?
Thanks
28x1 based circuit at setfreq m8
Have a tacho and two motors.
Only one motor can run at a time.
There is a separate reflective sensor for each motor and the RPM is delivered via the count command on whichever input is selected by a PB.
All this works well.
Have adapted this circuit so it will switch automatically to whichever motor is running.
This is presently achieved by dropping into a do .. loop when the RPM is below a useful speed (Count =<2)
Inside the do .. loop, the two inputs are monitored in turn (by counting the pulses) until one reaches a useful speed and the tacho is switched to that output. This is a relatively slow process as at the minimum speed, the count for each input needs to be for a .5sec duration to obtain a reliable count.
I would rather use an interrupt but understand the interrupt condition is not stored and may not be present when inside the interrupt: subroutine.
At the maximum rotational speed, the interrupt input condition should be present for around 50us and at the threshold speed for up to 2ms
1. Is there any register/system variable etc that retains the interrupt input byte?
2. As the motor ramps up to speed the tests are done at the low RPM end so one would expect the interrupt input condition to be long enough to reliably test the pin;
Proposed code is;
Code:
If Count_In =< 2 then
RPM = 0
....
....
LowSpeed:
setint NOT %00000000,%00000110 ;interrupt on input 1 OR 2 high
goto LowSpeed
EndIf
....
....
Interrupt:
If Pin1 = 1 then
let flag = 1
Else
let flag = 0
EndIf
Return
Thanks
Last edited: