586,655 active members*
3,015 visitors online*
Register for free
Login
Results 1 to 19 of 19
  1. #1
    Join Date
    Dec 2006
    Posts
    603

    Keyboard enabled on startup?

    I have seen a few posts on other forums about enabling the keyboard jogging when Mach4 starts up. I tried all the of the suggestions and none worked. Some lit up the button but I could not move the machine without clicking the jog enable button. I have installed the latest build of Mach4 and have the ESS Smoothstepper. Everything works as it should so far. I have edited screen script to enable my cycle start button so don't need to be talked through that part. If you have been able to get Mach3 Mill to job on startup, how did you do it?

  2. #2
    Join Date
    Nov 2013
    Posts
    4444

    Re: Keyboard enabled on startup?

    Hi Steve,
    its no big drama, but it is instructive of how mach4 is structured.

    In the first instance realise that on the Jogging tab of the main screen there is a button to enable the keyboard jogging. All you really require is for that button to be pressed automatically on start up
    and that can be done easily.

    First pic is of the Screen Edit page highlighting the KeyboardEnable button. Note that the event that ocurrs when the button is pressed is KeyboardInputsToggle().
    For interest I open the ScreenLoad script, found using the second pic.
    I have found where the KeyboardInputsToggle() is in the screen load script....just so you can see how it works, or maybe change it if you want to.

    The next thing we want to have happen is have the keyboard enable at or shoirtly after start up. There is a script called the PLC script which runs every few milliseconds in Mach. If there is something
    you want to monitor its a good place to put the code. The third pic is hpow to access the PLC script.

    Note that the PLC script runs many thousands of times in a session...but we only really need to enable the keyboard once, repeating it all the time is just wasteful. There is a way to do that. A variable called TestCount
    is incremented at each running of the PLC script. At the first run, ie TestCount=1, we run certain functions. I have highlighted the part of the PLC script which does this....and lo and behold, it turns out that NFS
    disable keyboard jogging on start up, presumably for safety. If you blanked or commented out those two lines then keyboard jogging would be enabled at start up by default.

    The point is you don't actually have to program anything, it's already there, all you have to do is turn off the safety feature. Easy.

    Craig

    PS the order of the pics gets all screwed up...but they are all there.

  3. #3
    Join Date
    Dec 2006
    Posts
    603

    Re: Keyboard enabled on startup?

    I have done exactly what you have detailed but no workie. The lathe profile worked but the mill profile does not. The button is lit green but the key presses do not move the DRO. Then I have to click the button twice to enable the keyboard.

    Also where it says set register to 1 i edited it to a zero and again the lathe worked and the mill did not.

    Im going to reinstall Mach4 on the simulating/code writing computer and see if the mill profile works after the edit. Maybe I screwed something up when trying to do this and edited something I shouldnt have.


    EDIT:

    Ok so I did a fresh install. Loaded the lathe profile and edited the PLC script and remmed out the 2 lines. Worked no problem

    Loaded the mill profile and remmed out the 2 lines. Exited and restarted Mach4 and not working. Again the button is enabled but the DRO do not change. Have to click twice to get the keyboard to jog.
    Attached Thumbnails Attached Thumbnails Untitled2.jpg   Untitled.jpg  

  4. #4
    Join Date
    Nov 2013
    Posts
    4444

    Re: Keyboard enabled on startup?

    Hi,
    I was thinking about it and came to this conclusion. When Mach starts at the first pass of the PLC, the code turns the Keyboard jogging ON and then immediately follows with a call to
    the KeyboardInputsToggle() function, which turns it off AND sets the button colors.

    May I suggest, rather than commenting out the line you edit it:

    Code:
     mc.mcIoSetState(iReg, 0) --Set register to 0 to ensure KeyboardInputsToggle function will do a enable.

    What did here is deliberately set the KeyboardEnable to OFF, and THEN follow with a KeyboardInputsToggle() function which will turn the KeyboardEnable ON and set the colors.

    The colors of the button are for our visual convenience, they do not reflect the state of the variable. The KeyboardInputsToggle function toggles the state of the variable BUT ALSO changes the
    color of the button to suit our preferred interpretation.

    Craig

  5. #5
    Join Date
    Nov 2013
    Posts
    4444

    Re: Keyboard enabled on startup?

    Hi,

    Im going to reinstall Mach4 on the simulating/code writing computer and see if the mill profile works after the edit. Maybe I screwed something up when trying to do this and edited something I shouldnt have.
    This was the tried and trued approach with Mach3, it did get corrupted pretty easily and often........but Mach4 does not suffer from that. More often than not you introduce more variables and potential failure points
    by re-installing Mach4.

    Craig

  6. #6
    Join Date
    Dec 2006
    Posts
    603

    Re: Keyboard enabled on startup?

    Yeah I tried that. heres the text from my previous post.

    "Also where it says set register to 1 i edited it to a zero and again the lathe worked and the mill did not."

    Basically all it does is not jog and lights the button.

    Could it just be a bug in the Mach4 program. Maybe someone made a change of some kind not knowing it will affect this deal here. I recently installed 5194 for the G61 command.

  7. #7
    Join Date
    Nov 2013
    Posts
    4444

    Re: Keyboard enabled on startup?

    Hi,
    as I said try setting it to '0', and then toggling it.

    Craig

    - - - Updated - - -

    Hi,
    as I said try setting it to '0', and then toggling it.

    Craig

  8. #8
    Join Date
    Dec 2006
    Posts
    603

    Re: Keyboard enabled on startup?

    I did set it to zero. It worked for the lathe but not the mill. Thats actually mhow it is right now
    Attached Thumbnails Attached Thumbnails Untitled.jpg  

  9. #9
    Join Date
    Nov 2013
    Posts
    4444

    Re: Keyboard enabled on startup?

    Hi,
    OK, I'm not sure whats going on, it would tend to suggest that th PLC is not doing its first run.

    May I suggest putting a message box statement in there, just to confirm that the code is being executed.

    wx.wxMessageBox(" First run of PLC")

    Put it after the call to the KeyboardInputsToggle() call.

    Craig

    - - - Updated - - -

    Hi,
    OK, I'm not sure whats going on, it would tend to suggest that th PLC is not doing its first run.

    May I suggest putting a message box statement in there, just to confirm that the code is being executed.

    wx.wxMessageBox(" First run of PLC")

    Put it after the call to the KeyboardInputsToggle() call.

    Craig

  10. #10
    Join Date
    Nov 2013
    Posts
    4444

    Re: Keyboard enabled on startup?

    Hi,
    even less sure about whats going on with posting to this thread, its suddenly started doubling up what I post????

    Craig

    When I think about the missus does that too!

  11. #11
    Join Date
    Dec 2006
    Posts
    603

    Re: Keyboard enabled on startup?

    I'll add the message box code tomorrow and see what happens. Thank you for helping out.

  12. #12
    Join Date
    Dec 2006
    Posts
    603

    Re: Keyboard enabled on startup?

    The message box poped up. No change on the issue. Button enabled but keyboard will not jog until the button is clicked twice. I thought the KeyBoardInputToggle() routine in the Screen Script file might be different but looking at them they seem to be identical.
    Attached Thumbnails Attached Thumbnails Untitled.jpg   Untitled2.jpg   Untitled3.jpg  

  13. #13
    Join Date
    Dec 2006
    Posts
    603

    Re: Keyboard enabled on startup?

    Here is something I noticed.

    Load Mach4 - Click Enable - no DRO movement with arrow buttons - Click disable - click operator - click edit screen - click edit screen again to uncheck - screen loads and arrow buttons will move DRO's

    So what is different from Mach4 loading new and Mach4 loading after edits? Is there something more going on after a screen edit that is making the keyboard work that doesn't happen when starting up Mach4?

  14. #14
    Join Date
    Dec 2006
    Posts
    603

    Re: Keyboard enabled on startup?

    Ok so I'm guessing that it's not possible to enable jogging on startup. Thank you for trying.

  15. #15
    Join Date
    Nov 2013
    Posts
    4444

    Re: Keyboard enabled on startup?

    Hi Steve,
    Sorry, can't think of any reason that it wouldn't work, I seldom use keyboard jogging (read almost never) so I've never encountered the problem you describe.
    I made a pendant and I use it extensively and almost exclusively for jogging.

    Craig

  16. #16
    Join Date
    Dec 2006
    Posts
    603

    Re: Keyboard enabled on startup?

    My pendant is a number pad. I just use it to move the machine around to setup the job. Once setup, it's cycle start on the panel door. Not a big deal. After not having to do this for ever with mach3 it would be nice if jogging was on by default.

    Do the fine folks who write the code that is mach4 ever read the forums and take suggestions from it? This seems like nice opportunity to add a check box to the setup screen.

  17. #17
    Join Date
    Nov 2013
    Posts
    4444

    Re: Keyboard enabled on startup?

    Hi Steve,
    that is a good idea.

    I think that would be a good suggestion to make to NFS.

    Craig

  18. #18
    Join Date
    Dec 2006
    Posts
    603

    Re: Keyboard enabled on startup?

    Well I figured out what was going on. I was scrolling through the config screens looking for something and stumble upon this. (see photo)

    I cleared that line and restarted Mach4 (Lines still remmed out in PLC file) and the jog now works on start up. I dont remember ever setting this up. I will see if the garage computer is the same way and if it is Im pretty sure it will work out there also.

  19. #19
    Join Date
    Nov 2013
    Posts
    4444

    Re: Keyboard enabled on startup?

    Hi,
    kool, good work on finding that!

    Craig

Similar Threads

  1. Drives not enabled
    By coop31 in forum Cincinnati CNC
    Replies: 11
    Last Post: 10-31-2020, 03:42 PM
  2. Controller not enabled issue
    By joeq1159 in forum Techno CNC
    Replies: 1
    Last Post: 11-11-2014, 01:30 PM
  3. Replies: 2
    Last Post: 11-20-2013, 03:24 AM
  4. Getting the CD servostar enabled
    By mackeym in forum Servo Motors / Drives
    Replies: 8
    Last Post: 10-13-2010, 01:40 AM
  5. Replies: 4
    Last Post: 07-25-2008, 05:57 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •