Can I decode a barcode with an 8052?
Submitted By: Craig Steiner FAQ Last Modified: 07/10/06
- Yes. While the algorithm to decode a barcode is beyond the scope of this FAQ, it is entirely possible to decode a barcode using an 8052. It's just a matter of connecting an optical sensor (the barcode "reader") to a given I/O pin of the 8052. As the barcode is passed in front of the optical sensor, the device will normally change state (go from low to high or high to low) every time the barcode changes from "bar" to "space" (dark to light, etc.). Decoding the barcode is a matter of measuring length (time) of each "state." An algorithm may then be applied which converts the measured time into "bar/space widths." This is then analyzed based on the symbology to determine the data that was encoded. Be sure to take into account the fact that the barcode being scanned may not be passed in front of the optical sensor at a completely uniform speed--some speed variation is inevitable and will somewhat complicated your decoding algorithm.
Add Information to this FAQ: If you have additional information or alternative solutions to this question, you may add to this FAQ by clicking here.