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