Introduction to Programming - 2
Baud Rate
The front panel Address key lets you select one of the following baud rates, which is stored in
memory: |
|
|
|
|
|
300 | 600 | 1200 | 2400 | 4800 | 9600 |
RS-232 Flow Control
The
A software handshake that uses the ASCII control code DC3 (decimal code | |
| 19) to assert |
| |
The dc source asserts its Request to Send (RTS) line to signal | |
| when its input buffer is almost full, and it interprets its Clear to Send (CTS) |
| line as a |
The dc source asserts its Data Terminal Ready (DTR) line to signal | |
| when its input buffer is almost full, and it interprets its Data Set Ready |
| (DSR) line as a |
NONE | There is no flow control. |
Flow control options are stored in
RS-232 Programming Example
The following program illustrates how to program the power supply using
NOTE: The power supply must be configured for RS232 and the same baud rate and parity as the controller.
‘Program to write and read via RS232.
‘Configure the power supply for 9600 baud, even parity and RS232
‘Configure serial port for:”
‘9600 baud
‘7 bit data
‘2 stop bits
‘Ignore request to send
‘Ignore carrier detect
‘ | Even parity | ‘ Needed with Vectra basic, ignored with QBasic |
‘Send line feed
‘Reserve 1000 character buffer for serial I/O
DECLARE FUNCTION gets$ ()
CLS |
|
| ‘ Clears screen |
LOCATE 1, | 1 |
| ‘ Position curser at top left |
‘ Configure Com Port |
|
| |
OPEN “com1:9600,e,7,2,rs,cd,pe,lf” FOR RANDOM AS #1 LEN = 1000 | |||
PRINT #1, “OUTPUT ON” | ‘ Turn on output then set voltage and current | ||
PRINT #1, “VOLT 6” |
| ‘ Set voltage to 6 volts | |
PRINT #1, “CURR .5” |
| ‘ Set current to 0.5 amps | |
PRINT #1, “*IDN?” |
| ‘ Query the power supply identification string | |
PRINT gets$ |
| ‘ Go to gets$ Function and print data returned | |
PRINT #1, MEAS”VOLT?”; volt | ‘ Query the power supply voltage | ||
Volt = VAL (gets$) |
| ‘ Convert gets$ string to a value | |
PRINT gets$ |
| ‘ Print the value of the voltage | |
END |
|
| ‘ End of main program |
11