How to create QRcode page2

previous page  next page

top page > QRcode > How to create QRcode > page2: How to encode - Capacity. Encoding to data code words.

2. How to encode

This document is describe how to encode with an easy example, and no complex function(like structured append) is.

2.1 Capacity

Capacity of a QRcode is determined by version,error correcting level and encoding mode(e.g. numeric,alphanumeric etc)
For example, In version 1 and error correcting level Q, 27 numeric characters can be stored or 16 alphanumeric characters can be stored. 11 byte data can also be stored. (see table1)
Conversely ,version increases when error correct level is higher in same data. So, first we need consider error correcting level,and next we consider version if necessary.

2.2 encode to data code words.

8bit data is treated as a code word. We calculate or put data in this unit. In this section,"how to transform input data to code words" is described.

Now we think to encode example source data "ABCDE123" to QRcode in version1-error correcting level H (below 1-H).

2.2.1 Mode indicator

First,mode indicator is created in 4 bit long as binary representation.

numeric mode : 0001
alphanumeric mode : 0010
8bit byte mode: 0100
KANJI mode : 1000

Example data is alphanumeric,and we select an alphanumeric mode.


2.2.2 Character count indicator

Character count indicator is character counts stored in each mode.

In version 1-9

numeric : 10bit long
alphanumeric : 9bit long
8bit byte : 8bit long
KANJI mode : 8bit long

Example data have 8 characters,we encode 8 in 9bit long binary representation for alphanumeric mode.

0010 000001000

2.2.3 Encoding data in binary representation

Next we think to encode source data to binary representation.

In numeric mode ,data is delimited by 3 digits.
For example,"123456" is delimited "123" and "456",and first data is "123",second data is "456".
And each data is encoded in 10bit long binary representation.

When length of delimited data is 1 or 2, 4bit long or 7bit long are used in each case.
For example,"9876" is delimited "987" in 10 bit long and "6" in 4 bit long.
Its result is "1111011011 0110"

In alphanumeric mode ,each character is converted to value in rule of table2.
Next we consider delimited data by 2 numbers. First value increase 45 times and second value is added to it. Result value is encoded in 11bit long binary representation. When length of delimited data is 1,6bit long are used.

In example data

0010000001000 00111001101 01000101001 01001110111 00001011101

In 8bit byte mode,each value is directly encoded in 8bit long binary representation.

2.2.4 Terminator

We add 0000 to result data in section 2.2.3. When length of encoded data is full in this version and error correcting level,terminator is not needed.

0010 000001000 00111001101 01000101001 01001110111 00001011101 0000

2.2.5 Encode to code words

Result data in section 2.2.4 are delimited by 8bit.

00100000 01000001 11001101 01000101 00101001 11011100 00101110 10000

If last data length is less than 8,padded 0.

00100000 01000001 11001101 01000101 00101001 11011100 00101110 10000000

If count of code words is less than symbol's capacity (table1) ,then we alternately put "11101100" and "00010001" until full capacity.

Now capacity of 1-H are 9,

00100000 01000001 11001101 01000101 00101001 11011100 00101110 10000000 11101100

To decimal representation...

32 65 205 69 41 220 46 128 236

next page : Calculating error correcting code words .

previous page    [1] [2] [3] [4] [5] [6] [7]   next page