LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

modbus library for serial comm.

Solved!
Go to solution

jdownarzap2 wrote:

I am still not out of the woods yet (can't make example "work" on my 2 PC's).

By the way, since I am controlling when writes/reads happen the examples should work on ONE COM port as well (of one machine).

First 1 write (let's say on master), then I read on slave...

What's wrong with this picture?

 

jd


 

How do you figure you are able to control when the writes and reads happen?

 

In the master example, the master writes the request, then reads the response.

In the slave example, the slave reads the request, then writes the response.

 

So the overall flow is

1.  Master writes request.

2.  Slave reads request

3.  Slave writes the response

4.  Master reads the response.

 

The master will read something on the Com port as soon as it is available, which would actually happen to be the request it had just written out.  There is no way with the examples to have the two slave read/write operations interleaved with the two master write/read operations.

 

So you are trying to get this to work on 2 PC's?

What kind of errors are you getting?  Are you using a null modem cable between the ports on the two PC's?

 

Going back to message 1, you said you were able to get RS-232 to work between the two PC's?  But you can't get the Modbus examples to work?  Are they running as two separate VI's or do you have them dependent on each other in some way.  Perhaps you can post your VI's.

0 Kudos
Message 11 of 16
(1,505 Views)

I appreciate your time/help with this issue (I am/was under-educated).

Anyway, I use 2 PC's connected through a null-modem cable and original examples from the modbus.llb.

P.S. Please disregard RS-232 test (as it perteined to 1 port (same machine)).

The error I am getting is as follows:

 

Error -1073807246 occurred at VISA Write in MB Serial Transmit.vi:5->MB Serial Master Query.vi:4->MB Serial Example Master.vi

Possible reason(s):

VISA:  (Hex 0xBFFF0072) The resource is valid, but VISA cannot currently access it.

 

tx

0 Kudos
Message 12 of 16
(1,486 Views)
Solution
Accepted by topic author jdownarzap2

Check to make sure that no other program has the same serial port open.

 

You will know if you click on the control or constant where you define which serial port you want to use.  If the port is already open, you'll see an icon next to the name that looks like 2 computers and a checkmark.  If it is closed, then there will be no icon.

0 Kudos
Message 13 of 16
(1,482 Views)

Hi,

 

You're absolutely right! (I have had an OPC server opening the port (automatically)...a leftover from a previous/continous project...)

By the way the "icon" you're seeing (with 2 pc's and a checkmark when port is allready open) ... I don't see it in version 8.2

 

jd

0 Kudos
Message 14 of 16
(1,478 Views)

This is in 8.6, but I'm sure I remember it being there even back in LV 8.2 and prior.

 

Com1 is already open.  The other ports are not.

 

Message Edited by Ravens Fan on 11-12-2008 01:42 PM
0 Kudos
Message 15 of 16
(1,475 Views)

Well, I converted the I/O control to a constant (to replicate your picture)...and I don't see what you see (with COM1 already open I don't see the icon ...)

Anyway, it's not so important anymore (as I learned my lesson) but I have to agree it's VERY helpfull feature in general.

 

tx

0 Kudos
Message 16 of 16
(1,462 Views)