annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

Read error using RS232

Risolto!
Vai alla soluzione
 

Hi 

I found the common problem when I want to record from a multimeter (RadioShack 22-168A) with RS 232. I searched two days, but I can not solve the problem.

The serial port and the instrument are working which had been checked by Basic Program. See below

10 OPEN "COM1: 1200, N, 7, 2, RS, CS, DS, CD" AS #2
20 A$="D"
30 PRINT #2, A$
40 IN$=INPUT$(14, #2)
50 PRINT IN$
60 CLOSE #2
70 END

Note: Give the meter the D command to active data transmission

But When I try to operate it by LV 8.0, there is a read error

 

When I increase the timeout, the error code changed to -1073807298.

 

 

I also tried to type "D", "D/r", "D/r/n" and so on, but it was not working.

 

 

 

 

Scarica tutti
0 Kudos
Messaggio 1 di 38
6.625Visualizzazioni
The correct syntax for adding a carriage return and/or linefeed is "\r", not "/r". Note that the string should be in '\' codes display mode. Open the "Basic Serial Write and Read" to see this.
0 Kudos
Messaggio 2 di 38
6.615Visualizzazioni

I'm sorry. I did a mistake when I type word for this message. Actually, I type the correct syntax in LV, "\r", "\n" or "\r\n"

 

The problem did not be solved .

0 Kudos
Messaggio 3 di 38
6.606Visualizzazioni

Are you SURE you actually sent a carriage return character on you VISA write?  We can't tell from your screenshot because if the Write string is in Normal display, you won't see the carriage return.  If it is in \code display like SMercurio said, it would show up as D\r.

 

In NI spy it would show up as 17.

VISA Write ("COM1", "D." ) Process ID : 0x00000144        Thread ID: 0x00000664 Start Time: 15:50:29.610      Call Duration 00:00:00.015    Status: 0 (VI_SUCCESS)

 

Notice D.  where the period represents an unprintable character.  If \r doesn't work, try \n

Message Edited by Ravens Fan on 10-28-2008 03:54 PM
0 Kudos
Messaggio 4 di 38
6.598Visualizzazioni
With the Advanced Serial Write and Read, you do not place a \n or anything else in the string control and you do not need to set the string control for '\' Codes Display. What you do have to do is make true the 'End write with termination character' and set the termination character to the correct hex value.
0 Kudos
Messaggio 5 di 38
6.585Visualizzazioni

The problem is also here.

I have tried to use Advanced Serial writr and Read.VI and Basic serial write and Read.Vi, and typy in D, D\r, D\n, D\r\n as well as  Dennis Knutson said set 'End write with termination character' as A or D. But all of them are not working.

 

It return -1073807298 when I used Basic serial write and Read.Vi , and return -1073807339 when I used Advanced Serial write and Read (time out 20000ms)

0 Kudos
Messaggio 6 di 38
6.565Visualizzazioni
Is there any body can help me?
0 Kudos
Messaggio 7 di 38
6.545Visualizzazioni

It's been a very long time since I've use basic code. What are those switches after the stop bits (RS, CS, DS, CD)? Are those to use or not use the handshaking lines?

 

For a sanity check, you should try using a common terminal emulator program such as Hyperterminal and see if the communication works there.

0 Kudos
Messaggio 8 di 38
6.533Visualizzazioni

Could you show me how to do in detail

 

Thank you

0 Kudos
Messaggio 9 di 38
6.530Visualizzazioni

Start>Programs>Accessories>Communications>Hyperterminal.

 

This is a standard windows program that has been around for years and years.

 

 

You also did not answer the question about the switches in the basic program. Is this a program you wrote or got from somewhere?

Message Edited by Dennis Knutson on 10-29-2008 08:40 AM
0 Kudos
Messaggio 10 di 38
6.524Visualizzazioni