LED-sign

Kohteesta KalkkuWiki
Siirry navigaatioonSiirry hakuun

protocol V4.0_UNICODE Edition

Communication baud rate: 57600,8,n,1

Conventions:

  1. If not specified, all occurrences of the number (such as: 86, and 0x5A) refer to binary numbers, not ASCII-codes.
  2. Protocol length greater than 8 bit figures are little-format storage (low byte first, high byte in the post.)

Part one: sending packets total format

All issued instruction packets, are in line with the instruction format as follows:

[16bytes information head]+[32-byte instruction parameters]+[Extensions]+[4bytes information tail]

Head of information

Bytes 0 : Head of information,fixed 0xA0
Bytes 1-2 : The entire packet length, low byte first, high byte in the post. 
Bytes 3-4 : 16bitscreen ID, low byte first, high byte in the post. 
Bytes 5-8 : Reservations
Bytes 9-12: reservation
Byte 13: specific instruction code. Please refer to the third part description. (In the Terminal in the return package, which is used to indicate an error code)
Bytes 14-15 : Reservations, fill 0.
  • Command parameters : 32 Bytes is less than 32 Bytes filled with zeros to 32 Bytes. Specific meaning as described in the third part describes specific instructions
  • Content extensions :Excerpts of up to 1024 Bytes, if the directive does not need to extend information, not for this paragraph.
  • Information tail :
Bytes 0-1 : 16bit The checksum bytes all byte values, low 16 Bits. 
Bytes 2 :Reservations
Bytes 3 : 1 Byte message end flag, fixed to 0x50

Note, each instruction total length not more than 16+32+1024+4 = 1076 Bytes, shortest each instruction 16+32+4 = 52 Bytes.  

The second part, Terminal feedback packets total format

  All feedback packets, are in line with the format described below:

