beautypg.com

Command response time, Serial commands for ld software – Red Lion LDSG User Manual

Page 17

background image

17

(CSR) Control Status Register

The Control Status Register is used to directly control the meter’s setpoint

outputs and interrogate the state of the setpoint outputs. The register is bit

mapped with each bit position within the register assigned to a particular control

function. The control function are invoked by writing to each bit position. The

bit position definitions are:

bit 0: Setpoint 1 Output Status

0 = output off
1 = output on

bit 1: Setpoint 2 Output Status

0 = output off
1 = output on

bit 2: Not Used
bit 3: Not Used
bit 4: Manual Mode

0 = automatic mode
1 = manual mode

bit 5: Always stays 0, even if 1 is sent.
bit 6: Not Used
bit 7: Always stays 0, even if 1 is sent.

Although the register is bit mapped starting with bit 7, HEX < > characters

are sent in the command string. Bits 7 and 5 always stay a zero, even if a “1” is

sent. This allows ASCII characters to be used with terminals that may not have

extended character capabilities.

Writing a “1” to bit 4 of CSR selects manual mode. In this mode, the setpoint

outputs are defined by the values written to the bits b0 and b1. Internal control

of these outputs is then overridden.

In automatic mode, the setpoint outputs can only be reset off. Writing to the

setpoint output bits of the CSR has the same effect as a Reset command (R). The

contents of the CSR may be read to interrogate the state of the setpoint outputs.

Examples:

1. Set manual mode, turn all setpoints off:

V is command write, J is CSR and * is terminator.

2. Turn SP1 output on and SP2 output off:

Note: Avoid writing values <0A> (LF), <0D> (CR), <24> ($) and <2E> (*)

to the CSR. These values are interpreted by the meter as end of command

control codes and will prematurely end the write operation.

SERIAL COMMANDS FOR LD SOFTWARE

7 6 5 4 3 2 1 0:bit location

VJ<30>* or VJ0*

ASCII 0 = 0 0 1 1 0 0 0 0 or <30>

VJ<31>* or VJ1*

or <31>

1

0

0

0

1

1

0

0

ASCII 1 =

0:bit location

1

2

3

4

5

6

7

Command Response Time

The meter can only receive data or transmit data at any one time (half-duplex

operation). The meter ignores commands while transmitting data, but instead

uses RXD as a busy signal. When sending commands and data to the meter, a

delay must be imposed before sending another command. This allows enough

time for the meter to process the command and prepare for the next command.

At the start of the time interval t

1

, the computer program prints or writes the

string to the com port, thus initiating a transmission. During t

1

, the command

characters are under transmission and at the end of this period, the command

terminating character (*) is received by the meter. The time duration of t

1

is

dependent on the number of characters and baud rate of the channel.

t

1

= (10 * # of characters) / baud rate

At the start of time interval t

2

, the meter starts the interpretation of the

command and when complete, performs the command function. This time

interval t

2

varies from 2 msec to 50 msec. If no response from the meter is

expected, the meter is ready to accept another command.

If the meter is to reply with data, the time interval t

2

is controlled by the use

of the command terminating character. The standard command line terminating

character is ‘*’. This terminating character results in a response time window of

50 msec minimum and 100 msec maximum. This allows sufficient time for the

release of the sending driver on the RS485 bus. Terminating the command line

with ‘$’ results in a response time window (t

2

) of 2 msec minimum and 50 msec

maximum. The faster response time of this terminating character requires that

sending drivers release within 2 msec after the terminating character is received.

At the beginning of time interval t

3

, the meter responds with the first

character of the reply. As with t

1

, the time duration of t

3

is dependent on the

number of characters and baud rate of the channel. t

3

= (10 * # of characters) /

baud rate. At the end of t

3

, the meter is ready to receive the next command.

The maximum serial throughput of the meter is limited to the sum of the

times t

1

, t

2

and t

3

.

Ready

Ready

1

t

t

2

Ready

t

1

t

2

Ready

t

3

Command

String

Transmission

Meter

Response

Time

Command

Terminator

Received

First

Character

of Reply

Reply

Transmission

NO REPLY FROM METER

RESPONSE FROM METER

Time

Timing Diagram Figure