English
Source / code snippets

EAN13 Barcode Generate.

 

Thomas
Zielinski
Hi,
the EAN13 Barcode isn't just a follow of transformed numbers in Striche separate unterliegt some regulate.
naturally must it neither simply munter on it go used go separate unterliegt the allocation entsprechender Länderstellen.
EAN 13 Codes The with of/ one 2 begin are though for a flexibleren employment How on the Wursttheke or in the Gemüseabteilung reserved.

One EAN13 code exists from 13 Digits. the first 2 To 3 Digits give the country the spending on, followed a 5- or 7-Stelligen Betriebsnummer, the actual Artikelnummer and on 13. place a Prüfzahl.

for the individual to put 0-9 there each 3 possible orders the beam dependent upon yours position in the Barcode and the first digit.
The first digit won't directly Translated, separate yields itself from the order the Digits 2 To 7. The Digits 8 To 13 go but always to the same schema prepares.

The enclosed Source is Perhaps not sonderlich elegant resolved, but functions for my proposition.


//EAN 13 code
//Thomas Zielinski - october 2021
//   left             right Parität
//   Ungerade straight   right 1. digit
//0: 0001101  0100111 1110010 UUUUUU
//1: 0011001  0110011 1100110 UUGUGG
//2: 0010011  0011011 1101100 UUGGUG
//3: 0111101  0100001 1000010 UUGGGU
//4: 0100011  0011101 1011100 UGUUGG
//5: 0110001  0111001 1001110 UGGUUG
//6: 0101111  0000101 1010000 UGGGUU
//7: 0111011  0010001 1000100 UGUGUG
//8: 0110111  0001001 1001000 UGUGGU
//9: 0001011  0010111 1110100 UGGUGU
//construction: Start - 6 Digits left - middle - 6 Digits right - end
//The first digit yields itself from the distribution the Digits 2 To 7 according the scheduler whether a straight or a ungerade Quersumme apply becomes.
//101 2. 3. 4. 5. 6. 7. 01010 8. 9. 10. 11. 12. 13. 101
//101 u u G G u G 01010 R R R R R R 101  <- 2. To 7. whether u or G see Parität (in the example here The 2)
//The 1. number ought to always one 2 his. All other Digits are by the EAN Ländern zugeordnet and only to allocation useable. The 2 but is for Einzellhandel and can discretionary used go.
// The 13. number is a Prüfziffer and errechnet itself from Modulo10((1.+3.+5.+7.+9.+11.)+((2.+4.+6.+8.+10.+12.)*3)); Ifnot erg% == 0 Then erg% = 10-erg%
// it verbleiben means only 11 Digits to that give away if one no number allocated get has. Therotisch can The 2. digit in the 2it-area ditto by the Zuständige Vergabestelle pretended his. the Ignoriere I here but.
// with the Zuweisung get one incidentally only the first 5 or 7 Digits allocated. The Restlichen Digits can spare chosen go, where The 13. The Prüfziffer is.
Declare numbers$, Digits%[], i%, EAN$, ErstCode$[]
CLS
//Paritätstabelle
ErstCode$[0] = "UUUUUU"
ErstCode$[1] = "UUGUGG"
ErstCode$[2] = "UUGGUG"
ErstCode$[3] = "UUGGGU"
ErstCode$[4] = "UGUUGG"
ErstCode$[5] = "UGGUUG"
ErstCode$[6] = "UGGGUU"
ErstCode$[7] = "UGUGUG"
ErstCode$[8] = "UGUGGU"
ErstCode$[9] = "UGGUGU"
Print "Geben tappt im dunkeln 12 Digits one:"
Print "Die first number ought to a 2 his for retail."
Input numbers$
//numbers$ = "269854713256"
//ACHTUNG! here no check on plausibilität. recommend I but urgently.
i% = 0
For i%,12
Ziffern%[i%] = SubStr$(numbers$,i%)
Print "Ziffer " + Str $(i%)+": "+Str $(Digits%[i%])
EndFor
//Prüfziffer to charge
Ziffern%[13] = 10-(((Digits%[1]+Digits%[3]+Digits%[5]+Digits%[7]+Digits%[9]+Digits%[11])+((Digits%[2]+Digits%[4]+Digits%[6]+Digits%[8]+Digits%[10]+Digits%[12])*3)) MOD 10)

