Hello Guest it is April 19, 2024, 04:36:38 AM

Author Topic: Cubloc, brains and ModIO  (Read 19472 times)

0 Members and 1 Guest are viewing this topic.

Re: Cubloc, brains and ModIO
« Reply #10 on: April 18, 2008, 09:49:28 PM »
vince,

lets give a try :-)

i paste a code snippet of my CB280 - you have to change serveral things like portnumbers
lines i change are *-marked

Const Device = CB405 *changed
 
 Opencom 1,115200,3,80,80   'Open COM1 for MODBUS communication.
 Set Modbus 1,1,1      'Mode=RTU, Slave Adress=1, Return Adress=1

 Usepin 4,In
 Usepin 5,In
 
 Usepin 20,Out
 Usepin 21,Out

 Set Ladder On

 Dim d As Integer
 Dim e As Integer
 ...

Do

LadderScan
_D(12) = Adin(2)

.... your basic code here ...

Loop

**************

small explanaition:

the register _D(12) contains a value betwenn 0 and 1023 - depending of the voltage at ADIn(2) (Pin27 on CB405)
this register can be read as modbus adress 28684 (see pg. 308 on CB-manual - H7000 = D28672

UsePin 4,in = pin 4 is input and readable in Modbus config at adress 4
Usepin 20,out = pin 20 is output and writeable at adress 20

now - lets take output20 of the cubloc for flood coolant as example

in modbus conf write any cfg: (i use 5 in example)

Cfg #5: Enabled
Comment: P20
port/address: 1
Slave: 1
Refresh: 25
modbus address: 20
nr of reg.: 1
direction: output

now go to brain editor - write a brian - name it whatever you want
in it: add an input - select LEDs - and there your choice is 13 - Flood On
activate this LED and add a lobe - in this case: do nothing (no operation) - ok
activate this lobe and press the terminate-button
choose ModBus - in it set address to 0, as output and Serial plugin enabled #cfg 5

save - load - and enjoy

the rest is only a little bit reading (or listen any video which i don't understand)
and a lot of write'n'click

regards Frank

BTW: i don't post my code - nor here neither pn - its a lot of work and i'm really not able to understand the videos ...
i've taken 1 week for learning by doing
Re: Cubloc, brains and ModIO
« Reply #11 on: April 18, 2008, 10:08:13 PM »
That's almost exactly what I have, except for the Dim and LadderScan statement.  My Brain setup and Modbus setup are the same, see my screen shots above.  It does not work.  In your example, you lost me at the Dime d, Dim e and Ladderscan statements.  Do these have anything to do with the Coolant Brain?  I can't try it on my machine computer until Monday.   Thanks for the help.

Vince
Re: Cubloc, brains and ModIO
« Reply #12 on: April 18, 2008, 10:32:33 PM »
have you tested the communication between Mach3 and CubLoc ?
both directions ?

thats really elementary

Frank
Re: Cubloc, brains and ModIO
« Reply #13 on: April 18, 2008, 11:13:34 PM »
have you tested the communication between Mach3 and CubLoc ?
both directions ?

thats really elementary

Frank


Yes, using the test modbus screen, I can read and write to all my inputs and outputs.  I can close the mechanical relays on the Cubloc board from the test screen.  Monday I will try your code exactly and see if it works.  I am thinking I have some simple setting wrong that I don't readily notice.

Vince
Re: Cubloc, brains and ModIO
« Reply #14 on: April 21, 2008, 09:20:33 AM »
It's working!!!  Thank you Scott and Frank.  The problem was I was using the command input and output instead of usepin in and usepin out. 

Vince
« Last Edit: September 15, 2008, 07:49:05 PM by Vince Endter »
Re: Cubloc, brains and ModIO
« Reply #15 on: April 26, 2008, 10:27:01 PM »
After 3 days of working on it and reading the sparse manual, I was able to write a Cubloc ladder program that will index the CHNC turret to the proper tool (see the attachment).  The only thing left to do is have the Cubloc get the tool number from Mach and substitute it for the (Tool#) in the ladder program.  It would be nice if the usepin aliases could include a variable that would be linked to an address.  Has anyone done this?

Thanks

Vince

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Cubloc, brains and ModIO
« Reply #16 on: April 27, 2008, 09:28:59 AM »
Drop your Tool number into a "Pointer" if your cube allows that, then compare the Pointer to your rungs and when it is equal to that tool slot, that rung will run and index to that slot.
Your pointer will act like a "Variable" register.

scott
fun times
Re: Cubloc, brains and ModIO
« Reply #17 on: April 27, 2008, 08:09:12 PM »
Thanks Scott, I will go through the manual and see if there is that type of function.

Vince
Re: Cubloc, brains and ModIO
« Reply #18 on: April 29, 2008, 02:32:39 PM »
Thanks to all who helped.  I now have the tool turret working under Mach control.  I had Mach send the tool number to an address in the Cubloc, and then I compared the address to the numbers 1 through 8.  If the compare was true, it would execute a subroutine to get that tool position.   Here is a video of it working.

http://video.google.com/videoplay?docid=6834017345329403743&hl=en

Vince

Offline jeep534

*
  •  123 123
  • From the hills of WV
    • View Profile
Re: Cubloc, brains and ModIO
« Reply #19 on: July 24, 2008, 08:48:37 AM »
WoW  too cool

archie =) =) =)
Facebook archies machine