how to make M7 (mist on) generate step pulses

  • mikeT
  • mikeT's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
01 Dec 2021 16:18 - 28 Jan 2025 17:24 #228132 by mikeT
Thank you for your continued support Andy,
Success !!!!!!!!!!!!!
I had given up hope of doing this with software due to my limited software abilities.
However, adding the steplen and stepspace parameters fixed it.
Now I can run my peristaltic mist pump at a predefined speed at the press of the coolant mist button or M7 command.

My HALnow includes:
loadrt stepgen step_ type=0,0,0,0,0 ctrl_type=p,p,p,p,v
setp stepgen.4.velocity-cmd 20
setp stepgen.4.steplen 1
setp stepgen.4.stepspace 1
net pump-on iocontrol.0.coolant-mist => stepgen.4.enable
net pump-pulse stepgen.4.step parport.0.pin-14-out

Happy happy happy
Thanks again

Mike
Last edit: 28 Jan 2025 17:24 by mikeT.
The following user(s) said Thank You: tommylight

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

More
02 Dec 2021 15:18 #228192 by andypugh
Replied by andypugh on topic how to make M7 (mist on) generate step pulses
I am slightly surprised it works with such short step-length.
Just to be on the safe side, try 5000 for both.
The following user(s) said Thank You: mikeT

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

  • tommylight
  • tommylight's Avatar
  • Away
  • Moderator
  • Moderator
More
02 Dec 2021 17:08 #228201 by tommylight
Replied by tommylight on topic how to make M7 (mist on) generate step pulses
stepgen.N.steplen u32 rw

The length of the step pulses, in nanoseconds. Measured from rising edge to falling edge.

stepgen.N.stepspace u32 rw (step types 0 and 1 only) The minimum

space between step pulses, in nanoseconds. Measured from falling edge to rising edge. The actual time depends on the step rate and can be much longer. If stepspace is 0, then step can be asserted every period. This can be used in conjunction with hal_parport’s auto-resetting pins to output one step pulse per period. In this mode, steplen must be set for one period or less.
In the HAL file, those timings are supposed to be in periods, not nanoseconds, if the parallel port reset time is set. From the time of LinuxCNC2.5 i have only seen those two values as 1 and 0.
So if the reset time is 5000, steplen will be 5000.
Not sure what happens if there is no reset time, but from the above it seems it would revert to using nanoseconds.
The following user(s) said Thank You: mikeT

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

  • mikeT
  • mikeT's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
02 Dec 2021 21:59 - 02 Dec 2021 22:07 #228227 by mikeT
Interesting !

My HAL was created automatically by stepconfig.

The four linear mation axes all have steplen 1 and.stepspace 1. I simply copied that to stepgen .4.

I cannot see anything obvious to set the paraport reset time, it appears to be locked to the base period, However, all the axes have dirhold 2750 and dirsetup 2750. Could this be setting the pulse durations?

Mike
Last edit: 02 Dec 2021 22:07 by mikeT.

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

  • tommylight
  • tommylight's Avatar
  • Away
  • Moderator
  • Moderator
More
02 Dec 2021 22:43 #228234 by tommylight
Replied by tommylight on topic how to make M7 (mist on) generate step pulses
No worries, it is working, and that is the important part.
The following user(s) said Thank You: mikeT

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

  • mikeT
  • mikeT's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
04 Aug 2025 10:51 - 04 Aug 2025 14:18 #332808 by mikeT
Now I can run my peristaltic mist pump at a predefined speed at the press of the coolant mist button or M7 command.

My HALnow includes:
loadrt stepgen step_ type=0,0,0,0,0 ctrl_type=p,p,p,p,v
setp stepgen.4.velocity-cmd 20
setp stepgen.4.steplen 1
setp stepgen.4.stepspace 1
net pump-on iocontrol.0.coolant-mist => stepgen.4.enable
net pump-pulse stepgen.4.step parport.0.pin-14-out

I have been running this HAL code since 2021. It works reliably but these is only one stepper speed available i.e. setp stepgen.4.velocity-cmd 20. If I wish to change the stepper/peristaltic pump speed, I need to edit the HAL file and re start.

Is there a way to add a control to the AXIS control screen or add a pot or encoder the the parport pins which will allow me to change the stepgen speed (velocity-cmd 20) in the HAL file during a machining session.
Last edit: 04 Aug 2025 14:18 by mikeT.

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

  • mikeT
  • mikeT's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
05 Aug 2025 10:10 - 05 Aug 2025 17:24 #332873 by mikeT
Maybe I should be asking a different question.

If I were to change the "setp stepgen.4.velocity-cmd 20" line in my HAL file, while AXIS was running; would it make any difference?

Is the HAL file used while the AXIS CNC program is running OR is it only used to set up the machine during start up?
What are your thoughts?

Thanks  

Mike
 
Last edit: 05 Aug 2025 17:24 by mikeT.

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

  • pommen
  • pommen's Avatar
  • Away
  • Senior Member
  • Senior Member
More
05 Aug 2025 17:38 #332906 by pommen
You can set do 'setp' command while linuxcnc is running via halcmd i think.
open a terminal and write halcmd -k (double check this syntax)

linuxcnc.org/docs/html/man/man1/halcmd.1.html

I think you can set set via bash commands, i haven't tried though
I think you make a file with your command and call it trough a custom Mcode.

in the file:
#!/bin/bash
# M101 - some command
halcmd setp parport.0.pin-XX-out true


There is some more steps to this. I think you need to ad a new new Mcode is the ini file RS274NGC section.

I hope this gives you enough to keywords to search.

/Peter

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

  • mikeT
  • mikeT's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
05 Aug 2025 20:03 #332916 by mikeT
Thank you Peter,

I don't think I understood much of that

Mike

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

More
08 Aug 2025 20:16 #333065 by andypugh
Replied by andypugh on topic how to make M7 (mist on) generate step pulses
Just open the terminal and type

halcmd setp stepgen.4.velocity-cmd 40

Anything that is a valid HAL command for the HAL file can be run from the command line with "halcmd"

If you want to do more than a single line, then

halcmd -kf

will open an interactive HAL session where you can type commands (without halcmd) with tab-comoletion and command history.

To exit the interactive session, type "exit"

But if you want to control it from a switch, or pot, or VCP then that can be done too.
The following user(s) said Thank You: mikeT

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

Time to create page: 0.107 seconds
Powered by Kunena Forum