Mot exact Résultats par page

Index des mots-clés

AGENDA PERSONNEL
ALBUM PHOTO (Script)
ANTI SPAM
APICULTURE
BOISSONS (Recettes)
BREDELE
C++
CADRE
CHARLOTTE AUX FRUITS
CODAGE ADRESSES MAIL
CODE 2 DE 5 ENTRELACE
CODE 3 DE 9
CODE 128
CODE PDF417
CODES BARRE
CODE POSTAL
CODES VIDEOTEXT
CONFITURES
CONGOLAIS
CONSERVES (Recettes)
CORNICHONS AU VINAIGRE
COUARAIL
CUISINE (Bases)
CYBERMUT
DADANT
DATAMATRIX
DDE
DESSERTS (Recettes)
DOUBLE NAT
DYNDNSUPDATE
EAN 13
EAN 128
ELECTRONIQUE
ENTREES (Recettes)
ENVOI DE SMS
ESPACE MEMBRE
EURO
EXEMPLES VB6
FAVORIS
FONCTIONS
FONCTIONS EN C++
GUACAMOLE
IMPRIMANTES RESEAUX
INSTANCE UNIQUE
KIT VB4
LANGSTROTH
LEGUMES (Recettes)
MADELEINES
MAISONS
MAQUEREAUX AU VIN BLANC
MAQUEREAUX (Rillettes)
NMEA
NOUGATINE
PAIN
PDF417
PHP
PIC
PLANS DE MAISON
PATISSERIE (Bases)
PLANTEUR
PLATS COMPLETS (Recettes)
POISSONS (Recettes)
PROCEDURES
PROGRAMMATION
RECETTES DE CUISINE
RESSOURCES RESEAUX
R.I.B.
ROUTINES
RUCHE
SALADES (Recettes)
SAUMON EN CROUTE
SCRIPTS
SITES
SLICE
SMS
SOUPE DE COURGE
TABLE PERIODIQUE
TATIN (Tarte)
USB
VIANDES (Recettes)
VIDEOTEXT
VISUAL BASIC
VOIRNOT
WNTIPCFG

Mot exact Résultats par page
I
N
D
E
X
 

The QR Code

French version
This code is part of the family of 2-dimensional codes, it can encode up to 7089 characters on a very small surface. The encoding is done in two steps : first the datas are converted into a bit stream cut into codewords. (High level encoding) then these are converted into small black and white squares. In addition, an error correction system makes it possible to reconstruct badly printed, erased, fuzzy or torn off datas. In the remainder of this presentation, the term "codeword" will be abbreviated to CW and Reed-Solomon code in RS. There are also micro QR codes not studied here.

The general structure.


Low level encoding.

There are 40 versions (Sizes) of symbol. A set of parameters is attached to each version :
From these parameters we can calculate other values, this is done using a spreadsheet :
We will find the calculation of the size of the symbol, the number and location of alignment patterns, the areas occupied by the various elements, etc ...
To build a QRcode you need :
Mask number Condition
000 (i + j) MOD 2 = 0
001 i MOD 2 = 0
010 j MOD 3 = 0
011 (i + j) MOD 3 = 0
100 ((i DIV 2) + (j DIV 3)) MOD 2 = 0
101 (i j) MOD 2 + (i j) MOD 3 = 0
110 ((i j) MOD 2 + (i j) MOD 3) MOD 2 = 0
111 ((i + j) MOD 2 + (i j) MOD 3) MOD 2 = 0

High level encoding.

We will use the following operators : + -> addition, x -> multiplication, \ -> integer division, MOD -> rest of the whole division
There are 4 encoding modes (Compression) that can be mixed :
Compression mode Data to be encoded Compression rate Mode indicator
Numeric ASCII digits 3 digits in 10 bits 0001
Alphanumeric Digits + capital letters + 9 symbols 2 characters in 11 bits 0010
Byte Byte 1 byte in 8 bits 0100
Kanji Asian characters / 1000
There are other indicators not studied here: 0111 = ECI, 0011 = Multi codes, 0101 and 1001 = FNC1
0000 indicate the end of datas.

Each segment begins with a 4-bit mode indicator followed by the number of characters encoded on a variable bit number (see table), followed by the data.

Detection and correction of errors.

The creation of barcodes.

Now that we know how to create a barcode pattern, we still have to draw it on the screen and print it on paper. Two approaches are possible :
It seems there is no free font for QRcode on the net. The font used for Datamatrix codes may be perfectly suitable. It consists of 16 combinations assigned to the first 16 capital letters.
If we give a value to each point of this 2 X 2 matrix like this :
1 2
4 8
The ASCII value of the character associated with a given matrix is the sum of the values of each point + 65 (65 = A = no point!)

The font " datamatrix.ttf " (Suitable for QRcodes)

This font contains the 16 characters A (ASCII: 65) to P (ASCII: 80)
Copy this file
in the directory of
fonts, most often :
C:\WINDOWS\FONTS

Encoding a QRcode

The program will have to take place in several stages : Because of the interaction between the different modes of compression it is difficult to make a 100% optimization. However, the standard gives in Appendix J a method of optimization ...
The evaluation of the results of the different masks will be done "by eye" and by testing the codes obtained.

A little program to test all that.

WORK IN PROGRESS

The function QRcode$ is about 900 lines, so I do not reproduce it here, just get it in the file "form1.frm" which is with the program above ; with the self-installation program the file "form1.frm" is located in the program directory, subdirectory "sources". The function is called as follows :
resultat$ = QRcode$(Chaine$, Level%, Mask%, Version%, CodeErr%) with Chaine$ which must contain the string to encode, Level% for the correction level, Mask% for the mask to use. On return Version% will give the code version (size) used and CodeErr% a possible error number. These last two parameters are optional and are passed by references.
Values of CodeErr% at the return of the function : 1: Chaine$ is empty 2: Chaine$ contains too much data.
You just have to display or print the result string with the Datamatrix font for example in a word processor. Word users will even be able to integrate the QRcode$ function into a macro to automate the process. To achieve all the treatments in a single function, I had to use "Gosub" instead of functions with parameters ; I can already hear the programming esthetes screaming sacrilegious !

Do you like this page ?

Is it useful to you ?

Click here !