If Digits%[13] = 10

    Digits%[13] = 0

EndIf

Print "Ziffer 13: "+Str $(Digits%[13])
//Startbereich Insert
EAN$ = "101"
i% = 0
For i%,12

If i% <= 6

    //to the middle

    SELECT Digits%[i%+1]

        CASEOF 0

        If SubStr$(ErstCode$[Digits%[1]],i%) = "U"

            EAN$ = EAN$ + "0001101"

        Else

            EAN$ = EAN$ + "0100111"

        EndIf

        CASEOF 1

        If SubStr$(ErstCode$[Digits%[1]],i%) = "U"

            EAN$ = EAN$ + "0011001"

        Else

            EAN$ = EAN$ + "0110011"

        EndIf

        CASEOF 2

        If SubStr$(ErstCode$[Digits%[1]],i%) = "U"

            EAN$ = EAN$ + "0010011"

        Else

            EAN$ = EAN$ + "0011011"

        EndIf

        CASEOF 3

        If SubStr$(ErstCode$[Digits%[1]],i%) = "U"

            EAN$ = EAN$ + "0111101"

        Else

            EAN$ = EAN$ + "0100001"

        EndIf

        CASEOF 4

        If SubStr$(ErstCode$[Digits%[1]],i%) = "U"

            EAN$ = EAN$ + "0100011"

        Else

            EAN$ = EAN$ + "0011101"

        EndIf

        CASEOF 5

        If SubStr$(ErstCode$[Digits%[1]],i%) = "U"

            EAN$ = EAN$ + "0110001"

        Else

            EAN$ = EAN$ + "0111001"

        EndIf

        CASEOF 6

        If SubStr$(ErstCode$[Digits%[1]],i%) = "U"

            EAN$ = EAN$ + "0101111"

        Else

            EAN$ = EAN$ + "0000101"

        EndIf

        CASEOF 7

        If SubStr$(ErstCode$[Digits%[1]],i%) = "U"

            EAN$ = EAN$ + "0111011"

        Else

            EAN$ = EAN$ + "0010001"

        EndIf

        CASEOF 8

        If SubStr$(ErstCode$[Digits%[1]],i%) = "U"

            EAN$ = EAN$ + "0110111"

        Else

            EAN$ = EAN$ + "0001001"

        EndIf

        CASEOF 9

        If SubStr$(ErstCode$[Digits%[1]],i%) = "U"

            EAN$ = EAN$ + "0001011"

        Else

            EAN$ = EAN$ + "0010111"

        EndIf

    ENDSELECT

    //Mittleren area insert

    If i% = 6

        EAN$ = EAN$ + "01010"

    EndIf

Else

    //After the middle

    SELECT Digits%[i%+1]

        CASEOF 0

        EAN$ = EAN$ + "1110010"

        CASEOF 1

        EAN$ = EAN$ + "1100110"

        CASEOF 2

        EAN$ = EAN$ + "1101100"

        CASEOF 3

        EAN$ = EAN$ + "1000010"

        CASEOF 4

        EAN$ = EAN$ + "1011100"

        CASEOF 5

        EAN$ = EAN$ + "1001110"

        CASEOF 6

        EAN$ = EAN$ + "1010000"

        CASEOF 7

        EAN$ = EAN$ + "1000100"

        CASEOF 8

        EAN$ = EAN$ + "1001000"

        CASEOF 9

        EAN$ = EAN$ + "1110100"

    ENDSELECT

EndIf

EndFor
//Endbereich insert
EAN$ = EAN$+"101"
Print EAN$
Print Str $(Len(EAN$))+" Blöcke"//If not 95 as Result comes is anything schief run
//a couple Leerzeilen
Print ""
Print ""
Print ""
Print ""
Print ""
Print ""
Print ""
Print ""
Print ""
//draw
Print "  "+Str $(Digits%[1])+"    "+Str $(Digits%[2])+Str $(Digits%[3])+Str $(Digits%[4])+Str $(Digits%[5])+Str $(Digits%[6])+Str $(Digits%[7])+"     "+Str $(Digits%[8])+Str $(Digits%[9])+Str $(Digits%[10])+Str $(Digits%[11])+Str $(Digits%[12])+Str $(Digits%[13])
USEP 0,1,RGB(0,0,0)
i% = 0
For i%,95

