Problems with the simple serial communication.

I followed a tutorial online to start learning basic communication series. The involved tutorial shorting pins 1 and 3 on port 1 Comm and write a simple program (attached). I've edited it a bit, the program to see varied results I get when trying to write and read a simple sentence via a serial port.

Could someone explain what causes the kind of result shown in "Serial Comm example.png"? I think it has to do with timing. Why would be transmitted only the parts of the sentence?

Thank you

Sarah

sarahzig wrote:

The involved tutorial shorting pins 1 and 3 on the Comm 1 port

What should be pins 2 and 3?  On a standard serial port DB-9, pin 2 is the receive and pin 3 is the transmission.

Now for your code...

1. move the Serial Port to be before the loop to set it up.  Simply configure the port once.

2. close the port after the loop.

3. managing your error after closing.

4 stop your loop on an error or the stop button has been pressed.  You will need a RC in there.

5. no need to Flush Buffer function.  Remove it.

6. using the bytes to the Port is a dangerous thing.  It introduced all kinds of race conditions that are interesting.  Instead, say VISA reading to read the number of bytes that you expect to read.

6a. Moreover, don't forget to send a character to end of line at the end of your data and all the number of bytes to read something a lot more than you ever expect read.  The VISA read will stop reading when he a) sees the number of bytes, it was said to read, b) sees the stop character (currently enabled and set to a line break, which is part of the end of line), or c) the time-out occurs.  Whichever comes first.

7. with 6, the wait is no longer necessary.

Tags: NI Hardware

Similar Questions

Maybe you are looking for

  • BDX1200 plays not DVD

    At this player for a couple of years and it is all great and all, but recently, it does not read the DVD Blu - Ray is very well, but the largest part of my movie collection is now only so many beermats. I have updated the firmware and cleaned the len

  • Definite integral of matrix (50g)

    Hello Integrating an INTVX matrix works well. Is it also possible to calculate the integrals (for example I want to integrate all the components of the matrix with x ranging from 0 to 1)? Concerning

  • Remove PDF security

    Hi all, we have a HP Office Jet Pro 8600, running on a Windows 7 Professional (attached USB) Workstation. We found that when a file is scanned into a PDF file of the scanner, it has an option of security enabled by default (see screenshot below). Is

  • TZ300W - how to use the policy monitor host VPN network

    is easy to create the network to any host Wan monitor policy. But if I want to monitor VPN host, how can I do...?

  • I see this watermark on my desk that says Test Mode Windows 7 Build 7601. My Windows 7 is genuine. Why am I seeing this?

    Test Mode Windows 7? OK, I see this watermark on my desk that says Test Mode Windows 7 Build 7601...  I tried to get help for this Microsoft response team, or what ever and, apparently, the guys do not understand what I was talking about... My window