Page: 49/81 User Manual PSU-CTRL-2D, Rev.1-00: Software Interface
Function COM_HVPSU2D_SetBaudRate
int COM_HVPSU2D_SetBaudRate (WORD PortNumber,
unsigned & BaudRate);
Command: $
BBBBB
©
Response: $
BBBBB
©
Sets the communication speed to the baud rate given by the variable
BaudRate
, modifies it to the set value (see below) and returns an er-
ror code according to Tab. 10.
The device is optimized for communication speed of 9600 baud and
its multiples, i.e., for instance, 115.2 or 230.4 kbaud (see function
). If the communication speed is set to
another value such as 128 kbaud, the device will use a slightly differ-
ent speed. This value is returned in the variable
BaudRate
. Note that
if the difference between the communication speed set in the host and
in the device is less than about 5%, the communication can still be es-
tablished without any errors.
If communicating with the device is no longer possible, call the func-
tion
in order to reset the communication speed
to the default value of 9600 baud. You can also interrupt the commu-
nication, this deactivates the handshake lines and resets communica-
tion speed as well.
The direct command (
$
BBBBB
©
) contains 5 hexadecimal digits
(
BBBBB
) for the variable
BaudRate
. The response has the same for-
mat; if the command is executed successfully, it returns the value of
the baud rate set by the device. The response is still transmitted at the
old data rate. After it has been received, the data rate must be set to
the new value in the host UART to enable communication with the de-
vice.
Function COM_HVPSU2D_Purge
int COM_HVPSU2D_Purge (WORD PortNumber);
Clears the port data buffers and returns an error code according to
Tab. 10.
This function can be used to repair a disturbed communication. In
case of a user program crash, this function should be called to erase
CGC Instruments
Tel.: +49 (371) 355 098–55
Hübschmannstr. 18 | D–09112 Chemnitz
Fax: +49 (371) 355 098–60
internet: www.cgc-instruments.com
e–mail: [email protected]