Hi all,
Has anyone got any ideas about where to get some C code to read a barcode?
Ive got a pen but dont know what to plug it to.
"I think Erik is trying to be funny?"
Not really: several contributors have told you that this is not a trivial exercise, and yet you continue to ask to be given free, complete code!
"very sarcy and not helpful!"
Your request looked more like a demand for a freebie than for "help".
"I think polling might not work well, and I think I must use an interrupt."
Now you're getting somewhere!
Whether polling is workable depends on what else your processor has to do - since a barcode swipe is only relatively brief, it might be possible to stop everything else and poll the input during a swipe...
"But should it be edge or level?"
Probably edge: what you want is to detect the start of a bar - which would be an edge. You then need to time the width of the bar.
As already mentioned, this just gives you the raw bar timings - you then have to process that to allow for irregular and skewed scanning, poor-quality printing, etc, then decode that, etc, etc,...
Barcode scanners are relatively cheap on ebay - do you really need to do this from scratch for yourself?
Have you tried looking on the Agilent site, or others?