We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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.
send me an e-mail and I will tell you where to send a check for $12,870 and the code will be sent to you.
That is a lot of money!
What is your email address?
What code will you send?
Will it do code 128?
Any others?
That is a lot of money! a reasonable price for software like this.
What is your email address? this week: Erikm@digrec.com
It's been a while, I do not have this code in my hands right now, but hope to have it somewhere (on a computer that is not at this location) and have to dig it out. Maybe somebody (David Rose? "Sorry, but I can't just give that away") will make you an offer. If no offer comes out as accepted, I'll dig for it this weekend.
Erik
Although I'd like to undercut Erik, I'd probably find that my employer might get a bit upset if I offered the code to anyone.
Developed in his time, sole ownership, blah blah blah!
I think Erik is trying to be funny?
HA HA - very sarcy and not helpful!
How would be the best way of getting the pulses from the pen? I think polling might not work well, and I think I must use an interrupt. But should it be edge or level?
Can you give me any ideas please?
"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?
Nazir,
There are probably a lot of ways of accumulating the pulse train from a barcode pen.
The concept I used was to feed the input into INT0 or INT1 and configure for edge triggering.
BUT ... Edge triggering on the humble 8051 is only detected on a negative going edge. You will need to generate an interrupt on both edges.
What I did was use an 'exclusive or' gate to programmatically invert the input signal by feeding an output port pin to the input of the gate.
As I said, there are other methods to do this, but this worked very well for me and allowed me to have two barcode pens coming into the CPU; one interrupt input per pen.
Now, I'm very confused.
Are there two "Nezir Patak" in this thread? One that needs help, and one that tells how he solved the problem - the second one also directing the answer to someone named "Nazir" and that doesn't seem to have posted in this thread...
About free code. Most people who answer questions here are professional software developers. The code we write are either owned by the company we work for, or we work as free-lance developers and the code we write may (depending on contract conditions) become the property of the customers we write it for.
Hence, there are noremally no code to give away for free.
Sorry people - And especially to Nezir,
I am the second Nezir Patak!
Not sure how I managed to do that, but I suspect it was something to do with the constant interruptions I keep getting from the phone, colleagues etc. while I was entering my response.
Anyway - Hope the real Nezir finds the text of my response helpful.
The post form for this forum could have been a bit better. Quite a lot of people regularly manages to post using funny names since a new input form always starts with the name field selected, and when entering text in the message box, the name fields are often too high up on the form to be visible.
Thanks for the suggestions and advise. We have a lot of the barcode pens already and we want to use them. I think we will try to do our own board with an 8052.
I understand that you cannot give me all the code (and greedy Erik wants me to pay to much). I would be happy for you to give me any routines to help. I found aimglobal and they have specs for different barcodes but I didnt see one for code 128. Do you know where to get the specs?
Nezir,
You can find specifications for code 128 on the aim website (but you'll have to pay!):
www.aimglobal.org/.../ProductDetails.aspx
Also found some details at:
www.neodynamic.com/.../Code_128_Barcode.aspx
Just do a search on "aim code 128" - You'll find a lot!
What product are you hoping to develop? Does it have to be code 128? Will you need to read any other types?
The reference algorithm AIM provided for that was actually pretty good. I loosely based ours on that but included things that we had learnt when we developed other decodes.
I'm a bit out of this area now, but if you're hoping to sell into the industrial market, then maybe you should look at code 39. That used to be the more accepted type.
Please also note that you WILL be looking at a quite lengthy development.
Are you sure you really need to do it?
Nezir Patak said, "greedy Erik wants me to pay too much"
David Rose, who is clearly familiar with the work involved, said, "note that you WILL be looking at a quite lengthy development"
"Lengthy Development" equals "Lots of money", especially if you're paying a US developer - so probably Erik is not being "greedy"?
Again, as David said, Are you sure you really need to do this? In other words, Are you sure you really want to incur the development costs to do this?
Reread my second post - the one after you wrote that the pen was TTL-logic.
Both Andy and Per are right to warn you about this!
When I did this, 2D barcode technology was cutting edge and development environments were far less sophisticated than the likes of Keil products.
The fact that it was done in 100% assembler with those older tools is not the reason it took so long to develop (about 6-9 man months per decode). The problem was that to do it well requires considerable understanding of a lot of intangibles; and to achieve that understanding requires time.
Ok - You might be able to find some documents on the Internet that can guide you; but it will take some considerable time.
I don't know where Erik got his figure from for a cost; maybe simply TimeTakenToDevelop*CostPerDay. I would say that instead of being greedy, he is possibly being quite generous!
So you have choices:
1 - Consider his offer 2 - Consider spending a long time doing it yourself 3 - Consider following another path
Whoops,
I should have referred to 1D barcodes being the cutting edge at the time.
and greedy Erik wants me to pay to much nothing 'greedy' there, the price reflects the time needed to make a working, reliable scan decoder.
You seem to be under the impression that this is something someone can whip up in a weekend, you are grossly mistaken.
If all you want is something that works when the pen is moved at a constant predetermined speed over a perfectly printed barcode then, of course, the price may seem unreasonable, so go do it yourself and
have fun, i hope you will.
PS do not be stupid when you give your supervisor an estimate of the time to do this.