Serial Communication Protocol Guide
Serial Communication Protocol Guide
Important Notice:
Any modification to the Variable Serial Protocol is restricted to qualified personnel only. The Company guaranties the correct performance of the
internal serial protocol. The responsibility for any malfunction arising out of any modifications to the scripts of the Variable Serial Protocol rests
with the customer.
WARNING
This information regards the setting up of the barcode for sample tubes identification. The reading of the sample barcode label has the same
progression as patient code.
For example: Once a patient code of 15 characters has been entered, then a code of 8 characters followed by 7 empty spaces to reach the 15
characters is sent.
The code read on the barcode label must have the same sequence 8 + 7 for correct detection.
22.1 GENERAL
The analyzer allows bi-directional communication through RS 232C serial connection with any host computer.
The particular feature of the dialog is that it is always the host computer, which initiates the communication for either transmitting patient list or for
receiving the results.
To initiate any communication the host computer will have to send to analyzer the character STX (0x02) and expect the character ACK (0x06) as a
response. At this point the host computer will send data to the analyzer and terminate the communication by sending the character EOT (0x04).
It is important to remember that any communication is followed by a response from the analyzer.
It must be noted that if the parameter to be transmitted is shorter in length than the length requirement of the communication protocol than a space must
be added before or after. For example the analysis have length 4, therefore to send a code GLY one must add a space after to reach the length of 4
characters.
PATIENT TRANSMISSION
->ACK.................
................................................................ (15 characters)
("T" for Routine or "R" for STAT)
.......................... ("S" for Serum or "U" for Urine)
("Y" for Yes or "N" for No)
("00" unknown)
s to be executed.................................... (from "01" to "99")
(4 characters)
-Sum................................................................... (3 characters)
nd end transmission character EOT..................................
(2 characters)
If the communication is successful then the analyzer responds with character "Y" followed by a byte, which identifies the position where patient has
been inserted. In case the communication was unsuccessful, then the analyzer responds with "N" followed by a byte identifying the type of error. The
possible errors generated by the analyzer in response to the invalid insertion of patient are as follows:
Page 165
0x01 Check-Sum Error
0x02 Unknown Command
0x03 Routine/STAT field Error
0x04 Serum/Urine field Error
0x05 Clone Yes/No field Error
0x06 Cup position Error
0x07 Number of Analysis field Error
0x08 Wrong Number of Test
0x09 Position already in execution
0x0A Cloning impossible
0x0B Code duplicated
0x0C One or more analysis not present in the analyzer
0x0D One or more analysis not present in the current plate
0x0E Too many analysis for the patient
0x0F Constant data not valid
0x10 Variable data not valid
0x11 Variable data in analysis not valid
0x12 No patient to repeat
0x13 The serum field in the patient to be repeated is different from the memorized one
0x14 Patient to be repeated, but the list is already full
0x15 Patient to be repeated, but the list is different
0x16 The assigned position is already in use
0x17 Already existing or performed patient, it is not a clone and belongs to a supplementary
(extra) list
0x18 Already performed patient, but no repetitions or clones are active
For example to send a patient with code 000000000000001, serum type and with analysis GLY, BUN and CHO onto the STATS list, then one must
send the following sequence of characters (excluding initial sequence STX<->ACK):
Where:
Page 166
22.2 RESULTS RECEPTION
There are three commands for receiving reports from the analyzer:
The commands R, L, and A require standard communication or the procedure STX<->ACK and the character EOT to end communication.
As a response to one of these three commands the analyzer sends the requested report (if available) or the character NAK (0x15) if there is no report to
be sent. It must be borne in mind that after a run test the reports are not immediately available for transmission as these need validation. To do this, go
to Utility menu, RS232 and enable the option "Accept result to be sent". This operation must always be performed after each run test or groups of run
test.
There is also an additional option for performing validation operation automatically. Go to Setup of the analyzer (Menu Utility, Setup Analyzer), go to
the Serial (fourth from the left) and enable the option "All results must be sent automatically (without validate)" at the bottom of the page.
In case of positive response to the request for a report the analyzer will transmit the data which will have a different format, depending on the selection
made in the Send also the controls option (enabled or disabled - see xxx).
Data transmitted with the Send controls option disabled:
The following is an example of eventual response to the data sent in "Sending a patient":
Page 167
transmitted with the Send controls option enabled:
Note: when sending a sample, which is not a control, the control lines (fields) will have the following values:
Control Sample “N”
Known Control “K”
Control level “001”
Control lot number “ “
The following is an example of eventual response to the data sent in "Sending a patient":
Where:
Page 168
22.3 CALCULATION OF CHECK-SUM
This procedure calculates a Control code in accordance with the transmitted or received data. An algebraic sum of ASCII values of all the sent
characters is executed. For example the character "A" has ASCII value 65 - 0x41.
Consequently the module 256 of the found value is executed (balance of dividing the value by 256). This is the Check-Sum to be sent.
Analyser
Analyser
Page 169
22.5 VARIABLE COMMUNICATION PROTOCOL
Introduction
The variable serial protocol has been designed to provide the user with possibility to personalize the transmitted and received data from the analyzer.
The default scripts are similar to those of the standard serial protocol, but please note that the character used to set the type of list is different
between the two protocols. In the standard internal protocol, the character “T” identifies the routine list and “R” identifies the urgent samples
list. In the variable Protocol, the character “R” identifies the routine list and “S” identifies the urgent samples list.
The user can transmit or receive in addition to preset data (patient code, analysis code, results etc.), also the simple text strings and/or characters in
order to meet the personal requirements.
Not only the user can decide to send or receive numerical information (for example number of tests) not as single byte but as a preset numerical string
or vice versa.
Where the phrases "Initiate analysis data" and "End analysis data" do not refer to any preset data by the analyzer but serve only for monitoring
communication process (can be useful for inserting specific markers on those programs which obtain information from text files).
It is obvious that the protocol of initiation and end of communication, the commands for the request of report, and the analyzer responses in case of
error or success remain identical to the usual preset serial communication.
NOTE:
a) If a check-sum is omitted in a communication then the analyzer will not control it.
b) The following numbers have been used to represent the error codes relevant to sending a patient to the analyzer as regards the parameters not
part of the standard serial communication:
0x0F Data (constant) sent to a TAG #Char, #String or #Stringn does not fall within the possible values range
0x10 Data (variable) sent to a TAG #Char, #String or #Stringn is not valid
0x11 An analysis variable is outside the SET BEGIN/END relative to the analysis
|$10
An editor for writing, modifications, saving and compiling of one or more scripts is accessible inside the program (setup function). In any case it is
possible to write a script with any text editor (DOS or Windows) like Notepad of Windows or the EDITOR of the DOS. It is not possible to import
documents written with UNIX as the characters used for going to the next line are different from the ones used by the DOS or Windows.
CAUTION!
If one wants to use the script stored in a removable disk (for example floppy disk) then it will be necessary to copy it on the hard disk.
TYPE OF DATA
Character: Identifies a single character, can pass as printable character (enclosed between single apostrophes), as decimal ASCII value
(followed by symbol $) or else hexadecimal ASCII value (followed by 0x).
If for example we want to identify the character A (decimal value 65 or hexadecimal value 41) then we can write 'A',
$65 or 0x41.
String: Identifies a sequence of printable characters enclosed in single apostrophes, for example: 'this is a string'.
Comment: Identifies a portion of test (preceded by a character ; which will not be compiled but will serve as note only for the
programmer.
Page 170
Variables: These are particular sequence of characters preceded by the symbol #, which will be used by the program for storing
internal information (patient code, analysis name and etc.), refer to "TABLE 1 - TRANSMISSION/RECEPTION".
There are also variables for direct uses, which allow for identification of any character below ASCII 32 (space) to facilitate
the writing of the script (for example, one can use the variable #EOT to identify the character $4), see "TABLE 2 -
INTERNAL VARIABLES".
SCRIPT FUNCTIONS
Syntax:
String <string>I<Terminator>
Where
<String> Transmit/receive string
<Terminator> End character
Note:
It is not possible to use the variables like parameter <Terminator>
Example:
String ‘Hello Word’|$0
String ‘My String’|’@’
String #Variable1|0x10
Syntax:
Stringn <String>|<Length>
Where
<String> Transmit/receive string
<Length> String length
Note:
If the length of the text strings is less than the data length then a series of spaces will be added on the right to reach the data preset length. In
case the text string is longer than the data length then the string end will be cut off to match the data length.
If the length of the numerical values is less than the data length then a series of characters '0' will be added to the left to reach the preset data
dimension. In case the length of the numerical values string is longer than the data length then the string will be truncated to match the data
length.
Example:
Stringn ‘Hello Word’|$40
Stringn #Variable1|0x10
Syntax:
Char <Character>
Example:
Char ‘H’
Char $20
Char 0x10
Char #STX
Set: Identifies the beginning and the end of the group of repetitive commands
Syntax
Note:
Actually the ANALYSESDATA is the unique SET present, which identifies the analysis in transmission/reception.
Only one command SET BEGIN and one command SET END can be present in a script.
A script must always contain the command SET.
The variable PATIENTNUMBERTEST must be present before the command SET.
Page 171
COMPILATION ERRORS
One or more errors due to incorrect script writing or the system error may show up during compilation of a script. The compiler shows the error code,
the description of error, and the line where it has been detected.
The following table shows the error codes, description, and the possible causes:
Error Code Description Possible Causes
1 Unknown command An invalid command has been inserted in the commands of script.
A string as first parameter for String or Stringn command has not been
2 A string request
inserted.
A string like parameter <lunghezza - length> of command Stringn has
3 A number request
been inserted.
4 Invalid number format Inserted invalid decimal or hexadecimal number.
a) Inserted more than two parameters for command String or
5 Excessive data Stringn.
b) Inserted more than one parameter for the command Char or Set.
6 Invalid data A string for command Char has been inserted.
7 String Terminator Request The end (') character of a string not found.
a) Inserted less than two parameters for command String or
8 Too little data Stringn.
b) No parameter inserted for command Char or Set.
9 Invalid String Length The string length for Stringn command is less than 0 or more than 128.
a) An empty string inserted for the command String or Stringn.
10 Empty string
b) Inserted a character identified as "
a) Tried to transfer an invalid variable in the list of internal
variables.
11 Unknown variable
b) Tried to use a transmission variable in the script of reception or
vice versa.
12 Damaged file Hard disk error. Contact Sales/Service.
Internal error. Probably damaged program. Reinstall the program. If the
13 Unknown file
problem persists contact sales/service.
a) The text SET BEGIN or SET END not written.
Incorrect identifier in the SET
14 b) A different value from ANALYSEDATA transferred as <Group
command
name> for the SET command.
15 Damaged exit file Hard disk error. Contact sales/service.
16 SET command not closed The SET END not inserted in the script.
17 Too many SET commands More than one SET BEGIN command inserted.
18 SET command not found The SET BEGIN command not found in the script.
A different value from ANALYSEDATA transferred as <Group name>
19 Incorrect variable for SET command
for the SET command.
Variable not found before the SET The highlighted variable required in the script before the SET BEGIN
20
command command.
21 The variable must be String type The highlighted variable must be String type, not Char
22 Already occupied position An already occupied position on the plate has been entered
An already existing code (or already executed) on the plate has been
23 Patient exists but in different lists
entered, but the list is different.
An already processed code has been entered without indicating a
24 Patient executed but no repetition
repetition or a clone.
Page 172
TABLE 1 – TRANSMISSION
The following variables are used for the transmission of a report from analyzer to the host computer:
Variable Usage Type of valid data
If only the final result is desired then always refer to variables pertaining to 2nd result.
In case of the absence of 2nd result then its variables will have the same values of the 1st result.
(6)
Identifies if it is a quality control or a sample (only one of these)
“Y”: Quality control
“N”: Normal sample
(7)
Indentifies if it is a Known or an Unknown quality control
“K”: Known Control
“U”: Unknown control
Page 173
TABLE 2 – RECEPTION
The following variables are used for reception of a patient by the analyzer:
Variable Usage Type of valid data
(1)
Identifies Routine or STAT (Select only one of these):
$0 : Routine
$1 : STAT
‘0’ : Routine
‘1’ : STAT
‘R’ : Routine
‘S’ : STAT
‘ROUTINE’ : Routine
‘STAT’ : STAT
(2)
Identifies Male, Female or Child (Select only one of these):
$0 : Male
$1 : Female
$2 : Child
‘0’ : Male
‘1’ : Female
‘2’ : Child
‘M’ : Male
‘F’ : Female
‘C’ : Child
‘MAN’ : Male
‘FEMALE’ : Female
‘CHILD’ : Child
(3)
Identifies Serum or Urine (Select only one of these):
$0 : SERUM
$1 : URINE
‘0’ : SERUM
‘1’ : URINE
‘S’ : SERUM
‘U’ : URINE
‘SERUM’ : SERUM
‘URINE’ : URINE
Page 174
(4)
Identifies a Control or a Sample (Select only one of these):
$0 : Sample
$1 : Control
‘0’ : Sample
‘1’ : Control
‘N’ : Sample
‘Y’ : Control
‘S’ : Sample
‘C’ : Control
‘NO’ : Sample
‘YES’ : Control
‘SAMPLE’ : Sample
‘CONTROL’ : Control
(5)
Identifies a Known or Unknown Control (Select only one of these):
$0 : Unknown
$1 : Known
‘0’ : Unknown
‘1’ : Known
‘N’ : Unknown
‘Y’ : Known
‘U’ : Unknown
‘K’ : Known
‘NO’ : Unknown
‘YES’ : Known
‘UNKNOW’ : Unknown
‘KNOW’ : Known
(6)
Identifies Control Level (Select only one of these):
$1 : Level 1
$2 : Level 2
$3 : Level 3
‘1’ : Level 1
‘2’ : Level 2
‘3’ : Level 3
‘L’ : Level 1
‘N’ : Level 2
‘A’ : Level 3
‘LOW’ : Level 1
‘NORMAL’ : Level 2
‘ABNORMAL’ : Level 3
(7)
Identifies if it is a Clone (Select only one of these):
$0 : Normal
$1 : Clone
‘0’ : Normal
‘1’ : Clone
‘N’ : Normal
‘Y’ : Clone
‘NOCLONE’ : Normal
‘CLONE’ : Clone
(8)
If this field has the value 0, the position is automatically assigned by the analyser
Note:
Page 175
TABLE 3 – INTERNAL VARIABLES
SCRIPT EXAMPLES
The examples outlined here are the transformation in script of the standard routine of the patient reception by the analyzer.
Stringn #PatientCode|$15
Char #PatientListType
Char #PatientType
Char #PatientClone
Stringn #PatientCupPosition|$2
Stringn #PatientNumberTest|$2
Set #BeginAnalysesData
Stringn #AnalysesCode|$4
Set #EndAnalysesData
Stringn #CheckSum|$3
Stringn #PatientCode|$15
Patient Code of fixed length equal to 15 characters
Char #PatientListType
Type of list (Routine/STAT) as single character
Char #PatientType
Serum type (Serum/Urine) as single character
Char #PatientClone
Identifies if the patient is or is not a clone (single character)
Stringn #PatientCupPosition|$2
Position of serum cup (string of fixed length equal to 2 characters)
Stringn #PatientNumberTest|$2
Page 176
Number of tests to be executed (string of fixed length equal to 2 characters)
Set #BeginAnalysesData
Beginning of analysis codes
Stringn #AnalysesCode|$4
An analysis code of fixed length equal to 4 characters. It must be entered for each type of test as per qty indicated in the #PatientNumberTest.
Set #EndAnalysesData
End of analysis codes
Stringn #CheckSum|$3
Check-Sum (transferred as a string of fixed length equal to 3 characters)
The following examples are the transformation in script of the standard routine for the transmission of a report by the analyzer to the host computer:
Stringn #PatientCode|$15
Char #PatientType
stringn #PatientNumberTest|$3
Set #BeginAnalysesData
Stringn #AnalysesCode|$04
Stringn #AnalysesConcentration2|$7
Set #EndAnalysesData
Stringn #CheckSum|$3
Stringn #PatientCode|$15
Patient Code of fixed length equal to 15 characters
Char #PatientType
Serum type (Serum/Urine) as single character
stringn #PatientNumberTest|$3
Number of results to be sent (a string of fixed length equal to 3 characters)
Set #BeginAnalysesData
Beginning of zone repeated for the number of results to be sent (see #PatientNumberTest)
Stringn #AnalysesCode|$04
An analysis code of fixed length equal to 4 characters
Stringn #AnalysesConcentration2|$7
Concentration referred to the analysis code as per #AnalysesCode (a string of fixed length equal to 7 characters)
Set #EndAnalysesData
End of zone repeated for the number of results to be sent
Stringn #CheckSum|$3
Check-Sum (transferred as a string of fixed length equal to 3 characters)
Page 177
22.6 SERIAL COMMUNICATION TEST PROGRAMS
In case the Transmission is selected the program will ask for patient code (from 1 to 15 characters), the test number (from 1 to 9) and the relevant
analysis code for each test (for example: BUN).
It is a good practice to use the same analysis codes, which the analyzer has memorized in the plate actually in use, if otherwise then an error will result
in the transmission phase.
Now the program will execute an initialization procedure of communication with the analyzer, will send patient data and wait for the outcome of
transmission.
At the end the screen will display the outcome of the operation or show the position number of the plate where the patient has been inserted or
explanation of error code sent by the instrument (for example: Patient Code Duplicated).
If the Reception procedure is selected, then the program will begin initialization of communication with analyzer, will ask for data of the next report
ready for serial dispatch and show data of relevant downloaded report.
Every time the program waits for a response from the analyzer, in case of problem it is possible to abort the current operation by simply pressing the
Esc (Escape) key.
NOTE:
The program BTPLUS.EXE works only with the internal serial protocol. The option “Send controls” in the Setup must be disabled.
Both the programs must reside in the computer connected serially to the analyzer through appropriate cable indicated in the Operators
Manual.
The computer must be an IBM compatible equipped with DOS operative system: Windows 95, Windows 98, or Windows 2000. The operating
systems such as MAC, UNIX, Windows ME or XP are not supported.
Since the programs operate in DOS ambience, therefore in case the Windows operating system is used then it will be necessary to open a DOS
shell (the command Prompts of MS-DOS is found in the menu Programs, Accessories - accessed through the Start button on the bottom left of
the screen).
Both the programs use serial port with the following setups:
Baude-Rate....................... 9600
Stop-Bits........................... 1
Parity................................. None
Hand-shake...................... Hardware
IMPORTANT NOTICE: These two programs are in the installation disk under Utility folder.
Open the Printers window (“Start” button, “Settings”, “Printers”) and click on “New Printer”, then follow instructions. Otherwise, insert the
printer’s installation disk into the driver and follow the printer’s setup instructions.
Page 178