02-16-2021 08:26 AM
I have created a program where I need to check the RS485 connection with a modbus device. For this I need to configure the modbus device and then read data out of the device and see if it is working correctly. The RS 485 communication to the modbus device is coming from com port 8 of an NI PXI 8431/4. So currently I have set the com port baudrate to 38400 in NI MAX and I ran the program, the program works fine. I just have to give the same baudrate while configuring the modbus device. But now the thing is the device is capable of working at multiple baudrates and I need to check that. So I have to change the baud rate of com 8 of the NI PXI 8431/4 and everytime I check I cannot go back and forth to NI MAX to change baud rate. So I need to change the baud rate of the com port 8 of PXI 8431/4 programmatically in LabVIEW. I tried using the VISA configure serial port to change the baud rate, but it is not working. How do I change the baudrate of the com port of NI PXI 8431/4 programmatically in LabVIEW. If you want more clarification I have attached the program. Kindly go through the program and see. Is there any NI PXI 8431/4 driver that helps me change its baudrate. Thanking You.
Solved! Go to Solution.
02-16-2021 09:02 AM
You don't need special drivers to do this setting.
Your VISA configure serial port is pointless, though, since the Plasmionique's Open Serial Session would initialize the port on its own later.
Now the question is; why this vi does not initialize the serial port?
Is there any error going in or out of the Open Serial Session vi?
02-16-2021 09:30 AM
It looks like you there is a VI in your library for setting up the port. So you don't need to configure that beforehand. Another concern I have is that you have a wait on the top level diagram and no loops. If you are using the Run Continuously, you need to stop. That is meant for debugging simple algorithms, not instrument communications. You should have a loop to continuously read and/or write. This way you only need to do the initialization once before the loop and close everything once after the loop.
02-16-2021 09:53 AM
You don't need special drivers to do this setting.
Your VISA configure serial port is pointless, though, since the Plasmionique's Open Serial Session would initialize the port on its own later.
Now the question is; why this vi does not initialize the serial port?
Is there any error going in or out of the Open Serial Session vi?
02-16-2021 10:03 AM
Are you sure you are correctly changing the baud rate on your device? Maybe you are missing a device restart?
02-16-2021 10:44 AM
I am not an expert in Modbus. Could you clarify when u said my device needs a restart.
02-16-2021 11:55 AM
Nothing Modbus-specific. Your program communicates over COM8 with a Modbus device.
To test different baud rates, you need to set those baud rates also on the slave device.
My question is: it's mandatory to restart the slave device to apply the new baud rate settings?
02-16-2021 12:33 PM
@pincpanter wrote:
Nothing Modbus-specific. Your program communicates over COM8 with a Modbus device.
To test different baud rates, you need to set those baud rates also on the slave device.
My question is: it's mandatory to restart the slave device to apply the new baud rate settings?
I agree this is something to look for. It is common for devices to need resetting or rebooting to take any new settings.
02-17-2021 04:05 AM
I have uploaded the new program which I did. Here the program is same as before with a small change. After configuring the Modbus using open serial session, i turn off and on the Modbus device by cutting power supply to Modbus. You can see it in the program. Is that what you meant, but still no change. I am only getting output on baud rate 38400 and on different baud rates it is showing error.
02-17-2021 04:16 AM
I apologize for me insisting on that, but can you let us know what slave device you are using?
How do you change the baudrate on that device? Jumpers? Microswitches? Menu buttons?