Control Unit Communication Protocol

General description

The control unit consists of 1 port with USB connections and a port with dock for connecting a memory of the SD card type. USB connector is connected to the control unit and creates a virtual communication port on your computer. The dock for the SD card belongs to the Swedish Tax Agency to remove control files from the control unit.

Version and Revision

Version and revision in this document is for PosPlus used for testing and developing. A certified PosPlus can have a different revision and versions number.

Version     0.18 
Revision    1/1.4 

Version     0.19 
Revision    1/1.4 5. Diagrams

Block diagram

Port 1 — Port for writing to the control memory Port 3 — Port to the Swedish Tax Agency Control Memory — Memory that stores the receipt control data in encrypted form

Connection Diagram

Ports

Port 1 is connected to the payment system via the USB connector.

Driver Routine

Driver routine: CDM 2.04.06 WHQL Certified

Communication

Settings for communication port: Speed: 57600 Parity: None Data bits: 8 Stop bits: 1

API

General description

Communication with the controller consists of text strings. A command string sent to the controller with a command and a return string sent from the control unit with a response to the command.

Command string to the control unit

A command string to the control unit is built up of a command, for example, "kd". The command will need a set of arguments, such as receipt control data. After the argument comes a CRC code of 4 characters. The command string ends with a carriage return and a linefeed. Space is used as a separator sign.
The text string receives the following appearance,
"Kd argument_1 argument_2 ... argument_x 0000/cr/lf"

Return string from the control unit

The return string from the control unit consists of a return code, a response and a calculated CRC code for the return string.
The return code describes how the command went. If the command was successful return code 0 will be returned.
If you receive return code 0 there will also be a response.
Space is used as a separator sign. The return string ends with a carriage return and a linefeed The return string receives the following appearance, "0 answer 0x5291/cr/lf".
If the control unit returns a return code other than 0 the return string will look like this, "1 0x5291/cr/lf".

CRC-code

The control unit has features to use CRC-code control of the communication.
The CRC code is sent as the last field in the command string.
If a CRC code containing only zeros is sent to the controller, it will ignore the CRC code.
The CRC code may be preceded by a 16-base prefix "0x".
The CRC code from the control unit is always preceded by 16-base prefix "0x"

VersionCRC-16-CCITT
Format to the controlWithout prefix: 5689 unit
With prefix: 0x5689
Will be ignored: 0000
Format from the controlWith prefix: 0x6789 unit

Separator/Ending

SeparatorDescriptionAscii
SpaceSeparator between command and argument/Separator between arguments32
Carriage ReturnEnds a command string/ return string13
Line FeedEnds a command string/ return string10

API – port 1

The command:
ver - Sends a request to the control unit. Sends a response back, with the version of software and production number of the control unit.
kd - Sends receipt data to the control unit. Provides a control code as response. Description:


ver

ArgumentDescription
CRC codeCalculated CRC-code
0000 – If CRC-code is not used
ReplyDescription
Return code0 – OK
-1 – wrong length
-2 – CRC error
-3 – Unknown command
NameName of control unit
PortPort 1
SoftwareSoftware version
HardwareHardware revision
​​Manufacturing numberManufacturing number for the control unit
CRC codeCRC code from the control unit

Example:
ver 0000
0 POSPlus Port1 0.1 0.0 PPlus000000000001 0x151B


kd

