LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a terminal program (similar to windows hyper-terminal but more powerful)?

I am a new Labview user, Im trying to write a monitor program for use with uControllers. The main problem I cant seem to get over is to have a section of the screen where I can type in commands (that are sent only once!) then recieve a reponse from the uController directly under the command. Has anyone tried this?
I am using the VISA read/write functions for serial communications, are these interrupt driven?, does anyone have ideas on this.
Thanks in advance
Dave Zdanowicz
0 Kudos
Message 1 of 10
(6,213 Views)
Well, this could seem a bit complicated, but is the sollution which came to my mind. To use the same control to give and receive instructions, you must use local variables, or else you'll need a control to give instructions and an indicator to receive them. To avoid having the second, you could use a simple string array control. You could read the first element until something is written, and then wait for an answer, if that exists, place it in the array using a local variable, but in the second element. So, the next command should go to the third element, and so on... this forces you to have an exhaustive control of key focus, perhaps avoiding mouse click on this control. You can finish command entering hitting return (or a control). Hope I made myself clear, and that
my explanation meets your needs.
0 Kudos
Message 2 of 10
(6,213 Views)
Hi Gorka
Thanks for your suggestion, it sounds very complex, a person like myself could get knee deep in "poo" trying it I feel! Thanks for your time
Cheers
0 Kudos
Message 7 of 10
(6,213 Views)
Hi Dave,

I send you a vi that i developed time ago that does this:
- Configure the serial port (the default settings can be easily changed)
- Write a command string
- Wait for a determined time (wait for answer)
- Read the string sent from the remote unit

All these operations are done each time you run the vi, in your case you can modify it to embed it as a sub-vi and run it each time you complete the command string, or you hit a control button, ecc...
As you see it is developed with the standard serial functions, but if you know VISA you can easily transform with VISA functions.

Let me know if you need any help.

Regards,

Alberto Locatelli
0 Kudos
Message 3 of 10
(6,213 Views)
Hi Alberto,
Thanks for your time but unfornuately I require a fair bit more info, I have attached what I have already done (commands are in a macro format) but what I would really like to do is interleave the commands with the responses on one screen. The other problem still not answered is if the serial functions are interrupt driven (I seem to be losing data the way I have have it configured)
Cheers
0 Kudos
Message 5 of 10
(6,213 Views)
Hi,
Doesn't your device maybe have an "echo"? Than, I guess, the easiest
way would be to have two independently running VIs, one of which is
repeatively checking the serial interace for incoming bytes and
eventually displaying them in an apropriate indicator (e.g. a string
indicator where all incoming new characters are appended to the old
string via a shift register of a loop). The other VI then could be
responsible for sending commands.
It did something similar just resently. It works quite well. The
command sending VI had some buttons to send kind of macros (several
commands, often needed in combination, bundled together) and
furthermore checked the keyboard with the keyboard VIs from the NI
pages for additional inputs from the user, which were then just sen
t
to the serial interface byte by byte.

Regards

Arno

On Tue, 17 Apr 2001 16:20:10 -0700 (PDT), Dave Z wrote:

>I am a new Labview user, Im trying to write a monitor program for use
>with uControllers. The main problem I cant seem to get over is to have
>a section of the screen where I can type in commands (that are sent
>only once!) then recieve a reponse from the uController directly under
>the command. Has anyone tried this?
>I am using the VISA read/write functions for serial communications,
>are these interrupt driven?, does anyone have ideas on this.
>Thanks in advance
>Dave Zdanowicz
0 Kudos
Message 4 of 10
(6,213 Views)
Hi Arno,
Most times it will have an echo but there could be times with no echo, Im trying to make a generic program to suit "all", if that is possible but you have given myself a few good ideas that could very useful, thanks
Cheers
0 Kudos
Message 6 of 10
(6,213 Views)
Hi Dave,
only now I saw your comment to my first answer.
I think your main problem is that you start the reading from serial buffer whenever there is some bytes in it.
I modified your vi so that when bytes are detected, a delay is added to let the transmitter complete the message.
During this time the transmission of your commands is inhibited.
You can determine how long the delay has to be fixed only with some communication test, remember to be a little conservative.

Let me know if it works.
Regards,
Alberto
Message 8 of 10
(6,213 Views)
Hi Alberto
Thanks for the mods in the code.
It certainly helps in sending only one packet of info to the serial port but for some reason, I still intermittantly looses data returning from the micro? Having said that, it would seem to be a lot more reliable than my code. Still my big question on if the serial function is interrupt driven is un-answered, does anyone know?
Thanks again for your time Alberto
Cheers
Dave Z
0 Kudos
Message 9 of 10
(6,213 Views)
Back again Alberto
I have attached a modified version of the "VI" code, I found a keyboard routine written by a NI enginner that I placed into the code, that has been very useful, but just to show what I mean about loosing data Ive also attached two extra files, one captured by hyper terminal (with correct response) and another by the "VI" in question, if you compare the two you can see the "VI" is loosing at random a fair bit of data. The baud rate is only 9600 for this micro, this is why I keep asking about interrupts. One thing noted though, with the old serial drivers, there was a buffer size that could be set but with the VISA drivers there does not seem to be such a thing. More reading I guess
Cheers
Dave Z
0 Kudos
Message 10 of 10
(6,213 Views)