[Terminal back to the package format and downlink packet formats are the same, just changing the header logo to "0xAF" flag to the end "0x5F". Implementation results through "command" field to return. Specific error codes reference Note1.

Note 1, Unless specified, otherwise contribute to the information normally does not exceed 52 Bytes

Note 2, For mass information, regardless of whether it succeeded in, the terminal will not return  

Part III, specific instruction description code

  0x03 、 Send information instructions:

[Information in the head(command=0x03)]+[32bytes option block]+[content]+[information tail]

  • Head of information :In the first part describes, is no longer listed in the future.
  • 32 Byte block options :

Bytes 0-1 :Information number: low byte first, high byte in the post, from 1 Start, limit depends on the control panel type, information is the number of information store location. Played by its ordinal number from small to large take turns to play.

Bytes 2 : Animated

0x00- Immediately displayed
0x01- Move left
0x02- Move right
0x03- Move on
0x04- Move down
0x05- Zola, Emile
0x06- Drop curtain
0x07- Right sliding screen
0x08- Arab right
0x09- Horizontal blinds
0x0A- Stacked wood
0x0B- Vertical blinds
0x0C- 
0x0D- In the open
0x0E- 
0x0F- Open up and down
0x10- Horizontal profile
0x11- Staggered up and down
0x12- Random

Bytes 3 :Stay low 4 Bit set, high 4 Representative information when playing with "wrapping Flash"

0x00- No wrapping Flash
0x10- Red 4 
0x20- Green 4 
0x30- Yellow 4 
0x40- Red 1 
0x50- Green 1 
0x60- Yellow 1 
0x70- Red single Flash
0x80- Green single Flash
0x90- Blinking yellow single
0xA0- Red single wrapping
0xB0- Green single wrapping
0xC0- Yellow single wrapping
0xD0- Double red line wrapping
0xE0- Green line-wrapping
0xF0- Yellow double line wrapping

Bytes 4 : Moving speed 0x00-0x0F , The larger the number, the faster

Bytes 5 :Page dwell time: 0x00-0xFF , The number of seconds. Such as the screen can display8words, currently there are 16 characters, before then 8 characters after the conclusion of the move, you can choose to remain on screen for a while after the show 8 characters.

Bytes 6 : Reservations

Bytes 7 : Reservations

Bytes 8-15 :Reservations

Bytes 16-23 :Reservations

Bytes 24 :Text color,

bit0 = Red switches;
bit1 = The Green switch;
bit2 = Blue switch,
(color screen can directly fill 0x01 , In which blue switch for the reserved field, not supported). 

Bytes 25 :Low 4 Represents the content type,

0x0 Represents the text,
0x1 On behalf of RTF ,
0x2 The picture,
0x4 Temperature,
0x5 Time,
0x6 Countdown: 
high 4 Representative plays, 0x0 Representative of General information. 

Bytes 26 :The information in the packet sequence number in .

Bytes 27 :The total maximum number of group information. (Field 26, and 27 for RTF and bitmap information, this type of information each storage can save scene content, you can use this field to screen information into a message)

Bytes 28-29 :"Information content" length, low byte first, high byte in the post.

Bytes 30 :Current programs Division. 0x01 represents the partition 1,0x02 indicates partition 2,0x03 partition 3. Note: do not partition is equivalent to a partition, so there is no partition, the option directly fill 0x01.

Bytes 31 :Reservations, fill 0 。    

Information content :

Bitmap information or RTF Information (bytes 25 Low 4 Bit is 0x1 Or 0x2 ), The content is raster data, dot-matrix gets use from left to right, from top to bottom order (before taking the first line, finally taking the last row. Take first left of each line. 8synthesis of bytes), if it is a two-color screen, green after the data in the red. If it is a three-colour screen, the blue data at the edge of the last.

The remaining information is called the fonts, content is the text of UNICODE Encoding. (Need to make to the text encoding process, specific code, see references)  

Special information such as temperature, time, Countdown format description:

1, Information playback, ascii Code is greater than 32 ( 0x20 ) Will be displayed properly. 0x20for time, temperature, Countdown information of the following special replacement, when special characters in the play are dynamically replaced by actual values, special characters are defined as follows:

1 : "Temperature" of positive and negative
2 : "Temperature" of ten
3 : "Temperature" single digit
4 : "Humidity" ten
5 : "Humidity" single digit
9 : "Year" of the first character, the fixed ' 2 ’
10 : "Year" of the second character, the fixed ' 0 ’
11 : "Year" of the third character
12 : "Year" fourth character
13 : "Months" of the first character (decimal)
14 : "Months" of the second character (single)
15-16 : "Day"
17-18 : "Time"
19-20 : "Sub"
21-22 : "Weeks" (to be replaced by a to-day between Chinese characters)
23 : "Seconds" (ten) 
24 : "Seconds" (single)
28-31 : "Countdown" thousands of - Single digits

2 , Countdown information in the "options" field 11 Byte represents the time the target year (effective range 00-99 , Representative of the actual 2000-2099 Year), 15 Bytes representing the month, 19 Bytes representing the date. 23 bytes 1 representative when the countdown, for 0 to represent time.

0x02 、 Additional information content

[Head of information0x02]+[information instruction parameters]+ Data content +[Information and tail]

If you want to send information over 1024 Bytes, he should use instructions 0x03 Send information first half head and information content, and then call this directive sends subsequent content.

Meaning of parameters:

Command parameters:

Bytes 0-1 :Main sequence number information, 2 Bytes

Bytes 2-3 ,Subsequent content relative to the offset of the overall information content, low byte first, high byte in the post.

Data content: you want to append the contents of the

0x06 、 Clear all of the information

[Head of information0x06]+[information tail]

Clear type: thetype of information that you want to clear.

0x00 represents delete all the information screen will display only " Currently no information ”。

0x10 、 Set the display brightness

[Information head0x10]+[parameter]+[information tail]

Parameter: byte 0 Represents brightness values: 0x00-0x0F A total of 16 Brightness level, the larger the number, the brighter

0x13 , Reads the brightness settings

[Information head0x13]+[parameter]+[information tail]

Control cards in the parameter as it will contribute to the information, in accordance with the following format to return the current brightness setting

[Current brightness][last time to automatically adjust the brightness(value, only valid time when adjusting brightness)][current brightness adjustment(0x10-0x12)][12scheduled brightness data of bytes]

0x19 , Temporarily set the screen display status

[Information head0x19]+[parameter]+[information tail]

Parameter: display status 0x01 - Screens display properly; 0x00 - Black screen (off), do not display any contents If the control card to restart, the screen will return to normal display status

0x21 , Time, calibration instructions:

[Information head0x21]+[parameter]+[information]

Parameters:

Bytes 0-6 : The current time, years ( 00-99 ), Month, week, day, hour, minute, second ( 0 Representatives Sunday, 1-6 Representatives Monday to Saturday) each 1 Bytes are BCD Code 。

0x22 , Time query

[Information head0x22]+[parameter]+[information]

Terminal will contribute to the information in the parameter field returns the current time and the time displayed in the control card format, package structure to: [Year] [month] [day][][][][][second week display format], each 1 byte, BCD Code said. [16-bit correction] (reference instruction 0x21)

0x23 , Display hardware settings

[Head of information0x23]+ [Parameter]+[information tail]

Parameters:

Bytes 0 :Display width (in pixels) /8
Bytes 1 :Screen height (in pixels) /8
Bytes 2 :The color type, 1= General; 2= Enhanced two-color; 3= Color, (currently does not support color)
Bytes 3 :Data polarity, 0= Negative polarity; 1= Positive polarity
Bytes 4 : OE Polarity, 0= Negative polarity; 1= Positive polarity
Bytes 5 :Row order range -15 +15
Bytes 6 :Scan type, high 4 Bits scan modes, low 4 Representative lines. (16scans can directly fill one of0)
Bytes 7 :Red-Green-swaps, 0= Normal; 1= Display red and green exchange
Bytes 8 : Screen high value high 8 If less than 2048 Point here 0 (Currently unused for the time being)
Bytes 9 : Whether to take the word reduce oblique
Bytes 10 : Data mirroring
Bytes 11 : Scan frequencies (reserved . Padding 0 )
Bytes 12 : No 138 , 1= No 138 , 0= Normal
Bytes 13-15 : Reserved, padding 0

Note, displays the actual height and width must be a 8 Integral number of times, usually for 16 Integer multiples of

0x24 , Reads the hardware settings

[Information head0x24]+[parameter]+[information tail]

Control card will contribute to the expansion in the information, in accordance with the format command on return set parameters

0x26 , Set the control card automatically switches

[Head of information0x26]+ [Parameter: automatically switch machine mode+power Shi+power min+closed machine Shi+closed machine min]+[information tail]

  • Auto switch mode: 0x0= Do not automatically switch machine; 0x01= Automatic machine every day;
  • When powered on:auto power on hours range 0x00-0x23,BCD Code that
  • Power on:automatically boot minutes value range 0x00-0x59,BCD Code that
  • Shutdown:auto power off hour value range 0x00-0x23,BCD Code that
  • Shutdown:automatic shutdown minutes value range 0x00-0x59,BCD Code that

  0x27 , Read the screen switches set

[Information head0x27]+[parameter]+[information tail]
Control card will contribute to the information in parameters, return parameters in accordance with the following format:

[The current display(0=black screen; 1=on screen)][automatically switches modes][boot][boot] [shutdown] [shutdown]

0x29 , Set the partition instructions

[Information head0x29]+[parameter]+[information tail]

Parameter description:

  1. 32a byte parameter in the:0~7 byteis subsection1a partition of information,8~15 byteis subsection2a partition of information,16~23is subsection3partition of information, last surface8abyteretained.
  2. In each of the partitions of8 byteof information:

1 byte Indicates whether the partition exists ( 0x01 Indicates that the partition is present, 0x0 Indicates that the partition does not exist);

2 byte Is the partition x Axis coordinates, 3 byte Is the partition y Axis;
4 byte Is the width of the partition, 5 byte Is the higher of the partition. 

0x2A , Read partitioning instructions

[Information head0x2A]+[parameter]+[information tail]   Feedback information format with the set of instructions partition instructions.

0x35 , Acquisition control card firmware version

[Information head0x35]+[parameter]+[information tail]

Will contribute to the information returned in the parameter control card firmware version in the format: [Control card type][firmware version][firmware version][revision][storage code]    

Part IV, the content of the note

  1. , In order to keep the response speed of the Terminal Server, usually terminal servers will not be doing too much validation of the package, the Terminal returns error means:
    1. Received packet format is correct, but the checksum validation errors. Error code is 1. (If the received packet format is incorrect, the terminal will drop the packet, no feedback information is issued)
    2. Received packet correctly, but the directive does not recognize. Error code is2.
    3. Received packet correctly, but the directive is not yet implemented or control card does not support. Error code is3.
    4. Parameter errors in the package, such as sending information specified when ID Is greater than the control card allows ID Upper limit, set the hardware parameter specifies the screen width exceeds the maximum range of. Error code is4. Return 0 Represents the execution is successful.
  2. Agreement support information ID Maximum value is 0xFFFF But control card models, support the amount of information is different.
  3. If there are multiple instructions to be sent, upon receipt of the instruction response on the server should then sent down instruction, instruction increased and continuous send 10ms More delay, otherwise the control card could fail to timely processing of the information received and packet.
  4. If you are sending information not received responses, can be considered timed out over time, try sending again. Timeout time depending on your network environment may be, if theGPRS, you should wait until at least1minute before they can determine the timeout. If you use serial line short-distance transport, the timeout can be set to200ms- seconds.
  5. Place all the time in the agreement, in the time of "hour" only accept 24 Hour If incoming 12 Hour, you may get the wrong result.

Fifth part UNICODE Coding details]

 

  1. Send text messages, send the processed UNICODE Encoding, UNICODE Coding either English or Chinese characters, are 16bit (That is, 2 Bytes). Such as "Ah"UNICODEencoding is "0x4A 0x55", the letter "a,"UNICODEencoding is "0x41 0x00".
  2. UNICODE And ANSI Encoding differences.