ArgumentDescription
Date and timeDate and time of the sale transaction as per Section 28c, SKVFS 2008:x
Format: YYYYMMDDttmm
Organization numberThe company’s organisation’s number or personal number as per Section 28a, SKVFS 2008:x
Format: Max 10 digits
Cash Register IDCash register marking as per Section 10 SKVFS 2008:z
Format: Max 16 alphanumeric digits
Serial NumberSerial number as per Section 28d, SKVFS 2008:x
Format: Max 12 digits
TypeType of receipt
Format: normal(normal), kopia(copy), ovning(practice) or profo(profo)
Return amountAbsolute Amount of returned items on the receipt
Format: 10,25. Max 14 characters including 2 decimal places and decimal comma
Sales amountAmount for the customer to pay, as per Section 28h, SKVFS 2008:x
Format: 10,25. Max 14 characters including 2 decimal places and decimal comma
VAT rate1; VAT amount1First VAT rate in percentage and amount as per Section 28j, SKVFS 2008:x
< Percentage rate >;< Amount >
Format < Percentage rate >: Max 5 digits including 2 decimals and decimal comma
Format < Amount >: Max 14 digits including 2 decimals and decimal comma
Example: 12,00;0,00
VAT rate2; VAT amount2Second VAT rate in percentage and amount as per Section 28j, SKVFS 2008:x
< Percentage rate >;< Amount >
Format < Percentage rate >: Max 5 digits including 2 decimals and decimal comma
Format < Amount >: Max 14 digits including 2 decimals and decimal comma
Example: 12,00;0,00
VAT rate3; VAT amount3Third VAT rate in percentage and amount as per Section 28j, SKVFS 2008:x
< Percentage rate >;< Amount >
Format < Percentage rate >: Max 5 digits including 2 decimals and decimal comma
Format < Amount >: Max 14 digits including 2 decimals and decimal comma
Example: 12,00;0,00
VAT rate4; VAT amount4Fourth VAT rate in percentage and amount as per Section 28j, SKVFS 2008:x
< Percentage rate >;< Amount >
Format < Percentage rate >: Max 5 digits including 2 decimals and decimal comma
Format < Amount >: Max 14 digits including 2 decimals and decimal comma
Example: 12,00;0,00
CRC codeCalculated (0000 – If CRC code is not used)
ReplyDescription
Return code24 – Internal log is full
23 – Error in an internal counter
22 – Field is present after field CRC
21 – Relationship between sales amount and return amount is wrong
20 – Power fail abort
15,16,17,18,19 Internal error in the control unit
10,11,12,13 – Wrong format of vat
9 – Wrong format of sales amount
8 – Wrong format of return amount
6,7 – Type of receipt not defined
5 – Wrong format of serial number
4 – Wrong format of cash register id
3 – Wrong format of organisation number
2 – Wrong date/time range
1 – Wrong number of arguments
0 – OK
-1 – Wrong length
-2 – CRC error
-3 – Unknown command
Control codeControl code from the control unit in case of return code 0, otherwise nothing
Note: control code is only given for receipt of type normal and copy
CRC codeCalculated CRC code from the control unit

Control code is only given for receipt normal and copy. No control code is given for receipt profo and practice.

Examples

Example of receipt of type copy or normal
kd 200903171752 5566775566 Pos01 1325 normal 0,00 1,00 0,00;0,00 25,00;0,20 12,00;0,00 6,00;0,00 0000 0 K34P72NUH7A3HST7HY7EF6RUWJLLWVOC;MKFXCN7ENWYJS4KRP3JJ3KG64M 0x1ACB

Example of receipt of type practice or proof
kd 200903171752 5566775566 Pos01 1325 ovning 0,00 1,00 0,00;0,00 25,00;0,20 12,00;0,00 6,00;0,00 0000 0 0xE721

Example of receipt of type normal and copy
kd 200903171752 5566775566 Pos01 1325 normal 0,00 1,00 0,00;0,00 25,00;0,20 12,00;0,00 6,00;0,00 0000 0 K34P72NUH7A3HST7HY7EF6RUWJLLWVOC;MKFXCN7ENWYJS4KRP3JJ3KG64M 0x1ACB

kd 200903171752 5566775566 Pos01 1325 kopia 0,00 1,00 0,00;0,00 25,00;0,20 12,00;0,00 6,00;0,00 0000 0 K34P72NUH7A3HST7HY7EF6RUWJLLWVOC;MKFXCN7ENWYJS4KRP3JJ3KG64M 0x1ACB

Example of receipt of type normal with return amount
kd 200903171752 5566775566 Pos01 1325 normal 1,00 0,00 0,00;0,00 25,00;0,00 12,00;0,00 6,00;0,00 0000

Advices

Control Code
It is forbidden to write the Control Code, given from the Control Unit, on the receipt.
If that is done, a patent will be violated.
The same is for a Copy of a receipt. If the Control Code comes with the copy, the patent will be violated.