
Originally Posted by
coyotegd
With a terrible hiccup in the 12kHz signal, I have to test the the frequency with:
If (Counter > 1) then
So as long as the PIC counts anything over a 1kHz, the relay works properly. What a crappy 12kHz signal from Mach3. I hope this doesn't reflect the quality of their stepper motor control. I guess I'll find out.
Hopefully, they the explanation is that they had to compromise the 12kHz signal for better control over the stepper motor signals.
I'm not familiar with the Mach3 product but it sounds like it needs to be corrected as it's not offering a correct output. If you need to use it you could always try this in your code:
Code:
working var byte
working = 2
MAIN:
count chrgpmp, 1, cntcp ' Count freq. on B0, Mach3's 12kHz
if (cntcp >= 11) and (cntcp <= 13) then ' Freq. must be between 11 & 13kHz
working = 2
else
if working > 0 then ' Stops working variable from rolling from 0 to 255!
working = working - 1
endif
endif
if working >0 then
lptports = 1
else
lptports = 0
endif
goto main
This will make a double check every time there is a 'hiccup' in the 12kHz signal. Of course if this doesn't correct it you could always increase the "working" variable where it is defined and also in the third line of the above code.
Hope this helps
Rob
Bookmarks