Jump to content

who can help me ?


Recommended Posts

Quixote,

Did you connect com1 with com2 over a serial cable so called "null modem" (with rx pin on one side tied to tx pin on the other side vice versa). Such cables can be found in every computer shop or you could build it yourself if you're confident with soldering (just "google" the net for instructions).

Another point would be to configure com2 before sending the data. Changing configurations on a port usually also clears the in-/output buffer.

Also make sure both com-ports have the same baudrate, data- and stopbits, flow control.

If it still doesn't work also wire the error code output of the serial-VIs to the "General Error Handler.vi". So you get an idea where the error occurs and what error it is.

Didier

p.s. For correct LV wiring rules ask Michael Aivaliotis, he is the better "picky b...." :D

Link to comment

Quixote,

Your code works if you have identical settings for each port (and you have followed Didier's advice on cabling). Make sure you hit enter at the end of your "String to Write" - your serial read wants this \n as a termination.

If I can make some suggestions:

1. Consider using the VISA Serial routines as they have the following benefits:

-VISA routines provide a common interface to serial, GPIB, and VXI, so learning one helps if you use one of the other buses.

-VISA routines give you enum inputs so you can select "COM1", "COM2" instead of 0,1.

2. Consider using a state machine approach to your design to better control the flow of data through the serial port - without hardware flow control, the data can arrive at the destination port in a nondeterministic way. As a result, you may "miss" the data at the buffer. Using timing delays may work, but can fall apart if you upgrade to a faster PC etc. I have attached my crack at it - the machine initiates itself when it is first launched. Then is sits doing nothing until you hit the GO button. At which time it writes to the serial port you specify, and then reads from the destination serial port. Then, it sits "Doing nothing" unless more data shows up at the destination serial port or you hit go or stop. If you like this style, consider getting Conway and Watts, "A Software Engineering Approach to LabVIEW". (further influence from that Michael Aivaliotis guy...)

3. If you are looking for other examples, check out those that come with LabVIEW - click, HELP, FIND EXAMPLES, and the search through the resulting dialogue.

Cheers,

James

Download File:post-365-1090505063.vi

Link to comment
p.s. For correct LV wiring rules ask Michael Aivaliotis, he is the better "picky b...." :D

1198[/snapback]

Hey! I heard that! :shifty:
1. Consider using the VISA Serial routines as they have the following benefits:

-VISA routines provide a common interface to serial, GPIB, and VXI, so learning one helps if you use one of the other buses.

-VISA routines give you enum inputs so you can select "COM1", "COM2" instead of 0,1.

1201[/snapback]

Actually James, If you look at the sub-vi's that Quixote is using, you will see VISA there. Presently this is the only way to use serial. As far as the coding style your improved re-write is great! Of course it can always be done better... ;)
Link to comment
Actually James, If you look at the sub-vi's that Quixote is using, you will see VISA there. Presently this is the only way to use serial.

Oh. But what he is using must be some legacy wrapper(?) - you still can't pop-up on a terminal and create an enum constant. I don't like remembering if COM1 is port 0 or port 1. :blink:

As far as the coding style your improved re-write is great! Of course it can always be done better...  ;)

1205[/snapback]

Yeah, my best code will probably always be the next bit I write -especially if it is after an Ontario LAVA user group meeting... :worship:

Do you have any suggestions for handling timing at the serial port - is there a way to generate an interrupt for data received etc?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.