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.
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.
Erik
PS do not be stupid when you give your supervisor an estimate of the time to do this.
Thanks for all youre help and advise. I will talk to my manager and list the options. I know now that this is not a weekend job and I will look for code on the internet maybe open source I hope.
Maybe if I do it I sell the code to Erik for lots of money ;)
If you want to sell to Erik - make sure to use large memory model ;)
I am not a buyer, but if you manage to make a reader that can handle all situations (speed/skew/print/jitter/etc) it will be worth "lots of money"
ERrik
And use an RTOS, with the critical ISR code in C and with all compiler optimizations enabled ;)
Oh, and remember to include a static function in every module called DoTheLazyDog().