UNICODE 16bit Represents a character, English character and ANSI Code compatible. If the letter "a," in theANSIencoding is0x41,UNICODEis0x41 0x00, converted to a16bitof figures, is0x0041. Chinese characters and other parts of the world's languages, a unified code. (In our Board, fonts already contained all the Chinese characters (simplified, traditional, uncommon words), but does not include the text in other countries, such as Korean)

  1. Send text UNICODE Encoding, what to do

Control card at the time of received text is not intact receives its UNICODE Code, but to do some processing, displayed in a control card. Specific handling code to: (Where lpStr Is to convert the original UNICODE String pBuff Is the buffer used to store the conversion result)

void CopyWchar(LPCWSTR lpStr, WORD *pBuff)
{
  int nCount, nLen = 0;
  nCount = wcslen(lpStr);
  WCHAR ch;
  for(int i=0; i<nCount; i++)
  {
    ch = lpStr[i];
    if(ch >= 0x80)
    {
    if(ch <= 0xFF)
      ch -= 0x80;
    else if(ch >= 0x2000 && ch <= 0x266F)
      ch = ch - 0x2000 + 128;
    else if(ch >= 0x3000 && ch <= 0x33FF)
      ch = ch - 0x3000 + 1648 + 128;
    else if(ch >= 0x4E00 && ch <= 0x9FA5)
      ch = ch - 0x4E00 + 1648 + 1024 + 128; 
    else if(ch >= 0xF900 && ch <= 0xFFFF)
      ch = ch - 0xF900 + 1648 + 1024 + 20902 + 128;
    ch += 128; 
  }
  pBuff[i] = ch;
  }
}

 