If SubStr$(EAN$,i%) = 1

    SELECT i%

        CASEOF 1,2,3,46,47,48,49,50,95,94,93

        Line 30+2*i%-1,300 - 30+2*i%-1,370
        Line 30+2*i%,300 - 30+2*i%,370
        OTHERWISE
        Line 30+2*i%-1,300 - 30+2*i%-1,350
        Line 30+2*i%,300 - 30+2*i%,350

    ENDSELECT

EndIf

EndFor
Waitinput
End

12 kB
Bezeichnung:Screenshot
Version:0.1
Kurzbeschreibung: Screenshot the performed Codes EAN13
Hochgeladen:10/23/21
Downloadcounter76
Download
 
XProfan X4; Win10 x64
Der Kuchen ist eine lüge!
10/23/21  
 




p.specht

Hab´s for XProfan-11.2a free retro-transponiert. Klappt now too compiliert ( Doppelpunkte in Kommentarzeilen interprets the old boy Compiler as Zeilentrenner and wundert itself then over unknown command).
deference, weitestgehend ungetestet - therefore without each Gewähr! Prüfbar through online-Generator of  [...] 
'  'EAN 13 Strichcode Generate' by Thomas Zielinski, Okt.2021
' Retro-transponiert to XProfan-11.2a free by p.woodpecker in Nov.2021

' Grundsätzlicher EAN-13-Strichodeaufbau:
' Start="101" - 6 Digits left - Mitte="01010" - 6 Digits right - Ende="101"

' left Mitte=01010 right Parität
' Ungerade straight right the 1. digit
' *) **)
' 0- 0001101 0100111 1110010 UUUUUU
' 1- 0011001 0110011 1100110 UUGUGG
' 2- 0010011 0011011 1101100 UUGGUG
' 3- 0111101 0100001 1000010 UUGGGU
' 4- 0100011 0011101 1011100 UGUUGG
' 5- 0110001 0111001 1001110 UGGUUG
' 6- 0101111 0000101 1010000 UGGGUU
' 7- 0111011 0010001 1000100 UGUGUG
' 8- 0110111 0001001 1001000 UGUGGU
' 9- 0001011 0010111 1110100 UGGUGU
' ____
' *) "left ungerade" becomes here invertiert and center gespiegelt
' **)"left ungerade" becomes binary invertiert.

' Aufbau= Startcode - 6 Digits left - Mittencode - 6 Digits right - Endecode
' The Codierung the first digit (The whom Anwendungsbereich mark) yields itself for Stringpositionen 2 To 7 from the obigen scheduler,
' the piloting, whether a straight or a ungerade Quersumme apply becomes.
' in the nachstehenden example be these first digit = 2 ("retail")
' 101 2. 3. 4. 5. 6. 7. 01010 8. 9. 10. 11. 12. 13. 101 <- Stringpositionsfestlegung für das Programm
' 101 u u G G u G 01010 R R R R R R 101 <- 2. bis 7. Ob U oder G siehe Parität oben

' The 1. number (Stringposition 2) ought to in this Anwendungsfall always on the WErt 2 lauten,
' any others Digits except 2 are by the EAN designed Ländern zugeordnet and only to offiieller allocation useable.
' The 2 but is for retail generally and can then more or less discretionary used go.
' it verbleiben means only 11 Digits to disengaged allocation if one no number allocated get has.
' Therotisch can The 2. digit in the 2it-area ditto by the zuständige Vergabestelle pretended his. the Ignoriere I here but.
' with the Zuweisung get one incidentally the first 5 or 7 Digits (Herstellerkennung) allocated. only
' The restlichen 7 To 5 positions can then spare chosen go.

' The 13. number is a Prüfziffer and errechnet itself from the following Formel
' PrüfZiffer = Modulo10((1.+3.+5.+7.+9.+11.)+((2.+4.+6.+8.+10.+12.)*3)); Ifnot erg% == 0 Then erg% = 10-erg%

Window Title "EAN-13 for XProfan-11 free, to Orig. Thomas Zielinski"
Window Style 24

