touch probe noise
- BigJohnT
-
- Offline
- Administrator
-
- Posts: 7000
- Thank you received: 1175
John
Please Log in or Create an account to join the conversation.
- whampoo
- Offline
- New Member
-
- Posts: 12
- Thank you received: 0
sorry to bother you with this but no matter what I try using the sample code I get errors when I try to start up EMC ... either the pin doesn't exist or its already defines or an unexpected realtime delay on task 1.
I guess I just don't quite get some of this setup stuff yet ... wonder if I ever will

here is the Hal file I am using.
#load the debounce. One set of three channels.
loadrt debounce cfg=4
#add the debounce to a thread, so that it gets run
#this is running in the fast base-thread
#you could use the servo thread. I am not sure which would be best.
addf debounce.0 base-thread
#Unlink the parport pins and limit inputs for rewiring
delsig max-home-x
delsig max-home-y
delsig max-home-z
net x-raw parport.0.pin-10-in => debounce.0.0.in
net y-raw parport.0.pin-11-in => debounce.0.1.in
net z-raw parport.0.pin-12-in => debounce.0.2.in
net probe parport.0.pin-13-in => debounce.0.3.in
net x-filt debounce.0.0.out => axis.0.home-sw-in axis.0.pos-lim-sw-in axis.0.neg-lim-sw-in
net y-filt debounce.0.1.out => axis.1.home-sw-in axis.1.pos-lim-sw-in axis.1.neg-lim-sw-in
net z-filt debounce.0.2.out => axis.2.home-sw-in axis.2.pos-lim-sw-in axis.2.neg-lim-sw-in
net probe-filt <= debounce.0.3.out => motion.probe.in
#It's important to actually activate the debounce
#20 base-threads is about 0.4mS. The typical machine doesn't move far in that time.
setp debounce.0.delay 40
Thanks for any help you can provide.
Joel
Please Log in or Create an account to join the conversation.
- Rick G
-
- Offline
- Junior Member
-
- Posts: 26
- Thank you received: 155
#load the debounce. One set of three channels.
loadrt debounce cfg=4
#add the debounce to a thread, so that it gets run
#this is running in the fast base-thread
#you could use the servo thread. I am not sure which would be best.
addf debounce.0 base-thread
It looks like you are only trying to have one debounce
#addf debounce.0 base-thread
connected to the base thread, you need to connect all four of them.
An example of connected multiple components...
wiki.linuxcnc.org/cgi-bin/wiki.pl?Simple_Remote_Pendant
loadrt or2 count=2
loadrt mux4 count=1
addf or2.0 servo-thread
addf or2.1 servo-thread
Rick G
Please Log in or Create an account to join the conversation.
- whampoo
- Offline
- New Member
-
- Posts: 12
- Thank you received: 0

loadrt or2 count=2
loadrt mux4 count=1
addf or2.0 servo-thread
addf or2.1 servo-thread
when I looked up the pendant info it was showing the postgui.hal file does it matter which file I use to make the changes? Even so, now I am reaching here and trying really hard to understand its just not sinking in ... you are saying I don't have enough threads? The other 3 debounce statements stopped the noise issues with the homing switches. Was I just lucky on that and possibly only one of the switched was causing the problem ? I am using the same ground for all 3 switches and the probe as well not sure if this would cause a problem or not. Anyway back to the probe... I see that the probe-in was added to the other configuration files and it does get initialized. are you saying I need to change this statement to:
net probe parport.0.pin-13-in => debounce.1.3.in
net probe-filt <= debounce.1.3.out => motion.probe.in
Sorry I am still quite new at the whole CNC thing ... and not very well versed on how all this stuff seems to work together, and the logic behind just isn't sinking in ..... I guess that is part of the problem of never working with something and then building one to play with, either way, I am really starting to believe the first thing to go is the mind ... or I guess the second..... the eyes have already gone ... so I am well on my way with the mind now ...

