Threads
06 Oct 2011 13:10 #13702
by BigJohnT
Replied by BigJohnT on topic Re:Threads
I would just use the servo-thread, adding another thread has to be a multiple or something like that of the base thread.
www.linuxcnc.org/docview/html/config_ini_config.html#sub:[EMCMOT]-section
John
www.linuxcnc.org/docview/html/config_ini_config.html#sub:[EMCMOT]-section
John
Please Log in or Create an account to join the conversation.
06 Oct 2011 13:23 #13704
by fma
Replied by fma on topic Re:Threads
The problem is that I get far too much values, as sampler will sample every servo-thread period, leading to a huge file. I only need 5-10 samples per second...
Please Log in or Create an account to join the conversation.
06 Oct 2011 14:33 #13708
by BigJohnT
Replied by BigJohnT on topic Re:Threads
Just a debounce to get the sample rate you want.
www.linuxcnc.org/docview/html/man/man9/debounce.9.html
John
www.linuxcnc.org/docview/html/man/man9/debounce.9.html
John
Please Log in or Create an account to join the conversation.
06 Oct 2011 15:15 #13709
by fma
Replied by fma on topic Re:Threads
Ok, but how to I connect the deboucner to the sampler? AFAIK, the sampler samples each time its function is called by the thread...
Please Log in or Create an account to join the conversation.
06 Oct 2011 17:12 #13711
by BigJohnT
Replied by BigJohnT on topic Re:Threads
Which component is the sampler?
John
John
Please Log in or Create an account to join the conversation.
06 Oct 2011 21:07 #13717
by fma
Replied by fma on topic Re:Threads
Please Log in or Create an account to join the conversation.
06 Oct 2011 23:44 #13718
by BigJohnT
Replied by BigJohnT on topic Re:Threads
Cool, you might try debounce connected to the enable pin on sampler... I've never used it before.
John
John
Please Log in or Create an account to join the conversation.
07 Oct 2011 06:24 #13733
by fma
Replied by fma on topic Re:Threads
Ah, yes, that's a good idea! Thank!
Please Log in or Create an account to join the conversation.
07 Oct 2011 09:29 - 07 Oct 2011 09:30 #13736
by fma
Replied by fma on topic Re:Threads
In order to work, the sampler enable pin needs to be true only during 1 clock cycle, otherwise it will generate several samples. The debouncer does not allow that, does it?
So, I think I will have to write a special component, which will generate that single pulse. Something like:
What do you think?
So, I think I will have to write a special component, which will generate that single pulse. Something like:
component divider "Divide the 'clock' signal of the thread by some amount";
pin in bit enable=TRUE "enable divider";
pin out bit pulse=FALSE "pulse output";
param u32 divider=10000 "divider value";
variable u32 counter = 0;
function _;
license "GPL";
author "fma";
;;
FUNCTION(_)
{
if (enable) {
counter += 1;
if counter == divider {
pulse = TRUE;
counter = 0;
}
else {
pulse = FALSE;
}
}
}
Last edit: 07 Oct 2011 09:30 by fma.
Please Log in or Create an account to join the conversation.
Time to create page: 0.100 seconds