Declare numbers$, Digits%[], i%, EAN$, ErstCode$[], ans$
' Paritätstabelle
ErstCode$[0] = "UUUUUU"
ErstCode$[1] = "UUGUGG"
ErstCode$[2] = "UUGGUG"
ErstCode$[3] = "UUGGGU"
ErstCode$[4] = "UGUUGG"
ErstCode$[5] = "UGGUUG"
ErstCode$[6] = "UGGGUU"
ErstCode$[7] = "UGUGUG"
ErstCode$[8] = "UGUGGU"
ErstCode$[9] = "UGGUGU"

Loop:
CLS
Print "\nBitte give tappt im dunkeln The 12 Digits one (The first ought to 2 his for retail):"
Print "............"
Input numbers$
' numbers$ = "269854713256"
' ACHTUNG! here no check on Plausibilität. recommend I but urgently.
if len(numbers$)<>12
print " *** Ziffernanzahl 12 is correct not! ***"
beep
waitinput
goto "Loop"
endif

Clear Digits%[]
Whileloop 12:i%=&Loop
Digits%[i%] = val(Mid$(numbers$,i%,1))
Print "digit Nr." + Str$(i%)+": "+Str$(Digits%[i%])
EndWhile
' Prüfziffer to charge
Digits%[13] = 10-(((Digits%[1]+Digits%[3]+Digits%[5]+Digits%[7]+Digits%[9]+Digits%[11])+\
((Digits%[2]+Digits%[4]+Digits%[6]+Digits%[8]+Digits%[10]+Digits%[12])*3)) MOD 10)
Case Digits%[13] = 10:Digits%[13] = 0
Print "Prüfziffer 13: "+Str$(Digits%[13])

' Startbereich Insert
EAN$ = "101"
Whileloop 12:i%=&Loop
If i% <= 6 ' Vor der Mitte:
SELECT Ziffern%[i%+1]
CASEOF 0
If SubStr$(ErstCode$[Ziffern%[1]],i%) = "U"
EAN$ = EAN$ + "0001101"
Else
EAN$ = EAN$ + "0100111"
EndIf
CASEOF 1
If SubStr$(ErstCode$[Ziffern%[1]],i%) = "U"
EAN$ = EAN$ + "0011001"
Else
EAN$ = EAN$ + "0110011"
EndIf
CASEOF 2
If SubStr$(ErstCode$[Ziffern%[1]],i%) = "U"
EAN$ = EAN$ + "0010011"
Else
EAN$ = EAN$ + "0011011"
EndIf
CASEOF 3
If SubStr$(ErstCode$[Ziffern%[1]],i%) = "U"
EAN$ = EAN$ + "0111101"
Else
EAN$ = EAN$ + "0100001"
EndIf
CASEOF 4
If SubStr$(ErstCode$[Ziffern%[1]],i%) = "U"
EAN$ = EAN$ + "0100011"
Else
EAN$ = EAN$ + "0011101"
EndIf
CASEOF 5
If SubStr$(ErstCode$[Ziffern%[1]],i%) = "U"
EAN$ = EAN$ + "0110001"
Else
EAN$ = EAN$ + "0111001"
EndIf
CASEOF 6
If SubStr$(ErstCode$[Ziffern%[1]],i%) = "U"
EAN$ = EAN$ + "0101111"
Else
EAN$ = EAN$ + "0000101"
EndIf
CASEOF 7
If SubStr$(ErstCode$[Ziffern%[1]],i%) = "U"
EAN$ = EAN$ + "0111011"
Else
EAN$ = EAN$ + "0010001"
EndIf
CASEOF 8
If SubStr$(ErstCode$[Ziffern%[1]],i%) = "U"
EAN$ = EAN$ + "0110111"
Else
EAN$ = EAN$ + "0001001"
EndIf
CASEOF 9
If SubStr$(ErstCode$[Ziffern%[1]],i%) = "U"
EAN$ = EAN$ + "0001011"
Else
EAN$ = EAN$ + "0010111"
EndIf
ENDSELECT
' Mittleren Bereich einfügen
If i% = 6
EAN$ = EAN$ + "01010"
EndIf
Else
' After the middle
SELECT Digits%[i%+1]
CASEOF 0
EAN$ = EAN$ + "1110010"
CASEOF 1
EAN$ = EAN$ + "1100110"
CASEOF 2
EAN$ = EAN$ + "1101100"
CASEOF 3
EAN$ = EAN$ + "1000010"
CASEOF 4
EAN$ = EAN$ + "1011100"
CASEOF 5
EAN$ = EAN$ + "1001110"
CASEOF 6
EAN$ = EAN$ + "1010000"
CASEOF 7
EAN$ = EAN$ + "1000100"
CASEOF 8
EAN$ = EAN$ + "1001000"
CASEOF 9
EAN$ = EAN$ + "1110100"
ENDSELECT
EndIf
EndWhile
' Endbereich insert
EAN$ = EAN$+"101"
Print EAN$
Print Str$(Len(EAN$))+" Blöcke"
if len(EAN$)<>95
print " *** If not 95 as Result comes is evident anything schief run! ***"
beep
waitinput
Endif
' a couple Leerzeilen
Print ""
Print ""
Print ""
Print ""
Print ""
Print ""
Print ""
' draw
Print " "+Str$(Digits%[1])+" "+Str$(Digits%[2])+Str$(Digits%[3])+Str$(Digits%[4])+Str$(Digits%[5])+Str$(Digits%[6])+Str$(Digits%[7])+" "+Str$(Digits%[8])+Str$(Digits%[9])+Str$(Digits%[10])+Str$(Digits%[11])+Str$(Digits%[12])+Str$(Digits%[13])
USEP 0,1,RGB(255,0,0)
WHILELOOP 95:i%=&Loop
If val(mid$(EAN$,i%,1)) = 1
SELECT i%
CASEOF 1,2,3,46,47,48,49,50,95,94,93
Line 30+2*i%-1,300 - 30+2*i%-1,370
Line 30+2*i%,300 - 30+2*i%,370
OTHERWISE
Line 30+2*i%-1,300 - 30+2*i%-1,350
Line 30+2*i%,300 - 30+2*i%,350
ENDSELECT
EndIf
EndWHILE
print
print
beep
print "\nEinen further code Generate? (j/n) ";
input ans$
ans$=lower$(left$(ans$,1))
case ans$="j":goto "Loop"
print "Well then: On see again!"
beep
waitinput 2500
END
 
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
11/05/21  
 




