![background image](http://html1.mh-extra.com/html/barco/actas-2/actas-2_owners-manual_473881052.webp)
Appendix B : Serial communication
B-1
5975636 ACTAS 2 170297
B
SERIAL COMMUNICATION
This appendix describes the communication through the
port marked as “TO HOST” on the ACTAS Interface.
GENERAL
Master - Slave configuration
The connection through the 'TO HOST' port can be used
for 2 purposes :
1. To tell the host computer which test picture it has to
put on (in case the 'Adjpict' is set to “remote comp”):
in this case, the ACTAS Interface is the master, while
the
host computer is a slave
.
2. To use the ACTAS Interface as a remote controlled
picture generator : in this case, the
computer is the
master
.
From the hardware point of view, the connection is the
same for both situations.
The projector connected to the “TO PROJ. RS232 IN”
port on the Interface is always a slave, no matter if talked
to by the ACTAS itself, or by the host computer wired to
the 'TO HOST' port on the Interface.
RS232 formats
Bytes are sent with :
8 data bits
No parity
1 stop bit
at 9600 Baud rate
Communication protocol
Using this protocol, it is possible to address up to 256
slaves from one master. Due to the fact that this is
normally not supported by RS232 type communications,
special features are incorporated into the slave.
To begin with, each slave should have a unique address.
Bytes transmitted by the Master
When transmitting data from the master to the slave(s),
the start of the transmission is indicated by using the
STX
(02) byte. All the slaves in the chain are constantly
checking if there is a
STX
byte on the serial line.
After receiving the
STX
, an address byte is transmitted
by the Master. All the slaves compare this address byte
with their own address. The slave that recognises his
address will interpret the following bytes and do what is
requested by the master. The other slaves will restart
checking for the
STX
on the serial line.
If '02' appears in the data bytes following the
STX
, slaves
which did not recognise their address will be confused.
They might even interpret the following bytes in a wrong
way, reacting unpredictably. To avoid this, a protocol is
used which avoids the appearance of '02' (
STX
) in the
data bytes sent by the master.
The protocol introduces an offset byte in the transferred
bytes (ADR being the byte indicating the address of the
projector for which the data is meant and DATi the data
bytes) :
STX BYTE1 ... BYTEn
becomes :
STX BYTE1e ... BYTEne
BYTEie are bytes which are “encoded” in a way that
none of them is equal to '02'. Their relation with the
original bytes is :
BYTEie = BYTEi + OFFS
Because the number of bytes used in a transmission is
always smaller than 254, a byte
OFFS
can always be
found, so that all the encoded bytes and
OFFS
are
different from '02'.
Below is a C source example of how to find
OFFS
and
the checksum :
#define STX ‘\x02’
unsigned char find_offacs (unsigned char *pstart_loc)
{ /* find offset and check sum */
/* pstart_loc : pointer to record to be scanned */
int count;
int check[256];/* check[i]== TRUE means code ‘i’ occurs in record */
unsigned checksum;
checksum = 0; /* initialize checksum */
for (count = 0; count <= 255; count++) /* init code checking array */
check[count] = FALSE;
for (count = 0; count < 6; count++) /* scan codes in record */
{ check[pstart_loc[count]] = TRUE; /* mark in checking array */
ch= pstart_loc[count]; } /* build checksum value */
checksum %= 256;
/* keep least significant byte */
check[checksum] = TRUE;
/* mark in checking array */
for (count = 1; check[count] == TRUE; count++);
/* search checking array */
/* skip value 0 and continue as long as code ‘count’ is marked TRUE */
pstart_loc[6] = (byte) checksum; /* store checksum in record */
return ((unsigned char) (STX-count));
/* offset=STX-not_occuring_code */
}