Hello Guest it is April 26, 2024, 11:32:52 AM

Author Topic: Signal Number Definitions  (Read 1424 times)

0 Members and 1 Guest are viewing this topic.

Signal Number Definitions
« on: February 14, 2021, 03:55:00 PM »
Where can I find the definitions for the Mach4 signals?

I see the following in Lua code: return Read_Signal(1142)

I need to know which signal 1142 is associated with.



Re: Signal Number Definitions
« Reply #1 on: February 14, 2021, 09:42:17 PM »
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Signal Number Definitions
« Reply #2 on: February 14, 2021, 11:08:15 PM »
That post did not have the answer I was looking for, but it was very informative. Thank you.
Re: Signal Number Definitions
« Reply #3 on: February 14, 2021, 11:42:16 PM »
Hi,
I had a look for that variable number also, but couldn't find it either.

I am not aware of anymore authoritative source either. NFS's response is usually along the lines that the assignment of a pound variable number
for a given piece of data is at NFS's sole discretion and is likely to change over time. They claim any and all useful data is covered by the
ENUMS, and they are in turn NOT affected should at some later date a pound variable number be changed.

If you do discover what it refers to please post it so we can update the lists......its people contributing what they have discovered that those lists exist at all.

Craig


'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Signal Number Definitions
« Reply #4 on: February 15, 2021, 03:09:37 AM »
The easiest way to check this is to go into your machine.ini profile and search for 1142. Looks like its for the spindle forward output
Re: Signal Number Definitions
« Reply #5 on: February 15, 2021, 10:23:20 AM »
This is all defined in the header file that we have in the build. I can give you that here ... nothing special!

If people would use the mc.<name> it would make the code much more readable... BTW with some Lua code we can output all the names with the values :)
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: Signal Number Definitions
« Reply #6 on: February 17, 2021, 11:19:23 AM »
I am new to Mach4 and am trying to get modBus working for my Hitachi VFD. Nothing like biting off a difficult problem to start with. PMC is what generates that number. I see that in this section of code: "return mcSignal(1142)". What is the appropriate way to access that signal?
Re: Signal Number Definitions
« Reply #7 on: February 17, 2021, 11:43:17 AM »
I think I need to make a Lua script to process them all .... I think that would be a cool thing to have. Give me a little time and I will make something up.
I am trying to setup a new PC so I am trying to move a ton of junk around. But the new thread rippers are COOL!

Thanks
Brian
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: Signal Number Definitions
« Reply #8 on: February 18, 2021, 02:22:24 AM »
I wouldn't encourage this use of Mach Lua API but here is a function that works:

Code: [Select]
inst = mc.mcGetInstance()
profile = mc.mcProfileGetName(inst)
machDirectory = mc.mcCntlGetMachDir(inst)
local mINIFilePath = machDirectory .. "\\Profiles\\" .. profile .. "\\Machine.ini"

function findSignalByNumber(sigNum)
  for line in io.lines(mINIFilePath) do
    if signalFound then
local signalDesc = string.match(line, 'Desc') and true or false
if signalDesc then
  description = line:gsub('Desc=', '')
  mc.mcCntlSetLastError(inst, 'Signal' .. tostring(sigNum) .. ': ' .. tostring(description))
          signalFound = false
  break
       end
    else
      signalFound = string.match(line, 'Signal' .. tostring(sigNum)) and true or false
    end
  end
end

findSignalByNumber(1142)

The output prints in the History log
« Last Edit: February 18, 2021, 02:33:35 AM by compewter_numerical »
Re: Signal Number Definitions
« Reply #9 on: February 18, 2021, 11:54:38 AM »
I am very new to Mach4 and Lua so am undoubtedly going to ask some very naïve questions.

Can I replace this code:
Read_Signal(1142)

With this:
Read_Signal(mc.MC_SPINDLE_FWD)