Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_36.ADF » F/+BARCD1
F/+BARCD1
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_36.ADF |
Filename: | F/+BARCD1 |
Read OK: | ✔ |
File size: | 1669 bytes |
Load address: | 2B204556 |
Exec address: | 43524142 |
Duplicates
There is 1 duplicate copy of this file in the archive:
- Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_36.ADF » F/+BARCD1
- Personal collection » Acorn hard disk » zipped_disks » elk03 » eug36/F/+BARCD1
File contents
Barcode scanner instructions ============================ A while back I managed to get hold of a second hand barcode scanner which had previosly been used in a stationery store.It appears to be the equivalent to Maplin Electronics part number KV75S.It came with an unlabelled 5 pin DIN plug which would have connected to the host terminal. Assuming you have one of these scanner in front of you (from Maplin,a closed down shop,or 2nd hand from Micromart) then take the lid off.Some of the screws may be concealed by rubber grommets or labels so don't force the top off. Inside you'll see a massively integrated chip at the heart a handful of tiny electrolytic capacitors and what looks like a blank calculator display pointing up to a mirror. Don't get grubby fingerprints on this part - that blank grey rectangle is the CCD (charge-coupled-device) which converts light into charges. Where the DIN plug wire terminates there should be just 3 wires used.They may be colour coded in black/red/yellow (for example) for 0v/5v/data but don't rely on this! Look around at all the chips and the PCB tracks.You'll find that one of the wires goes to nearly all the parts so this is probably 0v.Another dead giveaway is that tracing it immediately it enters the board it should go to the '-' terminal of a supply smoothing capacitor and one of the remaining 2 wires will go to the '+' side.So that's the supply sorted. To make sure,attach it to a 5v supply QUICKLY and the row of red or green scanning LEDs will light.You wont (generally) damage anything if you did get it wrong if you did it quick enough. The last of the 3 leads is data out.If you have am oscilloscope that can be triggering in 'once only' mode then when you scan a valid barcode a waveform like that in the diagram will occur. It consists of a wide sync pulse (data line drops from 5v to 0v) then a stream of data which (using your artistic judgement) exactly aligns with the black and white stripes on the barcode. PARTS... Page 435 of the User Guide shows the pinouts of the user port,in addition you will need to have the following parts: 1x CCD barcode scanner (eg.KV75S from Maplin Electronics) 1x 20 pin female IDC plug In addition it may be necessary to have some strong glue DETAIL... *Monitor stock levels in a store of some kind (eg.Scouts/Library) *Hardware recognises all known barcode formats automatically *Hardware automatically rights a code if it was scanned up-side-down *The hardware generates no clock pulse,so data must be read in by polling the port and not by clocking in under interrupts. BUILD... 1.Cut off the useless DIN plug as that wont fit in the user port 2.Attach the line discovered to be 5v to the 5v line on the user port 3.Likewise for 0v 4.Ensure that the data is clocked in on PB0 5.It may be necessary to solder these into place carefully as the cable is not true IDC cable and probably wont splice properly onto the connectors 6.As the cable is round and not ribbon cable,apply some glue to the cable so that tugs on it wont cause stress to the joints made in 3,4,5 above. SOFTWARE... The program CODE13 should be available to you,which demonstrates how to read a code 13 type barcode with the hardware.If there is a particular coding method you wish to be able to read then the end half of the program will need to be altered to suit. To use the software CHAIN"CODE13" or the equivalent command. The message 'Waiting for scan...' appears as a machine code loop polls the user port until the sync pulse is found.It will then (as fast as it can) build a table of the number of reads to the user port that occured before the data changed,and hence these are directly proportional to the width of the pulse. The machine code returns to the caller when the same value is read from the port 255 times.It is then assumed that no more transmissions follow.A value is returned in X which is the length of the table created. Since data always starts at 1 so a typical table might consist of Logic value on PB0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 etc... Number of loops 20 4F 20 20 65 20 20 4F 4F 20 63 23 22 4D 20 etc... As you can see the timing coming from the scanner is not crisp and clean so some filtering is needed.For demonstration purposes only code 13 barcodes are handled and rather crudely too! The following is applied: Find average unit length of bar by averaging the end 3 bits and start 3 bits (start/stop bars) Go through each table entry assigning a normalised length of between 1 and 4 long as the maximum code 13 repeat length is 4 consecutive digits. So for example above Logic value on PB0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 etc... Number of loops 20 4F 20 20 65 20 20 4F 4F 87 63 23 22 4D 20 etc... Normalised value 1 2 1 1 3 1 1 2 2 4 3 1 1 2 1 etc... Which means that the scanned code must have been 10010111010011000011101001... This is then checked for start/stop/guard bits and correct length and then decoded.You'll need to tell the computer what the first number of the barcode is (this is norally printed underneath!) which is the combination number.When and ONLY when this number is correct will all the digits decode properly.It is left to the reader to add an extra loop from 0 to 9 to try by guessing to find what that digit is,and hence get the whole barcode without needing end user input. Note that scans wont always be accepted the first time,due to an incorrect length code 13 barcode.Keep trying,it's because the filtering is so crude.Try using a standard deviation instead of averaging the start/stop bit lengths.Or adjust the size of the window you look through.
00000000 0d 42 61 72 63 6f 64 65 20 73 63 61 6e 6e 65 72 |.Barcode scanner| 00000010 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 0d 3d 3d | instructions.==| 00000020 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d |================| 00000030 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0d 41 20 77 68 69 |==========.A whi| 00000040 6c 65 20 62 61 63 6b 20 49 20 6d 61 6e 61 67 65 |le back I manage| 00000050 64 20 74 6f 20 67 65 74 20 68 6f 6c 64 20 6f 66 |d to get hold of| 00000060 20 61 20 73 65 63 6f 6e 64 20 68 61 6e 64 20 62 | a second hand b| 00000070 61 72 63 6f 64 65 20 73 63 61 6e 6e 65 72 20 77 |arcode scanner w| 00000080 68 69 63 68 20 68 61 64 0d 70 72 65 76 69 6f 73 |hich had.previos| 00000090 6c 79 20 62 65 65 6e 20 75 73 65 64 20 69 6e 20 |ly been used in | 000000a0 61 20 73 74 61 74 69 6f 6e 65 72 79 20 73 74 6f |a stationery sto| 000000b0 72 65 2e 49 74 20 61 70 70 65 61 72 73 20 74 6f |re.It appears to| 000000c0 20 62 65 20 74 68 65 20 65 71 75 69 76 61 6c 65 | be the equivale| 000000d0 6e 74 20 74 6f 20 0d 4d 61 70 6c 69 6e 20 45 6c |nt to .Maplin El| 000000e0 65 63 74 72 6f 6e 69 63 73 20 70 61 72 74 20 6e |ectronics part n| 000000f0 75 6d 62 65 72 20 4b 56 37 35 53 2e 49 74 20 63 |umber KV75S.It c| 00000100 61 6d 65 20 77 69 74 68 20 61 6e 20 75 6e 6c 61 |ame with an unla| 00000110 62 65 6c 6c 65 64 20 35 20 70 69 6e 20 44 49 4e |belled 5 pin DIN| 00000120 0d 70 6c 75 67 20 77 68 69 63 68 20 77 6f 75 6c |.plug which woul| 00000130 64 20 68 61 76 65 20 63 6f 6e 6e 65 63 74 65 64 |d have connected| 00000140 20 74 6f 20 74 68 65 20 68 6f 73 74 20 74 65 72 | to the host ter| 00000150 6d 69 6e 61 6c 2e 0d 0d 41 73 73 75 6d 69 6e 67 |minal...Assuming| 00000160 20 79 6f 75 20 68 61 76 65 20 6f 6e 65 20 6f 66 | you have one of| 00000170 20 74 68 65 73 65 20 73 63 61 6e 6e 65 72 20 69 | these scanner i| 00000180 6e 20 66 72 6f 6e 74 20 6f 66 20 79 6f 75 20 28 |n front of you (| 00000190 66 72 6f 6d 20 4d 61 70 6c 69 6e 2c 61 20 63 6c |from Maplin,a cl| 000001a0 6f 73 65 64 0d 64 6f 77 6e 20 73 68 6f 70 2c 6f |osed.down shop,o| 000001b0 72 20 32 6e 64 20 68 61 6e 64 20 66 72 6f 6d 20 |r 2nd hand from | 000001c0 4d 69 63 72 6f 6d 61 72 74 29 20 74 68 65 6e 20 |Micromart) then | 000001d0 74 61 6b 65 20 74 68 65 20 6c 69 64 20 6f 66 66 |take the lid off| 000001e0 2e 53 6f 6d 65 20 6f 66 20 74 68 65 20 73 63 72 |.Some of the scr| 000001f0 65 77 73 0d 6d 61 79 20 62 65 20 63 6f 6e 63 65 |ews.may be conce| 00000200 61 6c 65 64 20 62 79 20 72 75 62 62 65 72 20 67 |aled by rubber g| 00000210 72 6f 6d 6d 65 74 73 20 6f 72 20 6c 61 62 65 6c |rommets or label| 00000220 73 20 73 6f 20 64 6f 6e 27 74 20 66 6f 72 63 65 |s so don't force| 00000230 20 74 68 65 20 74 6f 70 20 6f 66 66 2e 0d 0d 49 | the top off...I| 00000240 6e 73 69 64 65 20 79 6f 75 27 6c 6c 20 73 65 65 |nside you'll see| 00000250 20 61 20 6d 61 73 73 69 76 65 6c 79 20 69 6e 74 | a massively int| 00000260 65 67 72 61 74 65 64 20 63 68 69 70 20 61 74 20 |egrated chip at | 00000270 74 68 65 20 68 65 61 72 74 20 61 20 68 61 6e 64 |the heart a hand| 00000280 66 75 6c 20 6f 66 20 74 69 6e 79 0d 65 6c 65 63 |ful of tiny.elec| 00000290 74 72 6f 6c 79 74 69 63 20 63 61 70 61 63 69 74 |trolytic capacit| 000002a0 6f 72 73 20 61 6e 64 20 77 68 61 74 20 6c 6f 6f |ors and what loo| 000002b0 6b 73 20 6c 69 6b 65 20 61 20 62 6c 61 6e 6b 20 |ks like a blank | 000002c0 63 61 6c 63 75 6c 61 74 6f 72 20 64 69 73 70 6c |calculator displ| 000002d0 61 79 20 70 6f 69 6e 74 69 6e 67 0d 75 70 20 74 |ay pointing.up t| 000002e0 6f 20 61 20 6d 69 72 72 6f 72 2e 0d 0d 44 6f 6e |o a mirror...Don| 000002f0 27 74 20 67 65 74 20 67 72 75 62 62 79 20 66 69 |'t get grubby fi| 00000300 6e 67 65 72 70 72 69 6e 74 73 20 6f 6e 20 74 68 |ngerprints on th| 00000310 69 73 20 70 61 72 74 20 2d 20 74 68 61 74 20 62 |is part - that b| 00000320 6c 61 6e 6b 20 67 72 65 79 20 72 65 63 74 61 6e |lank grey rectan| 00000330 67 6c 65 20 69 73 20 74 68 65 0d 43 43 44 20 28 |gle is the.CCD (| 00000340 63 68 61 72 67 65 2d 63 6f 75 70 6c 65 64 2d 64 |charge-coupled-d| 00000350 65 76 69 63 65 29 20 77 68 69 63 68 20 63 6f 6e |evice) which con| 00000360 76 65 72 74 73 20 6c 69 67 68 74 20 69 6e 74 6f |verts light into| 00000370 20 63 68 61 72 67 65 73 2e 0d 0d 57 68 65 72 65 | charges...Where| 00000380 20 74 68 65 20 44 49 4e 20 70 6c 75 67 20 77 69 | the DIN plug wi| 00000390 72 65 20 74 65 72 6d 69 6e 61 74 65 73 20 74 68 |re terminates th| 000003a0 65 72 65 20 73 68 6f 75 6c 64 20 62 65 20 6a 75 |ere should be ju| 000003b0 73 74 20 33 20 77 69 72 65 73 20 75 73 65 64 2e |st 3 wires used.| 000003c0 54 68 65 79 20 6d 61 79 0d 62 65 20 63 6f 6c 6f |They may.be colo| 000003d0 75 72 20 63 6f 64 65 64 20 69 6e 20 62 6c 61 63 |ur coded in blac| 000003e0 6b 2f 72 65 64 2f 79 65 6c 6c 6f 77 20 28 66 6f |k/red/yellow (fo| 000003f0 72 20 65 78 61 6d 70 6c 65 29 20 66 6f 72 20 30 |r example) for 0| 00000400 76 2f 35 76 2f 64 61 74 61 20 62 75 74 20 64 6f |v/5v/data but do| 00000410 6e 27 74 0d 72 65 6c 79 20 6f 6e 20 74 68 69 73 |n't.rely on this| 00000420 21 0d 0d 4c 6f 6f 6b 20 61 72 6f 75 6e 64 20 61 |!..Look around a| 00000430 74 20 61 6c 6c 20 74 68 65 20 63 68 69 70 73 20 |t all the chips | 00000440 61 6e 64 20 74 68 65 20 50 43 42 20 74 72 61 63 |and the PCB trac| 00000450 6b 73 2e 59 6f 75 27 6c 6c 20 66 69 6e 64 20 74 |ks.You'll find t| 00000460 68 61 74 20 6f 6e 65 20 6f 66 20 74 68 65 20 0d |hat one of the .| 00000470 77 69 72 65 73 20 67 6f 65 73 20 74 6f 20 6e 65 |wires goes to ne| 00000480 61 72 6c 79 20 61 6c 6c 20 74 68 65 20 70 61 72 |arly all the par| 00000490 74 73 20 73 6f 20 74 68 69 73 20 69 73 20 70 72 |ts so this is pr| 000004a0 6f 62 61 62 6c 79 20 30 76 2e 41 6e 6f 74 68 65 |obably 0v.Anothe| 000004b0 72 20 64 65 61 64 20 67 69 76 65 61 77 61 79 0d |r dead giveaway.| 000004c0 69 73 20 74 68 61 74 20 74 72 61 63 69 6e 67 20 |is that tracing | 000004d0 69 74 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 69 |it immediately i| 000004e0 74 20 65 6e 74 65 72 73 20 74 68 65 20 62 6f 61 |t enters the boa| 000004f0 72 64 20 69 74 20 73 68 6f 75 6c 64 20 67 6f 20 |rd it should go | 00000500 74 6f 20 74 68 65 20 27 2d 27 0d 74 65 72 6d 69 |to the '-'.termi| 00000510 6e 61 6c 20 6f 66 20 61 20 73 75 70 70 6c 79 20 |nal of a supply | 00000520 73 6d 6f 6f 74 68 69 6e 67 20 63 61 70 61 63 69 |smoothing capaci| 00000530 74 6f 72 20 61 6e 64 20 6f 6e 65 20 6f 66 20 74 |tor and one of t| 00000540 68 65 20 72 65 6d 61 69 6e 69 6e 67 20 32 20 77 |he remaining 2 w| 00000550 69 72 65 73 20 0d 77 69 6c 6c 20 67 6f 20 74 6f |ires .will go to| 00000560 20 74 68 65 20 27 2b 27 20 73 69 64 65 2e 53 6f | the '+' side.So| 00000570 20 74 68 61 74 27 73 20 74 68 65 20 73 75 70 70 | that's the supp| 00000580 6c 79 20 73 6f 72 74 65 64 2e 0d 0d 54 6f 20 6d |ly sorted...To m| 00000590 61 6b 65 20 73 75 72 65 2c 61 74 74 61 63 68 20 |ake sure,attach | 000005a0 69 74 20 74 6f 20 61 20 35 76 20 73 75 70 70 6c |it to a 5v suppl| 000005b0 79 20 51 55 49 43 4b 4c 59 20 61 6e 64 20 74 68 |y QUICKLY and th| 000005c0 65 20 72 6f 77 20 6f 66 20 72 65 64 20 6f 72 20 |e row of red or | 000005d0 67 72 65 65 6e 20 0d 73 63 61 6e 6e 69 6e 67 20 |green .scanning | 000005e0 4c 45 44 73 20 77 69 6c 6c 20 6c 69 67 68 74 2e |LEDs will light.| 000005f0 59 6f 75 20 77 6f 6e 74 20 28 67 65 6e 65 72 61 |You wont (genera| 00000600 6c 6c 79 29 20 64 61 6d 61 67 65 20 61 6e 79 74 |lly) damage anyt| 00000610 68 69 6e 67 20 69 66 20 79 6f 75 20 64 69 64 20 |hing if you did | 00000620 67 65 74 20 69 74 0d 77 72 6f 6e 67 20 69 66 20 |get it.wrong if | 00000630 79 6f 75 20 64 69 64 20 69 74 20 71 75 69 63 6b |you did it quick| 00000640 20 65 6e 6f 75 67 68 2e 0d 0d 54 68 65 20 6c 61 | enough...The la| 00000650 73 74 20 6f 66 20 74 68 65 20 33 20 6c 65 61 64 |st of the 3 lead| 00000660 73 20 69 73 20 64 61 74 61 20 6f 75 74 2e 49 66 |s is data out.If| 00000670 20 79 6f 75 20 68 61 76 65 20 61 6d 20 6f 73 63 | you have am osc| 00000680 69 6c 6c 6f 73 63 6f 70 65 20 74 68 61 74 20 63 |illoscope that c| 00000690 61 6e 20 62 65 0d 74 72 69 67 67 65 72 69 6e 67 |an be.triggering| 000006a0 20 69 6e 20 27 6f 6e 63 65 20 6f 6e 6c 79 27 20 | in 'once only' | 000006b0 6d 6f 64 65 20 74 68 65 6e 20 77 68 65 6e 20 79 |mode then when y| 000006c0 6f 75 20 73 63 61 6e 20 61 20 76 61 6c 69 64 20 |ou scan a valid | 000006d0 62 61 72 63 6f 64 65 20 61 20 77 61 76 65 66 6f |barcode a wavefo| 000006e0 72 6d 0d 6c 69 6b 65 20 74 68 61 74 20 69 6e 20 |rm.like that in | 000006f0 74 68 65 20 64 69 61 67 72 61 6d 20 77 69 6c 6c |the diagram will| 00000700 20 6f 63 63 75 72 2e 0d 0d 49 74 20 63 6f 6e 73 | occur...It cons| 00000710 69 73 74 73 20 6f 66 20 61 20 77 69 64 65 20 73 |ists of a wide s| 00000720 79 6e 63 20 70 75 6c 73 65 20 28 64 61 74 61 20 |ync pulse (data | 00000730 6c 69 6e 65 20 64 72 6f 70 73 20 66 72 6f 6d 20 |line drops from | 00000740 35 76 20 74 6f 20 30 76 29 20 74 68 65 6e 20 61 |5v to 0v) then a| 00000750 20 73 74 72 65 61 6d 0d 6f 66 20 64 61 74 61 20 | stream.of data | 00000760 77 68 69 63 68 20 28 75 73 69 6e 67 20 79 6f 75 |which (using you| 00000770 72 20 61 72 74 69 73 74 69 63 20 6a 75 64 67 65 |r artistic judge| 00000780 6d 65 6e 74 29 20 65 78 61 63 74 6c 79 20 61 6c |ment) exactly al| 00000790 69 67 6e 73 20 77 69 74 68 20 74 68 65 20 62 6c |igns with the bl| 000007a0 61 63 6b 20 61 6e 64 0d 77 68 69 74 65 20 73 74 |ack and.white st| 000007b0 72 69 70 65 73 20 6f 6e 20 74 68 65 20 62 61 72 |ripes on the bar| 000007c0 63 6f 64 65 2e 0d 0d 50 41 52 54 53 2e 2e 2e 0d |code...PARTS....| 000007d0 50 61 67 65 20 34 33 35 20 6f 66 20 74 68 65 20 |Page 435 of the | 000007e0 55 73 65 72 20 47 75 69 64 65 20 73 68 6f 77 73 |User Guide shows| 000007f0 20 74 68 65 20 70 69 6e 6f 75 74 73 20 6f 66 20 | the pinouts of | 00000800 74 68 65 20 75 73 65 72 20 70 6f 72 74 2c 69 6e |the user port,in| 00000810 20 61 64 64 69 74 69 6f 6e 20 79 6f 75 0d 77 69 | addition you.wi| 00000820 6c 6c 20 6e 65 65 64 20 74 6f 20 68 61 76 65 20 |ll need to have | 00000830 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 61 |the following pa| 00000840 72 74 73 3a 0d 31 78 20 20 43 43 44 20 62 61 72 |rts:.1x CCD bar| 00000850 63 6f 64 65 20 73 63 61 6e 6e 65 72 20 28 65 67 |code scanner (eg| 00000860 2e 4b 56 37 35 53 20 66 72 6f 6d 20 4d 61 70 6c |.KV75S from Mapl| 00000870 69 6e 20 45 6c 65 63 74 72 6f 6e 69 63 73 29 0d |in Electronics).| 00000880 31 78 20 20 32 30 20 70 69 6e 20 66 65 6d 61 6c |1x 20 pin femal| 00000890 65 20 49 44 43 20 70 6c 75 67 0d 0d 49 6e 20 61 |e IDC plug..In a| 000008a0 64 64 69 74 69 6f 6e 20 69 74 20 6d 61 79 20 62 |ddition it may b| 000008b0 65 20 6e 65 63 65 73 73 61 72 79 20 74 6f 20 68 |e necessary to h| 000008c0 61 76 65 20 73 6f 6d 65 20 73 74 72 6f 6e 67 20 |ave some strong | 000008d0 67 6c 75 65 0d 0d 44 45 54 41 49 4c 2e 2e 2e 0d |glue..DETAIL....| 000008e0 2a 4d 6f 6e 69 74 6f 72 20 73 74 6f 63 6b 20 6c |*Monitor stock l| 000008f0 65 76 65 6c 73 20 69 6e 20 61 20 73 74 6f 72 65 |evels in a store| 00000900 20 6f 66 20 73 6f 6d 65 20 6b 69 6e 64 20 28 65 | of some kind (e| 00000910 67 2e 53 63 6f 75 74 73 2f 4c 69 62 72 61 72 79 |g.Scouts/Library| 00000920 29 0d 2a 48 61 72 64 77 61 72 65 20 72 65 63 6f |).*Hardware reco| 00000930 67 6e 69 73 65 73 20 61 6c 6c 20 6b 6e 6f 77 6e |gnises all known| 00000940 20 62 61 72 63 6f 64 65 20 66 6f 72 6d 61 74 73 | barcode formats| 00000950 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 0d 2a | automatically.*| 00000960 48 61 72 64 77 61 72 65 20 61 75 74 6f 6d 61 74 |Hardware automat| 00000970 69 63 61 6c 6c 79 20 72 69 67 68 74 73 20 61 20 |ically rights a | 00000980 63 6f 64 65 20 69 66 20 69 74 20 77 61 73 20 73 |code if it was s| 00000990 63 61 6e 6e 65 64 20 75 70 2d 73 69 64 65 2d 64 |canned up-side-d| 000009a0 6f 77 6e 0d 2a 54 68 65 20 68 61 72 64 77 61 72 |own.*The hardwar| 000009b0 65 20 67 65 6e 65 72 61 74 65 73 20 6e 6f 20 63 |e generates no c| 000009c0 6c 6f 63 6b 20 70 75 6c 73 65 2c 73 6f 20 64 61 |lock pulse,so da| 000009d0 74 61 20 6d 75 73 74 20 62 65 20 72 65 61 64 20 |ta must be read | 000009e0 69 6e 20 62 79 20 70 6f 6c 6c 69 6e 67 0d 20 74 |in by polling. t| 000009f0 68 65 20 70 6f 72 74 20 61 6e 64 20 6e 6f 74 20 |he port and not | 00000a00 62 79 20 63 6c 6f 63 6b 69 6e 67 20 69 6e 20 75 |by clocking in u| 00000a10 6e 64 65 72 20 69 6e 74 65 72 72 75 70 74 73 2e |nder interrupts.| 00000a20 0d 0d 42 55 49 4c 44 2e 2e 2e 0d 31 2e 43 75 74 |..BUILD....1.Cut| 00000a30 20 6f 66 66 20 74 68 65 20 75 73 65 6c 65 73 73 | off the useless| 00000a40 20 44 49 4e 20 70 6c 75 67 20 61 73 20 74 68 61 | DIN plug as tha| 00000a50 74 20 77 6f 6e 74 20 66 69 74 20 69 6e 20 74 68 |t wont fit in th| 00000a60 65 20 75 73 65 72 20 70 6f 72 74 0d 32 2e 41 74 |e user port.2.At| 00000a70 74 61 63 68 20 74 68 65 20 6c 69 6e 65 20 64 69 |tach the line di| 00000a80 73 63 6f 76 65 72 65 64 20 74 6f 20 62 65 20 35 |scovered to be 5| 00000a90 76 20 74 6f 20 74 68 65 20 35 76 20 6c 69 6e 65 |v to the 5v line| 00000aa0 20 6f 6e 20 74 68 65 20 75 73 65 72 20 70 6f 72 | on the user por| 00000ab0 74 0d 33 2e 4c 69 6b 65 77 69 73 65 20 66 6f 72 |t.3.Likewise for| 00000ac0 20 30 76 0d 34 2e 45 6e 73 75 72 65 20 74 68 61 | 0v.4.Ensure tha| 00000ad0 74 20 74 68 65 20 64 61 74 61 20 69 73 20 63 6c |t the data is cl| 00000ae0 6f 63 6b 65 64 20 69 6e 20 6f 6e 20 50 42 30 0d |ocked in on PB0.| 00000af0 35 2e 49 74 20 6d 61 79 20 62 65 20 6e 65 63 65 |5.It may be nece| 00000b00 73 73 61 72 79 20 74 6f 20 73 6f 6c 64 65 72 20 |ssary to solder | 00000b10 74 68 65 73 65 20 69 6e 74 6f 20 70 6c 61 63 65 |these into place| 00000b20 20 63 61 72 65 66 75 6c 6c 79 20 61 73 20 74 68 | carefully as th| 00000b30 65 20 63 61 62 6c 65 20 69 73 0d 20 20 6e 6f 74 |e cable is. not| 00000b40 20 74 72 75 65 20 49 44 43 20 63 61 62 6c 65 20 | true IDC cable | 00000b50 61 6e 64 20 70 72 6f 62 61 62 6c 79 20 77 6f 6e |and probably won| 00000b60 74 20 73 70 6c 69 63 65 20 70 72 6f 70 65 72 6c |t splice properl| 00000b70 79 20 6f 6e 74 6f 20 74 68 65 20 63 6f 6e 6e 65 |y onto the conne| 00000b80 63 74 6f 72 73 0d 36 2e 41 73 20 74 68 65 20 63 |ctors.6.As the c| 00000b90 61 62 6c 65 20 69 73 20 72 6f 75 6e 64 20 61 6e |able is round an| 00000ba0 64 20 6e 6f 74 20 72 69 62 62 6f 6e 20 63 61 62 |d not ribbon cab| 00000bb0 6c 65 2c 61 70 70 6c 79 20 73 6f 6d 65 20 67 6c |le,apply some gl| 00000bc0 75 65 20 74 6f 20 74 68 65 20 63 61 62 6c 65 20 |ue to the cable | 00000bd0 73 6f 20 0d 20 20 74 68 61 74 20 74 75 67 73 20 |so . that tugs | 00000be0 6f 6e 20 69 74 20 77 6f 6e 74 20 63 61 75 73 65 |on it wont cause| 00000bf0 20 73 74 72 65 73 73 20 74 6f 20 74 68 65 20 6a | stress to the j| 00000c00 6f 69 6e 74 73 20 6d 61 64 65 20 69 6e 20 33 2c |oints made in 3,| 00000c10 34 2c 35 20 61 62 6f 76 65 2e 0d 0d 53 4f 46 54 |4,5 above...SOFT| 00000c20 57 41 52 45 2e 2e 2e 0d 54 68 65 20 70 72 6f 67 |WARE....The prog| 00000c30 72 61 6d 20 43 4f 44 45 31 33 20 73 68 6f 75 6c |ram CODE13 shoul| 00000c40 64 20 62 65 20 61 76 61 69 6c 61 62 6c 65 20 74 |d be available t| 00000c50 6f 20 79 6f 75 2c 77 68 69 63 68 20 64 65 6d 6f |o you,which demo| 00000c60 6e 73 74 72 61 74 65 73 20 68 6f 77 20 74 6f 20 |nstrates how to | 00000c70 72 65 61 64 20 61 0d 63 6f 64 65 20 31 33 20 74 |read a.code 13 t| 00000c80 79 70 65 20 62 61 72 63 6f 64 65 20 77 69 74 68 |ype barcode with| 00000c90 20 74 68 65 20 68 61 72 64 77 61 72 65 2e 49 66 | the hardware.If| 00000ca0 20 74 68 65 72 65 20 69 73 20 61 20 70 61 72 74 | there is a part| 00000cb0 69 63 75 6c 61 72 20 63 6f 64 69 6e 67 20 6d 65 |icular coding me| 00000cc0 74 68 6f 64 0d 79 6f 75 20 77 69 73 68 20 74 6f |thod.you wish to| 00000cd0 20 62 65 20 61 62 6c 65 20 74 6f 20 72 65 61 64 | be able to read| 00000ce0 20 74 68 65 6e 20 74 68 65 20 65 6e 64 20 68 61 | then the end ha| 00000cf0 6c 66 20 6f 66 20 74 68 65 20 70 72 6f 67 72 61 |lf of the progra| 00000d00 6d 20 77 69 6c 6c 20 6e 65 65 64 20 74 6f 20 62 |m will need to b| 00000d10 65 0d 61 6c 74 65 72 65 64 20 74 6f 20 73 75 69 |e.altered to sui| 00000d20 74 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |t. | 00000d30 20 20 20 20 20 20 0d 54 6f 20 75 73 65 20 74 68 | .To use th| 00000d40 65 20 73 6f 66 74 77 61 72 65 20 43 48 41 49 4e |e software CHAIN| 00000d50 22 43 4f 44 45 31 33 22 20 6f 72 20 74 68 65 20 |"CODE13" or the | 00000d60 65 71 75 69 76 61 6c 65 6e 74 20 63 6f 6d 6d 61 |equivalent comma| 00000d70 6e 64 2e 0d 54 68 65 20 6d 65 73 73 61 67 65 20 |nd..The message | 00000d80 27 57 61 69 74 69 6e 67 20 66 6f 72 20 73 63 61 |'Waiting for sca| 00000d90 6e 2e 2e 2e 27 20 61 70 70 65 61 72 73 20 61 73 |n...' appears as| 00000da0 20 61 20 6d 61 63 68 69 6e 65 20 63 6f 64 65 20 | a machine code | 00000db0 6c 6f 6f 70 20 70 6f 6c 6c 73 20 74 68 65 0d 75 |loop polls the.u| 00000dc0 73 65 72 20 70 6f 72 74 20 75 6e 74 69 6c 20 74 |ser port until t| 00000dd0 68 65 20 73 79 6e 63 20 70 75 6c 73 65 20 69 73 |he sync pulse is| 00000de0 20 66 6f 75 6e 64 2e 49 74 20 77 69 6c 6c 20 74 | found.It will t| 00000df0 68 65 6e 20 28 61 73 20 66 61 73 74 20 61 73 20 |hen (as fast as | 00000e00 69 74 20 63 61 6e 29 20 62 75 69 6c 64 0d 61 20 |it can) build.a | 00000e10 74 61 62 6c 65 20 6f 66 20 74 68 65 20 6e 75 6d |table of the num| 00000e20 62 65 72 20 6f 66 20 72 65 61 64 73 20 74 6f 20 |ber of reads to | 00000e30 74 68 65 20 75 73 65 72 20 70 6f 72 74 20 74 68 |the user port th| 00000e40 61 74 20 6f 63 63 75 72 65 64 20 62 65 66 6f 72 |at occured befor| 00000e50 65 20 74 68 65 20 64 61 74 61 0d 63 68 61 6e 67 |e the data.chang| 00000e60 65 64 2c 61 6e 64 20 68 65 6e 63 65 20 74 68 65 |ed,and hence the| 00000e70 73 65 20 61 72 65 20 64 69 72 65 63 74 6c 79 20 |se are directly | 00000e80 70 72 6f 70 6f 72 74 69 6f 6e 61 6c 20 74 6f 20 |proportional to | 00000e90 74 68 65 20 77 69 64 74 68 20 6f 66 20 74 68 65 |the width of the| 00000ea0 20 70 75 6c 73 65 2e 0d 54 68 65 20 6d 61 63 68 | pulse..The mach| 00000eb0 69 6e 65 20 63 6f 64 65 20 72 65 74 75 72 6e 73 |ine code returns| 00000ec0 20 74 6f 20 74 68 65 20 63 61 6c 6c 65 72 20 77 | to the caller w| 00000ed0 68 65 6e 20 74 68 65 20 73 61 6d 65 20 76 61 6c |hen the same val| 00000ee0 75 65 20 69 73 20 72 65 61 64 20 66 72 6f 6d 20 |ue is read from | 00000ef0 74 68 65 0d 70 6f 72 74 20 32 35 35 20 74 69 6d |the.port 255 tim| 00000f00 65 73 2e 49 74 20 69 73 20 74 68 65 6e 20 61 73 |es.It is then as| 00000f10 73 75 6d 65 64 20 74 68 61 74 20 6e 6f 20 6d 6f |sumed that no mo| 00000f20 72 65 20 74 72 61 6e 73 6d 69 73 73 69 6f 6e 73 |re transmissions| 00000f30 20 66 6f 6c 6c 6f 77 2e 41 20 76 61 6c 75 65 0d | follow.A value.| 00000f40 69 73 20 72 65 74 75 72 6e 65 64 20 69 6e 20 58 |is returned in X| 00000f50 20 77 68 69 63 68 20 69 73 20 74 68 65 20 6c 65 | which is the le| 00000f60 6e 67 74 68 20 6f 66 20 74 68 65 20 74 61 62 6c |ngth of the tabl| 00000f70 65 20 63 72 65 61 74 65 64 2e 0d 53 69 6e 63 65 |e created..Since| 00000f80 20 64 61 74 61 20 61 6c 77 61 79 73 20 73 74 61 | data always sta| 00000f90 72 74 73 20 61 74 20 31 20 73 6f 20 61 20 74 79 |rts at 1 so a ty| 00000fa0 70 69 63 61 6c 20 74 61 62 6c 65 20 6d 69 67 68 |pical table migh| 00000fb0 74 20 63 6f 6e 73 69 73 74 20 6f 66 0d 0d 20 20 |t consist of.. | 00000fc0 20 4c 6f 67 69 63 20 76 61 6c 75 65 20 6f 6e 20 | Logic value on | 00000fd0 50 42 30 20 20 20 31 20 20 30 20 20 31 20 20 30 |PB0 1 0 1 0| 00000fe0 20 20 31 20 20 30 20 20 31 20 20 30 20 20 31 20 | 1 0 1 0 1 | 00000ff0 20 30 20 20 31 20 20 30 20 20 31 20 20 30 20 20 | 0 1 0 1 0 | 00001000 31 20 65 74 63 2e 2e 2e 0d 20 20 20 4e 75 6d 62 |1 etc.... Numb| 00001010 65 72 20 6f 66 20 6c 6f 6f 70 73 20 20 20 20 20 |er of loops | 00001020 32 30 20 34 46 20 32 30 20 32 30 20 36 35 20 32 |20 4F 20 20 65 2| 00001030 30 20 32 30 20 34 46 20 34 46 20 32 30 20 36 33 |0 20 4F 4F 20 63| 00001040 20 32 33 20 32 32 20 34 44 20 32 30 20 65 74 63 | 23 22 4D 20 etc| 00001050 2e 2e 2e 0d 0d 41 73 20 79 6f 75 20 63 61 6e 20 |.....As you can | 00001060 73 65 65 20 74 68 65 20 74 69 6d 69 6e 67 20 63 |see the timing c| 00001070 6f 6d 69 6e 67 20 66 72 6f 6d 20 74 68 65 20 73 |oming from the s| 00001080 63 61 6e 6e 65 72 20 69 73 20 6e 6f 74 20 63 72 |canner is not cr| 00001090 69 73 70 20 61 6e 64 20 63 6c 65 61 6e 20 73 6f |isp and clean so| 000010a0 20 0d 73 6f 6d 65 20 66 69 6c 74 65 72 69 6e 67 | .some filtering| 000010b0 20 69 73 20 6e 65 65 64 65 64 2e 46 6f 72 20 64 | is needed.For d| 000010c0 65 6d 6f 6e 73 74 72 61 74 69 6f 6e 20 70 75 72 |emonstration pur| 000010d0 70 6f 73 65 73 20 6f 6e 6c 79 20 63 6f 64 65 20 |poses only code | 000010e0 31 33 20 62 61 72 63 6f 64 65 73 20 61 72 65 0d |13 barcodes are.| 000010f0 68 61 6e 64 6c 65 64 20 61 6e 64 20 72 61 74 68 |handled and rath| 00001100 65 72 20 63 72 75 64 65 6c 79 20 74 6f 6f 21 20 |er crudely too! | 00001110 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 69 73 |The following is| 00001120 20 61 70 70 6c 69 65 64 3a 0d 0d 20 20 20 46 69 | applied:.. Fi| 00001130 6e 64 20 61 76 65 72 61 67 65 20 75 6e 69 74 20 |nd average unit | 00001140 6c 65 6e 67 74 68 20 6f 66 20 62 61 72 20 62 79 |length of bar by| 00001150 20 61 76 65 72 61 67 69 6e 67 20 74 68 65 20 65 | averaging the e| 00001160 6e 64 20 33 20 62 69 74 73 20 61 6e 64 20 73 74 |nd 3 bits and st| 00001170 61 72 74 20 33 0d 20 20 20 62 69 74 73 20 28 73 |art 3. bits (s| 00001180 74 61 72 74 2f 73 74 6f 70 20 62 61 72 73 29 0d |tart/stop bars).| 00001190 20 20 20 47 6f 20 74 68 72 6f 75 67 68 20 65 61 | Go through ea| 000011a0 63 68 20 74 61 62 6c 65 20 65 6e 74 72 79 20 61 |ch table entry a| 000011b0 73 73 69 67 6e 69 6e 67 20 61 20 6e 6f 72 6d 61 |ssigning a norma| 000011c0 6c 69 73 65 64 20 6c 65 6e 67 74 68 20 6f 66 20 |lised length of | 000011d0 62 65 74 77 65 65 6e 20 31 20 61 6e 64 20 0d 20 |between 1 and . | 000011e0 20 20 34 20 6c 6f 6e 67 20 61 73 20 74 68 65 20 | 4 long as the | 000011f0 6d 61 78 69 6d 75 6d 20 63 6f 64 65 20 31 33 20 |maximum code 13 | 00001200 72 65 70 65 61 74 20 6c 65 6e 67 74 68 20 69 73 |repeat length is| 00001210 20 34 20 63 6f 6e 73 65 63 75 74 69 76 65 20 64 | 4 consecutive d| 00001220 69 67 69 74 73 2e 0d 0d 53 6f 20 66 6f 72 20 65 |igits...So for e| 00001230 78 61 6d 70 6c 65 20 61 62 6f 76 65 0d 0d 20 20 |xample above.. | 00001240 20 4c 6f 67 69 63 20 76 61 6c 75 65 20 6f 6e 20 | Logic value on | 00001250 50 42 30 20 20 20 31 20 20 30 20 20 31 20 20 30 |PB0 1 0 1 0| 00001260 20 20 31 20 20 30 20 20 31 20 20 30 20 20 31 20 | 1 0 1 0 1 | 00001270 20 30 20 20 31 20 20 30 20 20 31 20 20 30 20 20 | 0 1 0 1 0 | 00001280 31 20 65 74 63 2e 2e 2e 0d 20 20 20 4e 75 6d 62 |1 etc.... Numb| 00001290 65 72 20 6f 66 20 6c 6f 6f 70 73 20 20 20 20 20 |er of loops | 000012a0 32 30 20 34 46 20 32 30 20 32 30 20 36 35 20 32 |20 4F 20 20 65 2| 000012b0 30 20 32 30 20 34 46 20 34 46 20 38 37 20 36 33 |0 20 4F 4F 87 63| 000012c0 20 32 33 20 32 32 20 34 44 20 32 30 20 65 74 63 | 23 22 4D 20 etc| 000012d0 2e 2e 2e 0d 20 20 20 4e 6f 72 6d 61 6c 69 73 65 |.... Normalise| 000012e0 64 20 76 61 6c 75 65 20 20 20 20 20 31 20 20 32 |d value 1 2| 000012f0 20 20 31 20 20 31 20 20 33 20 20 31 20 20 31 20 | 1 1 3 1 1 | 00001300 20 32 20 20 32 20 20 34 20 20 33 20 20 31 20 20 | 2 2 4 3 1 | 00001310 31 20 20 32 20 20 31 20 65 74 63 2e 2e 2e 0d 0d |1 2 1 etc.....| 00001320 57 68 69 63 68 20 6d 65 61 6e 73 20 74 68 61 74 |Which means that| 00001330 20 74 68 65 20 73 63 61 6e 6e 65 64 20 63 6f 64 | the scanned cod| 00001340 65 20 6d 75 73 74 20 68 61 76 65 20 62 65 65 6e |e must have been| 00001350 0d 0d 20 20 20 31 30 30 31 30 31 31 31 30 31 30 |.. 10010111010| 00001360 30 31 31 30 30 30 30 31 31 31 30 31 30 30 31 2e |011000011101001.| 00001370 2e 2e 0d 0d 54 68 69 73 20 69 73 20 74 68 65 6e |....This is then| 00001380 20 63 68 65 63 6b 65 64 20 66 6f 72 20 73 74 61 | checked for sta| 00001390 72 74 2f 73 74 6f 70 2f 67 75 61 72 64 20 62 69 |rt/stop/guard bi| 000013a0 74 73 20 61 6e 64 20 63 6f 72 72 65 63 74 20 6c |ts and correct l| 000013b0 65 6e 67 74 68 20 61 6e 64 20 74 68 65 6e 20 0d |ength and then .| 000013c0 64 65 63 6f 64 65 64 2e 59 6f 75 27 6c 6c 20 6e |decoded.You'll n| 000013d0 65 65 64 20 74 6f 20 74 65 6c 6c 20 74 68 65 20 |eed to tell the | 000013e0 63 6f 6d 70 75 74 65 72 20 77 68 61 74 20 74 68 |computer what th| 000013f0 65 20 66 69 72 73 74 20 6e 75 6d 62 65 72 20 6f |e first number o| 00001400 66 20 74 68 65 20 62 61 72 63 6f 64 65 0d 69 73 |f the barcode.is| 00001410 20 28 74 68 69 73 20 69 73 20 6e 6f 72 61 6c 6c | (this is norall| 00001420 79 20 70 72 69 6e 74 65 64 20 75 6e 64 65 72 6e |y printed undern| 00001430 65 61 74 68 21 29 20 77 68 69 63 68 20 69 73 20 |eath!) which is | 00001440 74 68 65 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 |the combination | 00001450 6e 75 6d 62 65 72 2e 57 68 65 6e 20 0d 61 6e 64 |number.When .and| 00001460 20 4f 4e 4c 59 20 77 68 65 6e 20 74 68 69 73 20 | ONLY when this | 00001470 6e 75 6d 62 65 72 20 69 73 20 63 6f 72 72 65 63 |number is correc| 00001480 74 20 77 69 6c 6c 20 61 6c 6c 20 74 68 65 20 64 |t will all the d| 00001490 69 67 69 74 73 20 64 65 63 6f 64 65 20 70 72 6f |igits decode pro| 000014a0 70 65 72 6c 79 2e 49 74 0d 69 73 20 6c 65 66 74 |perly.It.is left| 000014b0 20 74 6f 20 74 68 65 20 72 65 61 64 65 72 20 74 | to the reader t| 000014c0 6f 20 61 64 64 20 61 6e 20 65 78 74 72 61 20 6c |o add an extra l| 000014d0 6f 6f 70 20 66 72 6f 6d 20 30 20 74 6f 20 39 20 |oop from 0 to 9 | 000014e0 74 6f 20 74 72 79 20 62 79 20 67 75 65 73 73 69 |to try by guessi| 000014f0 6e 67 20 74 6f 20 0d 66 69 6e 64 20 77 68 61 74 |ng to .find what| 00001500 20 74 68 61 74 20 64 69 67 69 74 20 69 73 2c 61 | that digit is,a| 00001510 6e 64 20 68 65 6e 63 65 20 67 65 74 20 74 68 65 |nd hence get the| 00001520 20 77 68 6f 6c 65 20 62 61 72 63 6f 64 65 20 77 | whole barcode w| 00001530 69 74 68 6f 75 74 20 6e 65 65 64 69 6e 67 20 65 |ithout needing e| 00001540 6e 64 20 0d 75 73 65 72 20 69 6e 70 75 74 2e 0d |nd .user input..| 00001550 0d 4e 6f 74 65 20 74 68 61 74 20 73 63 61 6e 73 |.Note that scans| 00001560 20 77 6f 6e 74 20 61 6c 77 61 79 73 20 62 65 20 | wont always be | 00001570 61 63 63 65 70 74 65 64 20 74 68 65 20 66 69 72 |accepted the fir| 00001580 73 74 20 74 69 6d 65 2c 64 75 65 20 74 6f 20 61 |st time,due to a| 00001590 6e 20 69 6e 63 6f 72 72 65 63 74 0d 6c 65 6e 67 |n incorrect.leng| 000015a0 74 68 20 63 6f 64 65 20 31 33 20 62 61 72 63 6f |th code 13 barco| 000015b0 64 65 2e 4b 65 65 70 20 74 72 79 69 6e 67 2c 69 |de.Keep trying,i| 000015c0 74 27 73 20 62 65 63 61 75 73 65 20 74 68 65 20 |t's because the | 000015d0 66 69 6c 74 65 72 69 6e 67 20 69 73 20 73 6f 20 |filtering is so | 000015e0 63 72 75 64 65 2e 54 72 79 0d 75 73 69 6e 67 20 |crude.Try.using | 000015f0 61 20 73 74 61 6e 64 61 72 64 20 64 65 76 69 61 |a standard devia| 00001600 74 69 6f 6e 20 69 6e 73 74 65 61 64 20 6f 66 20 |tion instead of | 00001610 61 76 65 72 61 67 69 6e 67 20 74 68 65 20 73 74 |averaging the st| 00001620 61 72 74 2f 73 74 6f 70 20 62 69 74 20 6c 65 6e |art/stop bit len| 00001630 67 74 68 73 2e 4f 72 0d 61 64 6a 75 73 74 20 74 |gths.Or.adjust t| 00001640 68 65 20 73 69 7a 65 20 6f 66 20 74 68 65 20 77 |he size of the w| 00001650 69 6e 64 6f 77 20 79 6f 75 20 6c 6f 6f 6b 20 74 |indow you look t| 00001660 68 72 6f 75 67 68 2e 0d 0d |hrough...| 00001669