08-10-2011 11:11 AM
I am using Visa serial read and write commands to communicate with a products communication bus. The bus in a 3 wire RS-485 bus and has 3 terminals that can read and write to the bus (My pc, User interface board, and main PCB). I am using a 485 to 232 converter and then a 232 to usb converter to communicate from my pc.
The user interface board and the main PCB are constantly sending messages back and forth and my labveiw program has no problems reading the messages and picking out the data bytes I need.
The problem I am having is that in labveiw I can't find anything that tells me it is clear to send a message from my pc to the bus. None of the VISA wait on event options seem to work.
08-11-2011 01:50 AM
Hi,
As far as I know there is no collision detection at a RS-485 interface.
Normally the protocol will handles this.
Or you can switch to 4-wire RS-485 so you can operate in Full-Duplex.
Can you tell a bit about your application ?
Kees
08-11-2011 08:11 AM
Well, the User inteface has two periodic messages that are sent every ~100ms and they get an immediate response back from the main PCB.
I am trying to use labveiw to stuff an additional Diagnostic message and a response in that 100ms window all well reading and decoding all the messages on the bus.
Essentially the application will tell the user interface to enter a test mode, and allow my labveiw tool to issue commands to the user interface which will then communicate with the main pcb.
So far I have tried sending my message as soon or shortly after I see the last byte of a response message no luck, I have also tried checking to see if the bus is empty (using visa property bytes at port) and no luck either. Every once in a while both methods end up causing a framing error in my read loop thus a collision occurred.
08-12-2011 01:55 AM
If I understand correctly there is a second application running that communicates with the port.
In that case I don't think it will work. I am even surprised that you can access the port with the other application running.
08-12-2011 08:11 AM
Not two Labveiw applications, there are two PCB's (User interface board and main board) and they communicate normally with each other. Now I'm writing a single labveiw program to communicate with the User interface and monitor all of my feedback messages normally on the bus
08-12-2011 09:26 AM
OK, I (think) I understand.
The way you tried it is, I think, the best option.
Maybe you can look for a device answer rather then waiting till there is no data on the line.
If you can detect the beginning of a message previous to the 100msec pause you can start (maybe add a little delay) your communication. In that way you can start directly at the beginning of the 100msec window.
08-12-2011 10:13 AM