cycle timer not working

More
09 Jul 2013 22:20 #36450 by rmattioda
Replied by rmattioda on topic cycle timer not working
I am still struggling with this one.

I have the items on my screen but when I add:

loadrt time
loadrt not
addf time.0 servo-thread
addf not.0 servo-thread
net prog-running not.0.in <= halui.program.is-idle
net cycle-timer time.0.start <= not.0.out
net cycle-seconds pyvcp.time-seconds <= time.0.seconds
net cycle-minutes pyvcp.time-minutes <= time.0.minutes
net cycle-hours pyvcp.time-hours <= time.0.hours

it will not allow EMC2 to open.

all my .hal-.ini is at this link

www.linuxcnc.org/media/kunena/attachment...615/linuxcncpost.txt


your help is appreciated

Please Log in or Create an account to join the conversation.

More
09 Jul 2013 22:32 #36451 by andypugh
Replied by andypugh on topic cycle timer not working
LinuxCNC will tell you _why_ it didn't start, if you read the error report.

My first guess would be that you have put the new stuff in the wrong HAL file, it needs to be in the postgui halfile, or there is no PyVCP to link to.

Please Log in or Create an account to join the conversation.

More
09 Jul 2013 22:33 #36452 by BigJohnT
Replied by BigJohnT on topic cycle timer not working
Attach the output from dmesg after clearing it and trying to run your configuration.

www.linuxcnc.org/docs/html/common/Linux_...tml#_bootup_messages

JT

Please Log in or Create an account to join the conversation.

More
09 Jul 2013 22:51 - 09 Jul 2013 22:55 #36453 by rmattioda
Replied by rmattioda on topic cycle timer not working
Andy,

when i look at the report is says, cannot load time loadrt time. what do you think?

also i did post this in my postgui file
Last edit: 09 Jul 2013 22:55 by rmattioda.

Please Log in or Create an account to join the conversation.

More
09 Jul 2013 23:09 #36454 by ArcEye
Replied by ArcEye on topic cycle timer not working
My SWAG (as JT would say)

What version of Linuxcnc are you running?

time was not in 2.4.x

Please Log in or Create an account to join the conversation.

More
09 Jul 2013 23:45 #36456 by rmattioda
Replied by rmattioda on topic cycle timer not working
problem answered, I am running 2.4.6

Thanks

Please Log in or Create an account to join the conversation.

More
09 Jul 2013 23:57 #36457 by BigJohnT
Replied by BigJohnT on topic cycle timer not working
You can add a component if you don't care to upgrade.

JT

Please Log in or Create an account to join the conversation.

More
10 Jul 2013 01:41 #36462 by rmattioda
Replied by rmattioda on topic cycle timer not working
you mean add the timer in 2.4.6? if so how?

Please Log in or Create an account to join the conversation.

More
10 Jul 2013 03:30 #36467 by BigJohnT
Replied by BigJohnT on topic cycle timer not working
Yes, just add it to 2.4 if you don't wish to upgrade. IMHO I would upgrade to 2.5.2.

Copy the following to time.comp
component time "Time on in Hours, Minutes, Seconds";

description 
"""
Time

When the time.N.start bit goes true the cycle timer resets and starts
to time until time.N.start goes false. If you connect time.N.start to
halui.is-running as a cycle timer it will reset during a pause. See
the example connections below to keep the timer timing during a pause.

Time returns the hours, minutes, and seconds that time.N.start is true.

Sample pyVCP code to display the hours:minutes:seconds.

<pyvcp>
  <hbox>
  <label>
    <text>"Cycle Time"</text>
    <font>("Helvetica",14)</font>
  </label>
  <u32> 
      <halpin>"time-hours"</halpin>
      <font>("Helvetica",14)</font>
      <format>"2d"</format>
  </u32>
  <label>
    <text>":"</text>
    <font>("Helvetica",14)</font>
  </label>
  <u32> 
      <halpin>"time-minutes"</halpin>
      <font>("Helvetica",14)</font>
      <format>"2d"</format>
  </u32>
  <label>
    <text>":"</text>
    <font>("Helvetica",14)</font>
  </label>
  <u32> 
      <halpin>"time-seconds"</halpin>
      <font>("Helvetica",14)</font>
      <format>"2d"</format>
  </u32>
  </hbox>
</pyvcp>

In your post-gui.hal file you might use the following to connect it up

 loadrt time
 loadrt not
 addf time.0 servo-thread
 addf not.0 servo-thread
 net prog-running not.0.in <= halui.program.is-idle
 net cycle-timer time.0.start <= not.0.out
 net cycle-seconds pyvcp.time-seconds <= time.0.seconds
 net cycle-minutes pyvcp.time-minutes <= time.0.minutes
 net cycle-hours pyvcp.time-hours <= time.0.hours

""";
 
author "John Thornton";

license "GPL";

// Input Pins
pin in bit start "Timer On";

// Output Pins
pin out u32 seconds "Seconds";
pin out u32 minutes "Minutes";
pin out u32 hours "Hours";

// Global Variables
variable double totalnsec;
variable int old_start;

function _;

;;

#include "rtapi_math.h"

FUNCTION(_) {
    __u32 totalseconds; 
    if(start && !old_start) totalnsec = 0;

    if(start){
    totalnsec = totalnsec + period;
    totalseconds = totalnsec * 0.000000001;
    seconds = totalseconds % 60;
	minutes = (totalseconds / 60) % 60;
	hours = (totalseconds / 3600);
	}
	old_start = start;
}

Follow the instructions to install dev here
www.linuxcnc.org/docs/html/hal/comp.html#_installing

Then open a terminal and say
sudo comp --install time.comp

If you create the file in your home directory when you open a terminal you won't have to change directories to install the component.

JT

Please Log in or Create an account to join the conversation.

More
10 Jul 2013 05:22 #36471 by rmattioda
Replied by rmattioda on topic cycle timer not working
I have a probotix and they said they haven't made any with that version and dis advised me too.

what do you think?

Please Log in or Create an account to join the conversation.

Time to create page: 0.082 seconds
Powered by Kunena Forum