Thanks
Joel
Please Log in or Create an account to join the conversation.
- BigJohnT
-
- Offline
- Administrator
-
- Posts: 7000
- Thank you received: 1175
Basically when you load a component you have to add it to a thread. If it uses floating point math it has to go in a thread that allows that (usually the servo thread). If you load several copies of a component then you have to add each one to a thread. If you don't add the loaded component then it never gets executed.
loadrt = load a component in the real time space
addf = add a component function to a thread
Take a gander here for a basic tutorial of HAL.
John
Please Log in or Create an account to join the conversation.
- Rick G
-
- Offline
- Junior Member
-
- Posts: 26
- Thank you received: 155
So in your case you want to take the signal from the probe, filter it and then send the output , but you also need to set the frequency that LinCNC will look at the signal and send an output, that would be the thread.
You would normally have 2 threads a base thread (the fast one often used for step generation) and a servo thread the slower one used for most components.
Each component needs to be individually connected to a thread.
perhaps try...addf debounce.0 base-thread
addf debounce.0 servo-thread
addf debounce.1 servo-thread
addf debounce.2 servo-thread
addf debounce.3 servo-thread
I have not used debounce but you also need to set how senesitive it is.
setp debounce.0.delay 40
Again you will need a seperate statment for each debounce component you load...
setp debounce.0.delay 40
setp debounce.1.delay 40
setp debounce.2.delay 40
setp debounce.3.delay 40
You can adjust them to see what works best.
Rick G
Please Log in or Create an account to join the conversation.
- Rick G
-
- Offline
- Junior Member
-
- Posts: 26
- Thank you received: 155
Machine > Show Hal configuration > watch
And select the pins you are using to make sure they are there and change states or values the way you expect.
But after saying all that it would still probably be better to find out where the noise is coming from and fix it there if possible.
Rick G
Please Log in or Create an account to join the conversation.
- whampoo
- Offline
- New Member
-
- Posts: 12
- Thank you received: 0
Thanks for the info I understand it a little better they way you described it. The odd thing is the debounce statements I am currently using for the homing/limit switches works and I don't get any odd errors while running any of the steppers. Seems the only problem is when I attached the probe and moved the z-axis the probe was giving false hit I figured it was similar to the homing switches and there was some noise affecting the probe signal. I am really not sure if that is the case but it is similar to what the homing switches were doing. I guess now I am wondering how the homing/limit switches are all working with only one thread statement, more confusion I would say on my part. Maybe I was lucky and it was only one switch causing the problem? My big mental block is the naming conventions for the actual debounce statement not so much the paraport statement but the probe naming. I tried all the probe controller/pin names with no success. I still get a rtapi error or I end up with EMC failing to start saying it can't find the "name used" . I guess I am not following the logic behind how all these commands work, which I attribute to my lack of Linux configuration experience, unfortunately. Some things I can get by looking at other commands and making the adjustments to them others I am completely in the dark on.
OK now having said all of that, should I see anything on the lower screen of EMC stating that the probe was tripped or will it just write to the file and change directions ? I opened a watch window for the probe and it is showing red when I trip it and yellow when it is not tripped. could it be I have been looking for something that will never actually show up on the screen ??


Thanks for your help,
Joel
Please Log in or Create an account to join the conversation.
- whampoo
- Offline
- New Member
-
- Posts: 12
- Thank you received: 0
It appears I may have found the problem. I didn't have the delsig statement in the hal file ... I added the statement and bingo it appears to be working... this is the current hal file
#load the debounce. One set of three channels.
loadrt debounce cfg=4
#add the debounce to a thread, so that it gets run
#this is running in the fast base-thread
#you could use the servo thread. I am not sure which would be best.
addf debounce.0 base-thread
#Unlink the parport pins and limit inputs for rewiring
delsig max-home-x
delsig max-home-y
delsig max-home-z
delsig probe-in
net x-raw parport.0.pin-10-in => debounce.0.0.in
net y-raw parport.0.pin-11-in => debounce.0.1.in
net z-raw parport.0.pin-12-in => debounce.0.2.in
net probe-in parport.0.pin-13-in => debounce.0.3.in
net x-filt debounce.0.0.out => axis.0.home-sw-in axis.0.pos-lim-sw-in axis.0.neg-lim-sw-in
net y-filt debounce.0.1.out => axis.1.home-sw-in axis.1.pos-lim-sw-in axis.1.neg-lim-sw-in
net z-filt debounce.0.2.out => axis.2.home-sw-in axis.2.pos-lim-sw-in axis.2.neg-lim-sw-in
net probe-filt debounce.0.3.out => motion.probe-input
#It's important to actually activate the debounce
#20 base-threads is about 0.4mS. The typical machine doesn't move far in that time.
setp debounce.0.delay 100
Thanks for all the help, all the suggestion were appreciated and helpful in understand the configuration of EMC a little better than before. Now I just hope I can remember this next time...

Please Log in or Create an account to join the conversation.
- Rick G
-
- Offline
- Junior Member
-
- Posts: 26
- Thank you received: 155
O.K. that shows the probe is working. You will not see a message unless one is stated in the G code.I opened a watch window for the probe and it is showing red when I trip it and yellow when it is not tripped. could it be I have been looking for something that will never actually show up on the screen ??
However it looks like you are still missing the other addf debounce statements you need one for each occurrence of debounce.
Look for the debounce statements in the Hal watch area the debounce for the probe both the input and output should change when you trip the probe.
For the signal to go from the probe to the debounce to the program the debounce needs to be read and that will only happen if it is on a thread.
In your case in the Hal watch area when you trip the probe...
parport.0.pin-13-in should change
debounce.0.3.in should change
debounce.0.3.out should change
motion.probe-input should change
Also if you go to the Hal show area and select pins it will show you what the pins are connected to.
Which file are you editing? Your machine's Hal file or a custom_postgui.hal file?
Perhaps you should post all of your machine's configuration files
Rick G
Please Log in or Create an account to join the conversation.