Modbus Examples?
The example I made is related at the ClassicLadder logic and the simbol & means AND bitwise function .
I think you are talking about High Byte and Low Byte , ins't it.
So you have from Modbus a 16bit register that is containing
into the low byte (from 0 to 7 bits) the status of the drive and
into the high byte (from 8 to 15 bits) the short integer value that is the percentage of the load of the drive (0-100%).
If you want to isolate only the value of the high byte you should shift the register value to right of 8 bit position.
With a commercial PLC it is quite easy because there are SHIFT functions.
Into ClassicLadder it is quite complicated but possible.
But right now I'm not in the condition to test it.
Sorry.
As Andy answered to you on the mailing list you can make a hal component to do this job.
And mayby the Andy example should do what you want.
bigalex
Please Log in or Create an account to join the conversation.
- willburrrr2003
- Offline
- Junior Member
- Posts: 29
- Thank you received: 0
I am a system integrator and deal with interfacing VFD's and other equipment into PLC's with various types of comminication. With modbus, you don't write to each register individually. you create a packet of write registers, and a packet of read registers... Modbus devices are addressable individually, and from reading it seems that classic ladder only allows 8 devices in the tcp/ip mode. Each read, and write packet counts as an instance. If you have 8 devices and read + write to each you have 16 instances(max allowed?).
So you would set up in your classic ladder the state of your registers (allow control, run, fwd, speed, etc) for drive #1. Then you would create your modbus send packet which would include all the registers you have setup for drive control(allow control, run, fwd, speed, etc) . Once that is setup, once per PLC cycle you send to modbusID(of drive 1...ex would be device 1) the send Packet(TX) . If you want to read telemetry data back from the drive, the you have to set up a receive packet in your PLC(classicladder) with register addresses local to your classicladder program for the data(rmp, running, fault, etc...) Then you would once per cycle poll the drive's modbus address for a read(RX) packet. I am getting ready to interface a PLC into my Machine via Modbus communications to my classicladder PLC, for aux functions that do not need to run in realtime. I would be happy to help you with your setup if you would like.
I hope this info helps,
Regards,
Will R. Seattle Washington
If it is infact limited to only 16, then this won't work for me. I need to write to one reg on each drive to enable them, then read another one to keep them enabled, then write to a 3rd for start/stop, and a 4th yet to control the speed. That makes 32
I had been looking at that a little, but I was not able to figure out how to install it from the info given on that page.
Would Modbus to Hal have to be installid on Master, or can it be used with 2.52?
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Topic Author
- Offline
- Platinum Member
- Posts: 5007
- Thank you received: 1441
I have succesfuly tested it on a couple of drives, but I haven't had the time to fully impliment it on the machine yet. Maybe in a couple of weeks after I catch up on some other work.
In order to control 1 drive, I need to write a 0 to register #48 to unlock the drive (this technically only needs done once after power up), write a 4 or 8 to register #1 to stop/start, write the speed to register #40, and read register #24 to get the drive information and keep the drive from setting the serial watch dog and shutting down. I don't see how this can be done for 8 drives with classic ladder and it's 16 transaction limit. If the 3 registers I needed to write to were grouped together so that I could write to them in one transaction then it would probably work.
Please Log in or Create an account to join the conversation.
I'm happy to know that you are making progress with modbus2hal hal component.
I would like to test it too so can you please detail how you did it?
Did you get LinuxCNC from Master branch (because mb2hal is not present into LCNC 2.5.2)
or what else ?
bigalex
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Topic Author
- Offline
- Platinum Member
- Posts: 5007
- Thank you received: 1441
Just installing master from buildbot didn't give me mb2hal, but I didn't have the libmodbus3 installed yet at that point either.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Topic Author
- Offline
- Platinum Member
- Posts: 5007
- Thank you received: 1441
Since you know something about modbus. All I know is what I've figured out playing with this for the last 3 weeks. When setting up multiple transactions with multiple slaves. Is it better to do all the transactions with one slave then move to the next, or do all like transactions with each slave (in my case all unlock together, then all start/stop, then all speed settings, then all reads)
Please Log in or Create an account to join the conversation.
I'm trying to get LinuxCNC working from git .
I downloaded the source code from git and i verified I'm into the master branch.
I'm trying to do this :
2.5. Building LinuxCNC (realtime)
If you have already installed LinuxCNC from the Live-CD do not use --prefix/make install. Use the 'run in place' method (the default) instead.
Run these commands in the directory created by git above (e.g., linuxcnc-dev):
cd src
./autogen.sh
./configure --enable-run-in-place
make
make install-menus
sudo make setuid
the make command may take several minutes to complete.
But when I make
I got./configure --enable-run-in-place
cnc@cnc-desktop:~/linuxcnc-dev/src$ sudo ./configure --enable-run-in-place
checking libgl1-mesa-dri workaround... test for libgl1-mesa-dri workaround failed, please file a bug
I already read this thread but I don't solve the problem .
I have already installed LinuxCNC from buildbot starting from a fresh Ubuntu 10.04 installation and it's working.
Are there any problems to install LinuxCNC from git having already a LinuxCNC installation from buildbot ?
I would like to use mb2hal component instead of ClassicLadder Modbus communication feature because ClassicLadder need
to have the programming window open to run Modbus userspace component as I understood.
regards
bigalex
Please Log in or Create an account to join the conversation.
Are you using 10.04?
Check your library version is 7.7.1-1ubuntu3.1, that works for me.
You should have
libgl1-mesa-glx
libgl1-mesa-dev
libgl1-mesa-dri
to be able to compile
regards
Please Log in or Create an account to join the conversation.
The library version is correct.
The libgl1-mesa-dev was missing , I installed it and then run again ./configure --enable-run-in-place but the result is the same.
The configure command fail with the same message output :
cnc@cnc-desktop:~/linuxcnc-dev/src$ sudo ./configure --enable-run-in-place
checking libgl1-mesa-dri workaround... test for libgl1-mesa-dri workaround failed, please file a bug
bigalex
Please Log in or Create an account to join the conversation.
libglu1-mesa
libglu1-mesa-dev
(and of course openGL, but that should be there)
If you look in /linuxcnc-dev/scripts/test-lib-gl-bug.sh this is what configure is trying to build to test if your system is OK
When I run configure I get
..........required - need to preload /usr/lib/libstdc++.so.6
Please Log in or Create an account to join the conversation.