In this section we'll
setup the CUBLOC and Mach3 to operate a rather simple
pendant for controlling Mach3. It will have three
pushbuttons used for Cycle Start, Feed Hold
and Stop, one pot for Feedrate Override
and three LED's to indicate various states of Mach3.
We've already looked at how to set up the inputs and
outputs of the CUBLOC so the only thing left to do there
is to setup an analog input for the Feedrate override
If you remember we used
the command Usepin to set the direction of our
I/O ports when used for LADDER. To set the direction of
an I/O when used in BASIC we use the command Input.
In this case I've set P16 as an input. P16 happens to be
ADChannel 0 on the CB405 module.
Then inside the Do-Loop
I've added code to read the analog input and store it's
value in the "LADDER memory" at adress D10. The
underscore before D10 is used to tell the CUBLOC that it
is the LADDER memory we want to access.
(Click picture to view as
In Mach3 we need to setup
the Modbus Plugin so that it reads and writes the proper
registers in the CUBLOC. To do this we select
Function Config's/Setup Serial Modbus.
As you can see I've setup
3 Modbus Configurations. The three outputs, P33, P34 and
P35 will be updated every 200mS, the three inputs, P5,
P6 and P7 will be read every 100mS just as the analog
value from the pot. As stated in the CUBLOC manual the
D-registers starts at adress 28672 ($7000h) so the the
D10 register, holding the value of the FRO pot, is at
adress 28682. To start the automatic polling it's just a
matter of ticking the ModBus Run checkbox.