LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use NI 9871 in scan mode?

Solved!
Go to solution

I have a controller NI cRIO 9024 and a module NI 9871.

I configure them as the following link.

http://digital.ni.com/public.nsf/allkb/16989C708E5AF2C1862578A90067D9DC

Could I use the VISA Write.Function, VISA Read Function to communicate with the device?

In fact, I've tried a lot, but not worked...

Should I only communicate the device via the FPGA code as the NI Example?

 

 

0 Kudos
Message 1 of 13
(7,711 Views)

Well according to that link you can use it in scan mode and you've found out how to configure the device for Scan Mode so where are you stuck? What is the actual problem you are having? What errors are you getting? What have you tried? Post your code.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 13
(7,706 Views)

Hi Sam_Sharp,

 

I'm very sorry about throwing this question without a VI and detailed description.

I have a power meter made from the local factory.

I connect it with the serial port(through a RS232 to RS485 converter) on the NI cRIO 9024, and use the following code to get the data.

 

20151130006.png

20151130009.PNG

 

Since I have a module of NI 9871, I'd like to move the cable to that module.

I dragged the VI to the target and selected the VISA resource name to ASRL2::INSTR.

20151130007.png

I reconnected the cable to the device.

20151130_182723.jpg

 

After running the program, it failed with a timeout error.

20151130008.PNG

I wonder if it is possble to use the VISA tools directly in the real time target.

Could someone give me some suggestion?

 

 

0 Kudos
Message 3 of 13
(7,645 Views)

From the screenshot you posted with the device connected to the cRIO, it looks like you are sending/receiving data from the device - but the data itself looks different. It looks like you're receiving the same data that you transmitted - are you sure you don't have your RX/TX wires crossed? Is there some kind of loopback happening? I guess the 232-485 converter expects the %03d to forward to the correct 485 address?

 

Have you tried using a VISA Test Panel in MAX to verify what happens when you send the command?


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 13
(7,635 Views)

Hi, Sam_Sharp,

 

Thanks to your suggestion.

In fact, the communication between the COM port of the NI 9024 and the device through RS232/485 converteris okay.

You can see I can get the data from the screenshot.

The problem happened between the port of NI 9871 and the device without the converter.

I've tried the NI-MAX, but the result is the same.

As a result, I'm still wondering if I can use the VISA toolkit to control the NI 9871.

0 Kudos
Message 5 of 13
(7,630 Views)

Yes, you can - the article you posted originally tells you that you can use the NI-987X devices in Scan Mode.

 

Is your second screenshot where you get the timeout error from the 9871? It shows you are reading some data (but it is reading the data you are transmitting).

 

The timeout error will be because you are not reading the correct data. It reads the "007MEAS:VAL\n" and then stops because no more data is received. Do you have the cabling wired up as per the datasheet for the module, including the external power supply? http://www.ni.com/pdf/manuals/372277e.pdf


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 6 of 13
(7,620 Views)

Hi, Sam_Sharp,

 

Very thanks to your enthusiastic help!

Yes, the second screenshot is taken from the 9871, in fact, I have not implemented this module successfully.

I also tried to communicate with an ADAM module 4024 but failed either...(it returned the input string as well...)

I wonder if there is something wrong in my setup, but I've read the manual and I think I've done what the manual said.

20151201_083211.jpg

 

I connected an external power supply (24V) to the module, and separated the cable into two parts(purple & orange : +; gray & yellow : -) and connected them with the device terminals.

Is it possible there is something wrong with my code? But even the NI-MAX failed to communicate with the device...

0 Kudos
Message 7 of 13
(7,598 Views)
Solution
Accepted by topic author William1225

When you say the device terminals? Do you mean the device power terminals? Is it a 24V device?

 

For the 9871 to work, you only need to connect the power to the pins on the 4-way connector block at the bottom of the module. You also need to ensure you have your signal wires connected correctly - check the pin-out carefully, especially if you've wired the RJ11/45 connector to a custom device/connector.

 

Are you using a 2-wire connection or a 4-wire (full duplex) RS485 connection? I think there is a property node you can set you can set on the VISA resource to select this (and actually...now that I think about it - that might be the problem here):

2015-12-01_09-45-34.png


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 8 of 13
(7,579 Views)

Hi Sam_Sharp,

 

You are awesome!!! It works when I added the property node of Wire Mode!

Very appreciated to your help 😄

20151202001.png

 

I was confused that I didn't add the property node but it works in the host computer(Laptop or personal computer).

I wonder if it is something about the RS232/485 converter to make this not necessary to implement the property node.

0 Kudos
Message 9 of 13
(7,563 Views)

@William1225 wrote:

 

 

I was confused that I didn't add the property node but it works in the host computer(Laptop or personal computer).

I wonder if it is something about the RS232/485 converter to make this not necessary to implement the property node.


Yeah - it's a 'device' property - if you're using a 232/485 converter then it's this that does the appropriate 2-wire/4-wire conversion.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 10 of 13
(7,539 Views)