Jump to content

A strange thing with my serial read program!


arteta

Recommended Posts

I am trying to send some streaming data from my Microcontroller to LabVIEW (through Serial port) and draw a waveform graph. In this case a send a string from A-Z and so on. It works (even though i have to make sure the LV run first and then the uC, this is to avoid wrong frame reading) . But a strange thing happen when i disconnect the uC. The VI still reading (from A to Z as normal). I try to stop and run it again but it still reading (and so does the graph). I close the VI and open it again, oh no, still running like hell :blink: . The whole thing only stop only after i open Hyperterminal or Basic_read_and_write.vi and read something. By the way, this problem does not occur on Hyperteminal or other reading application. What was happen with my program?

As you can see below, i tried to use whileloop to do this, is this the right structure?. And how can i get rid of the wrong frame reading problem. I am thinking of sending some command from LV to uC to have it start sending data. How can i do it. Thank you alot for any helping. :headbang:

post-4445-1145237493.jpg?width=400

post-4445-1145237505.jpg?width=400

Download File:post-4445-1145237515.vi

Link to comment
I am trying to send some streaming data from my Microcontroller to LabVIEW (through Serial port) and draw a waveform graph. In this case a send a string from A-Z and so on. It works (even though i have to make sure the LV run first and then the uC, this is to avoid wrong frame reading) . But a strange thing happen when i disconnect the uC. The VI still reading (from A to Z as normal). I try to stop and run it again but it still reading (and so does the graph). I close the VI and open it again, oh no, still running like hell :blink: . The whole thing only stop only after i open Hyperterminal or Basic_read_and_write.vi and read something. By the way, this problem does not occur on Hyperteminal or other reading application. What was happen with my program?

As you can see below, i tried to use whileloop to do this, is this the right structure?. And how can i get rid of the wrong frame reading problem. I am thinking of sending some command from LV to uC to have it start sending data. How can i do it. Thank you alot for any helping. :headbang:

In your VI you read only 10 bytes/s. My bet is that the uC sends data at much higher rate and fills the input buffer that the VI continues to read even when the uC is disconnected. When you swap to HT the serial port is reinitialized and the input buffer flushed.

As for the framing problem, indeed it is the solution that the uC sends data only after a command or that to use some HW handshaking.

Link to comment
In your VI you read only 10 bytes/s. My bet is that the uC sends data at much higher rate and fills the input buffer that the VI continues to read even when the uC is disconnected. When you swap to HT the serial port is reinitialized and the input buffer flushed.

As for the framing problem, indeed it is the solution that the uC sends data only after a command or that to use some HW handshaking.

Yes, u win your bet :thumbup: . I've tried to configure the serial transfering speed and it worked. Thank U very much. And now about the handshaking :D . I would like to do a software handshaking so i send a command character to uC and the uC send a byte of data back. It works with no framming error. But, the annoying thing is i have to stop the VI then run it again each time i want to send the command character. I had thought about putting the writting blocks into a case or a while structure but it did not work when i push the boolen button. I need a button that send a character each time i press it, how can i do it. Thans for help me one more time. :)

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
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.