Hello Guest it is March 29, 2024, 03:03:53 AM

Author Topic: Analog Input mapping  (Read 4494 times)

0 Members and 1 Guest are viewing this topic.

Analog Input mapping
« on: September 30, 2010, 04:01:45 PM »
Hi,

I want to use the analog input function in the Pokeys for changing a UserDRO.
But how do I access to the input value?!
In Brains I coudnt find any Input option and for the VB access I do need some more
information about the library implementation.

Could anyone help me?

Thanks and regards,

Wolfram

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Analog Input mapping
« Reply #1 on: September 30, 2010, 04:21:21 PM »
Hey Wolfman,

     The Pokeys writes to the Old style "Non-Plugin Serial Modbus" (the original one), internally it writes to a structure.
Analog 1, 2, 3, and 4 of PoKeys writes to the NP SMB addresses of: 124, 125, 126, 127 respectively, Even though the pokeys can take and configure
an Analog 5, it will crash Mach3 if you try to add it, (been there, done that, tried starting the range at 123-127 still dont understand why it crashes.. but it does.).

     From VB, you can access the serial mb (only the above old school one), or you can acess the NP SMB via brains modbus address 124-127.

here is some of the Modbus VB access code:

GetInBit(BuffIndex, BitNumber)

to use this one, Index number is 0-63 on channel one, and 64-127 on Channel 2, and BitNumber is 0-15 relating to the individual bit status in that word that you want, i.e. 0 or 1. See the Input section of config autopoller modbus. NOTE If you are using Bit packing special control then you can only Use the GetInBit on the 2cd channel 64-127. You have to use something like "IsActive(INPUT1)" on channel 1. If you don't use bit packing then you can use it with the 1st channel.

SetOutBit(BuffIndex, BitNumber)
to use this one, Index number is 0-63 on channel one, and 64-127 on Channel 2. and BitNumber is 0-15 relating to the individual bit status in that word that you want, It Turns the bit ON!!. See the Output section of config autopoller modbus. NOTE If you are using Bit packing special control then you can only Use the SetOutBit on the 2cd channel 64-127. You have to use something like "ActivateSignal(OUTPUT1)" on channel 1. If you don't use bit packing then you can use it with the 1st channel.

ReSetOutBit(BuffIndex, BitNumber)
is just like SetOutBit(BuffIndex, BitNumber) above, but it turns the requested bit OFF.

GetMasterInput(0-127)   'gets the word at that address
GetMasterOutput(0-127) 'gets the word at that address

SetMasterOutput(0-127, 0-15bit) 'sets the word at that address
SetMasterInput(0-127, 0-15bit) 'sets the word at that address (note this only works if there is nothing writting in from outside, otherwise it that info
will be overwritten the next scan.

Scott
fun times
Re: Analog Input mapping
« Reply #2 on: September 30, 2010, 05:22:04 PM »
Hi Scott,

fast and good infos... :D

I will test it, thanks a lot!

Bye, Wolfram