09-13-2017 12:52 AM - edited 09-13-2017 12:54 AM
I want to receive 9 bit serial data with parity bit as 9th bit. The problem is I am unable to get Parity error in Ni Visa Read. I've tried with different Visa Versions but no Luck. I only get a warning message 1073676294. I've attached the vi please check and update.
09-13-2017 01:11 AM
Your VI does not make too much sense to me. It could help if we know what kind of hardware you try to connect? Do you have a manual explaining the communication interface, like serial type, termination characters, etc?
Why do you use two serial ports , are there two different units you try to communicate?
09-13-2017 02:02 AM - edited 09-13-2017 02:13 AM
Well I am trying to Receive Rs-485 9 bit data using "USB to Rs-485 device". I don't have a manual about the communication interface.
For the reception of 9 bit data, I got the idea of Parity Error check from below link. but I am unable to get the parity Error.
http://digital.ni.com/public.nsf/allkb/3BDC7FF03541F772862564990057F919
For demonstration I am using a software to create Virtual Serial Communication Ports and trying to Send 9 bit data using Virtual Serial Port COM2 and Receiving it on another Virtual Serial Port COM3. I've also tried it with "Physical USB to RS-485 device".
Note: Com port 2 and 3 are virtually connected, i.e data sent on COM2 will be available on COM3.
09-13-2017 02:34 AM - edited 09-13-2017 02:36 AM
Hi Asfandyar,
usually the parity is not used to transport an additional data bit, it's a check for errors in the transmission!
To read a 9-bit value from a serial port you usually (need to) read two bytes.
I don't have a manual about the communication interface.
That's bad. That's really bad.
Such a manual s the first step when you want to program a communication tool for your device! (With "device" I don't speak about your USB-2-RS485 converter, but about this external device with the RS485 port!)
Get that manual, read it and follow it's instructions for the serial communication!
Note: Com port 2 and 3 are virtually connected, i.e data sent on COM2 will be available on COM3.
How do you do that? How do you connect something "virtually"?
09-13-2017 03:19 AM
Please check the Vi, I only want to receive 9 bit data as mentioned for reception in this link using a "usb to Rs-485" device.
http://digital.ni.com/public.nsf/allkb/3BDC7FF03541F772862564990057F919
09-13-2017 03:43 AM - edited 09-13-2017 03:50 AM
HiAsfandyar,
I only want to receive 9 bit data as mentioned for reception in this link using a "usb to Rs-485" device.
That AppNote is explicitely written for NI hardware.
Does your USB converter support all those features?
You still did not name the actual RS485 device you want to talk to! Are you really needing this (rather uncommon) 9 bit data transfers?
The AppNote is also talking about "external UART controllers:
2. Use a separate microcontroller that handles 9 bit frames:
Another option is to use a separate microcontroller with a UART that is made to handle 9 data bit frames and place it as an intermediary between the instrument and the computer. The computer would send two 8 bit data frames for each 9 bit frame, one with the first 8 bits, the second with the 9th bit, and have the UART reassemble this into one 9 bit frame to send to the instrument. Similarly the UART would receive a 9 bit frame from the instrument and return two 8 bit frames to the computer.
So did you try to read 2 bytes?
Btw. why don't you use the default parity enum that comes with VISAInitSerialPort? Why do you use your own ring constant?
09-13-2017 04:50 AM - edited 09-13-2017 04:55 AM
Yes, my usb support all features, I've tried with writing 9 bit serial data to that device and it works great. but in reception case I am unable to monitor or get the parity bit.
The AppNote provides two solutions for 9 bit reception. one is software based and another is external UART controller. I know this is possible with hardware solution, but I need to implement it in LabView.
I've also tried reception with 2 bytes at a time. but the AppNote says to receive one byte at a time.
Reception:
Is there a way to receive the overall protocol bit wise, i.e start bit, data bits, stop bit, parity bit etc into a Boolean array?
why don't you use the default parity enum that comes with VISAInitSerialPort? Why do you use your own ring constant?
I don't get it? where is VISAInitSerialPort? Please change the vi accordingly and update.
09-13-2017 08:56 AM
I guess you are using for your tests some serial port virtualization software like com0com (otherwise I don't know what you mean with virtual connection between COM2 and COM3).
If yes, are you sure that this software also emulates internal settings like parity and stop bits?
After all, with virtual ports both parity and stop bit checking make no sense.
09-13-2017 01:50 PM
09-13-2017 03:17 PM
Let me confess that I am totally confused.
When last I looked the start/stop bit(s) and parity are inserted by the hardware to frame and check a transmitted value and those are stripped off by the hardware when the value is received.
So...
Have you tried to set one physical comm port for even parity and then use it to transmit to another physical comm. port configured for odd parity.
That should return a parity error for every byte transmitted.
Ben