Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

cRIO modbus

Hi there,
 
I am using a cRIO 9004 RT system and trying to communicate cRIO RT with PC. I have tried two LV 8 projects and neither of them worked properly. Also when I ran the second one Labview application crashes and it is closed. I do not have much experience in communication and need some help for this topic.
 
For the attached projects what is the problem with the modbus protocol or the variables?
 
 
Download All
0 Kudos
Message 1 of 16
(7,976 Views)

MuratG:

What do you mean by trying to communicate with your PC?. Are you getting errors when you run your applications?. Please provide me with more information.

Thanks,

Rudi N.

0 Kudos
Message 2 of 16
(7,954 Views)
I tried to send data (numerical value) to cRIO working standalone and reading the registers of cRIO. It is an HMI code for the RT system. I chosed the MODBUS (ehernet) for the communication protocol.
 
I have created a new library and a modbusslave server under cRIO RT and created variables under modbusslave. When I select the "Deploy All" command from the right-click menu then the LabVIEW is closed. Simply I need a basic code that writes to the registers of cRIO RT and reads the data stored at the RT registers.
0 Kudos
Message 3 of 16
(7,949 Views)

MuratG:

I unzipped your project files, right-clicked on "Deploy All" and LabVIEW did not close. Furthermore, if you are trying to access the registries of your cRIO, you can easily achieve this using shared variables. After creating your modbus I/O server, you can bing registries to Shared Variables, and changing the values of Shared Variables on the host side, also accepts the registries on the cRIO. Please take a look at the attached project file. I hope it makes sense.

Regards,

Rudi N.

Message 4 of 16
(7,923 Views)
Hi Rudi,
 
Thanks for your reply. May be LabVIEW because of a conflict at Win XP. I am going to check this problem on another PC. I cannot open the sample code because I have LabVIEW 8.0 installed and the sample is in 8.2 version. Can you post the 8.0 version of the code.
 
Thanks
 
Murat
0 Kudos
Message 5 of 16
(7,918 Views)

Murat:

What do you mean by "there might a conflict with XP"?. I have saved the project so that you can open it using LabVIEW 8.0. Please let me know what you find when you try it on a different computer.

Regards,

Rudi N.

0 Kudos
Message 6 of 16
(7,882 Views)
Hi Rudi
 
The windows problem seems solved when I tried the code at another PC.
Your code worked fine but I coldn't find the way to read the values inside RT. Can you attach a RT code that reads the numerical test variable and send its back with multiplying by 2?
 
Using the modbus library I have written a sample code. The PC host writes to a register of RT and RT reads it, multiplies by 2, writes the result to another register. The PC host vi reads the second register. When I build the project and made the RT code stand alone application, the PC host vi worked without errors but the result at the second register is always 0. What is the problem with the project?
 
Thanks
0 Kudos
Message 7 of 16
(7,864 Views)
MuratG:
 
Please take a look at the attached zip file so that you can see how to pass data back to the registers. If I understand correctly, does your application work in the development environment? and returning zero when built as a standalone?. Please let me know so that I can further troubleshoot it. Also, are you able to ping the PLC ?
 
Regards,
 
Rudi
 
 
0 Kudos
Message 8 of 16
(7,841 Views)
Hi Rudi,
 
The code is in LabVIEW 8.2 version and I have LabVIEW 8 installed. Can you send me the code in LV 8?
 
For the problem let me tell the job. I am trying to send data to cRIO 9004, inside cRIO RT there are some instructions controlling FPGA, calculations etc. The results are written in somewhere (modbus or shared variable). The host PC vi is going to send data to cRIO RT and read some other registers. Let me give you an example. Host PC writes 3000 register of cRIO RT via modbus. cRIO RT reads #3000 register, multiplies it by 3 and writes the result to #3001 register. The host PC reads #3001 register of cRIO. This operation works continuously. At the final stage cRIO is going to work stand alone and PC host VI is going to run as a self executable program.
 
Thanks
0 Kudos
Message 9 of 16
(7,835 Views)
MuratG:
 
You should now be able to open the attached file using LabVIEW 8.0. Please take a look at the attached file and see if it answers your problem.
 
Regards,
Rudi N.
 
0 Kudos
Message 10 of 16
(7,807 Views)