Hello Guest it is March 28, 2024, 09:58:07 PM

Author Topic: VB scripts and Brains  (Read 5841 times)

0 Members and 1 Guest are viewing this topic.

VB scripts and Brains
« on: January 29, 2016, 05:43:41 PM »
Hello everybody!

This is my first post on the forum.

My friend has a lathe with a 12 position toolchanger. The machine is quite old and has a an outdated control computer. He asked me if we could upgrade it.
For the past few weeks i have been writing VB scripts and brain logic and changed the screen. everything was working perfectly when bench testing.
Now i got a Smoothstepper and when i configured it i get alot of errors.

The thing is im using OEMTriggers as internal variables to send bits from VB scripts to Brains. i don't use them as inputs to the outside world. But smoothstepper's plugin does not like that.
If i dong configure the OEMTriggers i get errors from the smoothstepper plugin.

My question is how can i send bits from VBscpripts to Brains and vice versa without using OEMTriggers?

This is a section from my M6start.m1s

DeActivateSignal(OUTPUT3) 'tool found
   While Not IsActive(OEMTRIG2)
     Message ("Waiting for confirmation - tool lock ")
     Sleep(100)
   Wend
   Message ("Tool ready")
   End If

The OEMTRIG2 is set high by the Brain and the Brain gets the signal from modbus.

What can i use instead of OEMTRIG or INPUT or OUTPUT. so i can link Brains to VB scripts?

Thank you.

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: VB scripts and Brains
« Reply #1 on: January 29, 2016, 07:07:58 PM »
I have absolutly no idea about what you are attempting to do. But why not have teh Script display the data in a DRO and the Brains read it.
Re: VB scripts and Brains
« Reply #2 on: February 01, 2016, 12:00:05 PM »
So i should use a dro for "0" and "1"? I need to pass booleam logic. Is ir possible with a dro?
Thank you
Re: VB scripts and Brains
« Reply #3 on: February 01, 2016, 12:01:19 PM »
This woul be alot simpler if i could manipulate the inputs and outputs directly from VB scripts. But i cant find any commands or examples that do that on a arduino :/

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: VB scripts and Brains
« Reply #4 on: February 01, 2016, 12:18:42 PM »
Sure you can manilpulate teh I/O from CB scripts  you can turn on /off inputs or outputs. It is all in the manuals.

You can run the Tool changer directly  from Mach3

(;-) TP
« Last Edit: February 01, 2016, 12:20:31 PM by BR549 »
Re: VB scripts and Brains
« Reply #5 on: February 01, 2016, 01:03:02 PM »
Yes i saw in a manual the codes but i dont understand how to use them... It doesn't work...
In this manual:
https://www.google.si/url?sa=t&source=web&rct=j&url=http://d1.amobbs.com/bbs_upload782111/files_20/ourdev_492319.pdf&ved=0ahUKEwjs5pTnktfKAhXDtA4KHTHoAxo4ChAWCBcwAA&usg=AFQjCNE9qLuf2L24g04ap7tpgXqIoNnf9A&sig2=RH-NwvG6CMPxpbX4iHxkvw
I tried to use: SetOutBit(buffIndex, Bit Number) as Integer.. But i don't know what buffIndex is and what bit number is...  I thought you just enter the cfg number and set it high or low but i doesn't work. Maybe someone else made it work?

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: VB scripts and Brains
« Reply #6 on: February 02, 2016, 10:10:41 AM »
Are you trying to talk to a serial port or a USB port ????   OF just trying to turn outputs on/off or read inputs

(;-) TP
Re: VB scripts and Brains
« Reply #7 on: February 02, 2016, 11:50:52 AM »
Arduino is loaded with the Modbus program.... And it is connected to the usb port. But windows sees the arduino as a virtual com port (com7 for example). Tgeoretically it is a com port but it communicates as modbus... In config you have to enable modbus communication and you have to setup tables for modbus (cfg1 output-coil and pin number) then you just call a modbus config from brains...
I dont use inpits and outputs of a LPT port. All non-time critical inputs and outputs go via modbus. Homing and index and limit switches go trough Smoothstepper.

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: VB scripts and Brains
« Reply #8 on: February 02, 2016, 12:08:27 PM »
AH ok you device speaks modbus (;-) Mach3 speaks ModbusRTU. Teh commands are covered in one of the mach3 manuals. You can talk to modbus via Macropump,Brains,serial or TCP.

(;-) TP
Re: VB scripts and Brains
« Reply #9 on: February 02, 2016, 12:42:20 PM »
I was looking in all kind of manuals... Only the one that i posted has a section that describes VB commands to acces modbus directly.... But as i said i dont know how to use them... I tried all kind of variables to define the vb command but nothing works...