I'm developing a project by NI cRIO 9024 and NI 9870 to implement the instrument control.
There is a power meter I can communicate with it by RS-232 and I've verified its function by notebook(Win 7 OS).
Then I'd like to use cRIO & NI 9870 to get the data from that power meter.
First, I did that work under Scan mode, and get the data successfully in the real time system.
(I don't why the broken wires is in the snippet, but it is surely run well in my computer)
Since I have to implement other function(such as PWM output, fan speed reading), and I have to implement my project under FPGA interface mode.
So I just deploy the chassis to FPGA interface mode and run the other program.
But I can't read any byte from the instrument, it confused me a lot.
Since I can get data under Scan mode, I believe the hardware(cRIO, module), the cables, and the power meter function well.
Do I miss something to set or to configure?
I really do not know why I can get data by NI 9870 under FPGA interface mode.
I'd like to update my situation.
I found that the problem happened to my specific instrument(Watt meter, DW-6163, Lutron.inc).
I used a data logger(Keysight 34970A) and tried to communicate it by NI 9870, it worked either under Scan mode and FPGA mode. By the way, I used the property "Is Connected" to see if it is really connected with the instrument. It is ON when I connected with Keysight 34970A.
But for the Watt Meter, I can't communicate it by NI 9870 under FPGA Interface mode, but it works fine under Scan mode. And the "Is Connected" is OFF under this situation.
I'm so confused about this problem, I'm wondering if the Serial signal from the Watt Meter is not standard or normal for the FPGA chip? It seems to be the hardware issue...
Does someone has the similiar problem and how to solve it?
First, there is no such thing as a "standard" communication protocol under RS-232. The voltages and framing are specified but the device manufacturer can do anything it wants with the data transmitted. Please read the manual for your device and determine how it communicates. Things like termination characters or parity can often cause failure to communicate.
Next, I have no idea what "Is Connected" means with the RS-232 port. For GPIB the port circuits can determine if something is connected.That is generally not the case for RS-232.
I do not have the FPGA module on this computer so I cannot see what the help says about that property.
The first thing I would check is what termination character, if any, is used by the device and is your 9870 configured to use it?
Very appreciated to your reply.
Since I can get the value by a notebook(Windows 7) and by a controller(Scan mode), I thought my RS-232 setting is no problem.
I've checked the manual(the attachment), and it is just to get 14 characters to convert them to the physical values.
However, I still do not realize why I can communicate with that watt meter by notebook(Windows OS), and by the controller(Scan mode), but failed in the FPGA mode.
Like many instruments that manual is woefully inadequate. It does not specifiy exactly what it means by a "digit" or what the D0 and D15 End Word and Start Word values are.
However, once you figure out those things, the rest should be straightforward.
Typically "word" in computer systems refers to multiple bytes but that seems unlikely in this situation. If "digit" means a byte representing 0, 1, 2,..., 9, then the possibilities for Start Word and End Word are very limited and uniquely identifying the message framing may be difficult. If they use some "non-digit" characters like STX or CR or LF, then the situation becomes much easier.
Since it works in some combinations, I would not be surprised if the End Word was a carriage return or line feed character.
Configure Serial Port (at least on desktop OSes) by default enables line feed as termination character. If the actual termination character is different, then the read will timeout.