p.specht

The EAN-13 code is in Österreich since some Time GS1-code, How this PDF ours Wirtschaftskammer To entnehmen is:  [...] 
 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
11/06/21  
 




p.specht

One EAN-13-Scanner-Algorithmus becomes zB HIER (pdf) described:  [...] 

though is the Deepl-übersetzte Text for 1.digit = 8, the heard naturally adjusted:

Zit.: DEKODIERUNGSALGORITHMUS
The Barcodenummer is with Help the Arrays the beam-wide dekodiert. The first Paragraph here always 8, there it itself around the first digit the Ländercodes deals and is solid. How from scheduler 1 hervorgeht, becomes The first
group of 6 Digits as LGLGGL codiert and the latest group
of 6 Digits as RRRRR verschlüsselt. Each digit becomes through 4 beam displayed, where the black and weißen beam varying. for
the first 6 Digits is the first beam always one weißer beam and the next Black an so on. with whom last 6 Digits is it very inverse. One beam can four wide of 1 To 4 having. from the row the beam-wide are the first and last three wide always one, what the beginning and the end the Strichcodes angibt.

The verbleibenden wide are each 4 group, there a defined
digit through 4 beam displayed becomes. In scheduler 2 standing 0 for white, and 1 standing for Black. If to that example a group of 4 wide (a number from whom first 6 Digits present) The number 3112 is, becomes tappt im dunkeln as 0001011 viewing (3 is the wide one weißen beam and becomes therefore through three nobodies displayed). here's means 3 The wide one weißen Balkens, 1 The wide one black Balkens an so on. from the scheduler1 is these first group of 4 wide, The under the L-code kodiert is, in scheduler 2 under the L-code sought, and becomes with the code the digit 9 coincide. accordingly becomes The first digit as 9 dekodiert. too The others Digits go with Help the scheduler dekodiert.
Zit. end, details sh. Literaturhinweise in the pdf,
 
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
11/14/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

2.838 Views

Themeninformationen

this Topic has 2 subscriber:

p.specht (3x)
Thomas Zielinski (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie