I am a new user in codesys and I want to communicate with a stepper motor i've got via serial port, can everyone guide me? The exact things I want to do is to send some commands for example rotate via my com port...I simply cannot find the way to connect with the com on my computer which is connectd to the motor
THanks in advance
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for your reply, well let me tell you what I've tried so far, I made a new project and I put a MODBUS COM and MODBUS Master COM port, then I thought that if I add a MODBUS slave COM port ,I could connect to my motor but I didn't though. Codesys see the MODBUS COM port but deny to communicate with the slave, what is the problem??
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
With Modbus communication, you have to add a Modbus COM port to your device. To this COM port you have to add your Modbus serial master and to this master you have to add your Modbus slave device.
In the slave device you have to specify which variables you would like to read/write. You have to create "channels" for this.
No programming is needed for this, just configuration.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I don't fully understand what are these channels, is there a similar example because i'm a little confused, my purpose is to send some basic commands i assume in binary mode or in bits...but when i try to run through codesys doesn't recognize the MODBUS slave COM port...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Can somenone explain me how to use the read offset command in channel configuration of a slave COM port...I think this is my problem, that i don't send write values
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Maybe the reason is that you don't use the variables in your application. In that case they are not updated by the Modbus I/O driver.
What you could do, is go to the tab "ModbusGenericSerialSlave I/O mapping" and select: "Enabled 1 (use bus cycle task if not used in any task)". See the lower righthand corner for this setting.
This causes the I/O driver to update also the variables which are not used in your application.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Tim thank you for your replies, I tried this option but nothing happened, I am searching how to send a command via a channel that establish to my motor...I think that I should send to it by the write register option but i don't know how
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ask the vendor of your Modbus slave device which Modbus register should be written to and which values are valid.
Create a channel for this register (or registers) in the Modbus slave.
Write the "value" to the I/O variable which is created in your IO mapping.
Easiest is to create a cyclic write channel which updates the output variable cyclically.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello everyone !
I am a new user in codesys and I want to communicate with a stepper motor i've got via serial port, can everyone guide me? The exact things I want to do is to send some commands for example rotate via my com port...I simply cannot find the way to connect with the com on my computer which is connectd to the motor
THanks in advance
Add the "use case library" Serial Communication.
See the help for CAA Libraries > CAA_SerialCom.library. This contains explanations and an example.
You can also go to the store and download examples:
http://store.codesys.com/serial-com.html
http://store.codesys.com/serial-com-with-visu.html m
Thanks for your reply, well let me tell you what I've tried so far, I made a new project and I put a MODBUS COM and MODBUS Master COM port, then I thought that if I add a MODBUS slave COM port ,I could connect to my motor but I didn't though. Codesys see the MODBUS COM port but deny to communicate with the slave, what is the problem??
With Modbus communication, you have to add a Modbus COM port to your device. To this COM port you have to add your Modbus serial master and to this master you have to add your Modbus slave device.
In the slave device you have to specify which variables you would like to read/write. You have to create "channels" for this.
No programming is needed for this, just configuration.
I don't fully understand what are these channels, is there a similar example because i'm a little confused, my purpose is to send some basic commands i assume in binary mode or in bits...but when i try to run through codesys doesn't recognize the MODBUS slave COM port...
Can somenone explain me how to use the read offset command in channel configuration of a slave COM port...I think this is my problem, that i don't send write values
Maybe the reason is that you don't use the variables in your application. In that case they are not updated by the Modbus I/O driver.
What you could do, is go to the tab "ModbusGenericSerialSlave I/O mapping" and select: "Enabled 1 (use bus cycle task if not used in any task)". See the lower righthand corner for this setting.
This causes the I/O driver to update also the variables which are not used in your application.
Tim thank you for your replies, I tried this option but nothing happened, I am searching how to send a command via a channel that establish to my motor...I think that I should send to it by the write register option but i don't know how
Ask the vendor of your Modbus slave device which Modbus register should be written to and which values are valid.
Create a channel for this register (or registers) in the Modbus slave.
Write the "value" to the I/O variable which is created in your IO mapping.
Easiest is to create a cyclic write channel which updates the output variable cyclically.