LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial port reading error

"My device is attached on serial port(COM1). I wrote a code and in this first I pass one command to the device( write comand on device) and then read it. I checked settings for serial port but didnt find any thing wrong with that. but it's always giving me the error " -1073807339. VISA Read in testing.vi"..
don't know what's the problem. I changed time out by a factor of 100 but still..My device is "NEWFOCUS's model 8753" I am also attaching the file. So you can have a look at the code too.
I tried time out too. and I tried various termination character too. though in the manual they didnt mention any termination char.

hopefully I will get a quick solution!1


regards
priiyank"
Download All
0 Kudos
Message 1 of 7
(3,745 Views)
Does your device work with hyperterminal?

In the LLB you will find a Serial Communication.vi which does sending and receiving. In this VI you can see they will append a CR at the end of the command and will make the character "<" the termination character.

Does this VI work with your device?

Waldemar
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
0 Kudos
Message 2 of 7
(3,745 Views)
while I send the messege I dont get any error but when I try to read it I get an error. I tried this llb and also I tried my own code but both are not working ...
0 Kudos
Message 3 of 7
(3,745 Views)
Priiyank,

This VISA error usually corresponds to a timeout when reading. Since this VI will try to read from the input FIFO buffer of the communications port, you need to be sure that there is at least as many bytes available to read in the buffer as you specify as an input to the VISA Read. I recommend that you use the "Bytes available at Serial Port" VI as the input to VISA read.

It could also be that the command you are sending to the instrument will not result in data being returned to the computer. Read the 8753's manual carefully and review a description of how each command works. In this case, then there is nothing to read and calling VISA read will cause a timeout. Also, there should definitely be a delay between writing and reading. Try some
thing large at first (maybe several seconds).

And finally, make sure (as you have mentioned) that you are sending the correct termination character to your instrument. If the device is not seeing the end of message character, it may just be waiting for it before replying with the data you expect.

I hope this is helpful.

Alan
Applications Engineer
National Instruments
0 Kudos
Message 4 of 7
(3,745 Views)
Does your device respond to hyperterminal?

This is a really essential test. If it responds you know the port, the cable and the device is OK.

Insert a serial analyzer or use another PC to see if your PC is really sending the characters over the cable.

Is the cable OK? I have seen one commercial cable which was not connected correctly (one wire was broken).

Waldemar
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
0 Kudos
Message 5 of 7
(3,745 Views)
oh I didn't. I tried testing it but I really am not sure hownto test by hyperterminal. Sorry to be sound stupid but can you guide me in this step by step. Just assume I am stupid layman and need every single step< even it's obvious to you>. I would really appreciate that.

regards
priiyank
0 Kudos
Message 6 of 7
(3,745 Views)
hi all,

Sorry to bother you all well and for myself too. I found out that nothign was wrong with the program or with serial port or anything. It's just that I can't talk to my device in MCL command format which I was using and this thing was no where in the stupid manual. I am so sorry to bother you guys and to myself too.

anyways now I can talk to my device and it's working very well.

but I do need your help. coz now I can talk to the device by using an Application< I guess it's in DCN or visual basic> well I really don't know whats DCn.

BUt I need to make program in LabView So can anyone help me to figure out that how can I run this application file from the inside of another LV program and change t
he parametersof this program.

I am attahcing the file and here is the summary I have to do by using this appplication
1. power up the motor and everything but dun run.
2. move it by smallest possible displacement.
3. hold it there Take the data by using some other program.
4. pass the data and no. of steps to the computer.
5. repeat step 2 to 4 until I moved by my desired distance.
6. move backwards ( by changinf position to similar -ve no.) and repeat step 2 to 4.
7. stop the program.
8. Move to my desired position.( that I will get from position vs. data graph).

thanks for all your help.
In anticipation of quick reply

regards
Priiyank
Download All
0 Kudos
Message 7 of 7
(3,745 Views)