//extract the 69 character array, widthbinary, into 7 separate integers for comparison //widthstring[7] are rdy for comparison after this void widthseparate(void) begin unsigned char i;//temporary indices // widthbinary is type unsigned int array // widthstring is type unsigned int array //clean the crap up in each integer, just in case for(i=0; i<7; i++) begin widthstring[i] = 0; end //I am sure there is a better way to do this(ie: one more outer loop) //but I cant think of anything right now for(i=0; i<9; i++) begin widthstring[0] = widthstring[0] | (widthbinary[8-i]<9 & charindex<36) charindex+= 55; //scanner char is //an alphabet else if(charindex ==36) charindex = 45; //- else if(charindex ==37) charindex = 46; //. else if(charindex ==38) charindex = 32; //space else if(charindex ==39) charindex = 42; //* else if(charindex ==40) charindex = 36; //$ else if(charindex ==41) charindex = 47; //"/" else if(charindex ==42) charindex = 43; //+ else if(charindex ==43) charindex = 37; //% else charindex = 0; //invalid code, outout error end return charindex; //charindex is the current barcode character in ascii end //return the error value of current character, to be filled into errorvalue array unsigned char width2error(unsigned int widthchar) begin unsigned char charindex, errorvalue; if (widthchar != 0x0000) begin for (charindex=0; charindex<44; charindex++) //only accepting 0 to 43 begin if (codetbl[charindex]==widthchar) break; end /*assign the error checking value for each scanned character,*/ //for character index 0 to 38 (0 to 9, A to Z, -, ., space) //errorvalue = index if(charindex>=0 & charindex<39) errorvalue = charindex; //for character index 39 to 44 ($, /, +,%) errorvalue = index-1 //since we have to skip * else if(charindex>39 & charindex<44) errorvalue= charindex-1; else if(charindex==39) errorvalue = 0; //doesnt matter, since element 0 //is not accounted for in errorcheck end return errorvalue; end //extract the actual item code, from the 2nd character to //the 3rd from the last character, //ex: * 1 2 3 4 A * //we only want to store 1 2 3 4, since the two * are starting and ending //character, and A (errorvalue 10) is the error checking character void getcode(void) begin unsigned char i; for(i=1; i