Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Connect hamamatsu c9525 to labview via USB port/communication error

YOU ARE RIGHT, DENNIS, IT WORKED!

 

command in Ni-Max :    R\r

Port opened by process "NIMax.exe" (PID: 984)

Request: 23.10.2014 10:53:38.21264 (+98.1106 seconds)

 52 0D                                             R.              

Answer: 23.10.2014 10:53:38.38864 (+0.1760 seconds)

 00 00 0A 00 01 00 05 01 01 00 00 00 2D            ............-

command in ni-max:    F\r

Request: 23.10.2014 10:56:01.85264 (+142.4481 seconds)

 46 0D                                             F.              

Answer: 23.10.2014 10:56:01.94664 (+0.0940 seconds)

 56 65 72 31 2E 36 30 20 43 39 35 32 35 2D 30 33   Ver1.60 C9525-03
 46 41 30 30 31 35 20 20                           FA0015 

 

 

Identical to what the hamamatsu control software did.

 

In the "return data" box I still get the error

Read Operation
Error

VISA:  (Hex 0xBFFF0015) Timeout expired before operation completed.

 

Regardless of that error, this is great .

 

Thank you , Dennis!

 

I shall now try to set up the voltage value and after that, if all goes well, create a labview VI with which to control the paramaters from a GUI.

0 Kudos
Message 41 of 62
(3,300 Views)

What kind of representation does visa use?

 

V\01\00\r + WRITE =>voltage bECOMES 100V

V\01\07\r =write =>107 V

V\01\08\r hit enter=> it becomes V\01\b\r    hit write => 108v

v\01\c\r ,enter, becomes v\01c\r  write=> 199v ????

 

what is this?

00A=65

00P=80

 

so it uses a combination of ascii characters

until 7, where dec,hex,oct are identical it's ok

 

101v =01\01

107v=01\07

then

108v=01\b  ?

109v=01\t

 

180v=v\01P\r  P=80ASCII

165v=v\01A\r  A=65ASCII

133v=v\01!\r  !=33 ASCII

 

HOW can I work with this?

how do I set the representation to hexadecimal ?

 

 

I can precisely read/open HVout/close the source.

How do I create a virtual instrument with these commands?

Set up a panel with 3 knobs and a VISA i/o ?

please help me!

 

 

0 Kudos
Message 42 of 62
(3,295 Views)
The \ code usage in the test panel is just a display property of the text box. When you get around to LabVIEW, you can use an array of U8 and set them for hex display. Then use the Byte Array to String.
0 Kudos
Message 43 of 62
(3,282 Views)

ok.

I have set up this (attempt at a) Virtual Instrument:

the one which you can see in the attached picture .

I have communication with the Hamamatsu source(it displays REMOTE) and I receive on the error indicator the message BC which is also from hamamatsu: Bad Command.

The same old error :

Timeout expired before operation completed.

 

By trying all sorts of things in Nimax, I noticed that I don't get any errors during Read

IF the Bytes to read perfectly matches what the Hamamatsu source returns

Example:

F\r + set Read nr. bytes to 24 (the nr of bytes which Hamamatsu returns)

Query returns no error:

Read Operation
VISA: (Hex 0x3FFF0006) The number of bytes transferred is equal to the requested input count. More data might be available.

I will look into this on Monday.

Until then , any suggestion is welcomed.

 

 

 

0 Kudos
Message 44 of 62
(3,264 Views)
You need to understand how a VISA Read works. The read will terminate the when the number of specified bytes is read, or when the termination character is detected, or when the timeout value is reached. You have specified to use a termination character with the configure serial port. The default character is s line feed so it expects that. When it does not see that, you will get a timeout when doing a read of a high byte count since the character is never detected. When you specify the exact byte count, you get a warning because there may be additional bytes available since the termination character was not detected. You must set the correct termination character with the configure function. Right click on the input terminal and select Create constant. Change it to the decimal equivalent of a carriage return.
0 Kudos
Message 45 of 62
(3,258 Views)

Oh, so by writing "24'' in that constant of the ''byte count'' input I actually commanmded it to Cancel 

13 is the Carriage Return.

I was confused because of the name "byte count" which , to me , implied a number equal to that of the bytes to be read

and because in this video:

http://www.youtube.com/watch?v=W4VZHwpSW1M

 the person used 1024 as a constant input.

 

I modified the ''Visa Configure serial Port'' as follows:

 

0xA='\n'=LF

to

0xD='\r'=CR

to set the carriage return.

 

timeout 

from 10000ms 

to

2000ms

 

note: the parity port shows a coercion dot but the timeout value does not

and when the timeout was 10 000ms , it took 10 s to get the error and now,when it is 2000ms it takes 2 so this is another reason to believe that the port uses the numeric value literally and did not convert it to another data type.

 

Now, that I have modified the visa config. serial port and the VISA read constant to 13 ,

what am I still doing wrong, because I still get the error

VISA:  (Hex 0xBFFF0015) Timeout expired before operation completed.

Is the VISA write buffer command ok?The only input I wrote is R\r or R

to which I received Bad Command (R\r) and nothing (R) on the Serial port monitor.

What should I do in order to stop receiving this timeout error?

 

! correction: I did not modify

the ''Visa Configure serial Port'' as follows:

 0xA='\n'=LF

to

0xD='\r'=CR

I had only modified the LABEL.Jesus!

Now, when I tried to modify in the front panel from A to D ,

Labview shut down with an error.

I will try to modify this termination characted to D.

I modified it to D in VISA ConfigSerialPort but it jumps back to A

0 Kudos
Message 46 of 62
(3,242 Views)

The problem is that visa is sending the wrong commands to the Hamamatsu source:

looking at the Free serial monitor read :

 

typed R\r in the write buffer =>

 

Request: 27.10.2014 13:04:45.19464 (+37.4921 seconds)

20 52 5C 72 0A 0A 0A R\r...

Port closed


The correct command is
52 0D R.

 

typed R =>

Port opened by process "LabVIEW.exe" (PID: 4944)

20 52 0A 0A 0A R...

Answer: 27.10.2014 13:05:15.48064 (+0.0930 seconds)

42 43 BC

Port closed

 

 

What do i need to write in the write buffer in order for the output to become

 

52 0D R. 

?

 

edit:

 

click write buffer, right click, select "hex display"

write:

520D 

IT WORKS!!!!!!!!1

NO ERROR FOR THE FIRST TIME!!!!

 

 

however, the byte count on visa read has to be set manually:

13 bytes for read the device setting

24 bytes for read information.

0 Kudos
Message 47 of 62
(3,232 Views)
Do NOT modify the serial configuration VI! Add the cr constant on the block diagram of the main VI.
0 Kudos
Message 48 of 62
(3,224 Views)

Thank you, Dennis!

Alright, I created a constant set to True on the Enable term char of the Visa serial subVi.

Now I have to make buttons on the front panel,

each sending a command such as R-read,F-readInfo,D-quit, V-voltage setting et c.

in a way that, when I press

-Read it sends 520D to the Write buffer of Visa Write 

AND

"13" to the VISAread byte count.

-Read info sends 460D to Write buffer

and

24 to visa read byte count.

 

 

0 Kudos
Message 49 of 62
(3,218 Views)
I don't know why you would create a true constant when I said to create a cr constant for the termination character itself.
0 Kudos
Message 50 of 62
(3,210 Views)