Section VI, the sample package

1 , Send a text message “ LED Display "enter animation = "Displays at once", time = “ 2 ” , The color = "Red":

A0 40 00 01 00 00 00 00 00 00 00 00 00 03 03 02
01 00 00 00 0E 02 02 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 0C 00 01 00
4C 00 45 00 44 00 AE 23 AA 36 BF 19
68 04 00 50

  2 Sent time information "today 20xx Years xx Month xx Day weekXX, now timeXXShiXX. ”:

A0 70 00 01 00 06 00 00 00 00 00 00 00 03 00 00
02 00 01 00 0E 02 02 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 05 00 00 3C 00 00 00
3A 0C 99 16 9F 23 32 00 30 00 0B 00 0C 00 E4 1B
0D 00 0E 00 78 24 0F 00 10 00 55 23 20 00 8F 23
8F 24 15 00 22 63 20 31 98 14 66 23 64 53 11 00
12 00 66 23 13 00 14 00 76 0F 72 07
1B 0C 00 50

  3 , Set the display brightness to manual mode, brightness values =14 :

A0 34 00 01 00 07 00 00 00 00 00 00 00 10 00 00
0E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
FA 00 00 50

  4 , Clear the screen all of the information:

A0 34 00 01 00 12 00 00 00 00 00 00 00 06 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ED 00 00 50

5 Hardware settings:

A0 34 00 01 00 15 00 00 00 00 00 00 00 06 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
F0 00 00 50

  Note: by "all" button to send when the program is displayed, you must follow the following instruction sequence to send information, otherwise it will lead to send failed, as follows:

  1. Sent to close the screen instructions (0x19+parameter)
  2. Send display program
  3. Sending open screen instructions (0x19+parameter)

The specific meaning of the parameter, refer to the third part of the document's "specific command description" 0x19 Directive.   Off screen instructions:

A0 34 00 01 00 00 00 00 00 00 00 00 00 19 19 18
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1F 01 00 50

  Open screen instructions:

A0 34 00 01 00 00 00 00 00 00 00 00 00 19 19 18
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1F 01 00 50