From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

barcode scanner input

Hi .

 

I have an application that needs to receive bar code scanner input (the DS6707 from motorola). This application also discusses with 3 or 4 boards that run in parallel (using serial port com). So I have at least 5 threads that are running in parallel: one for each port com, one supervisor, and the main for the user interface.

 

I created a control to get the data coming from the barcode scanner, but sometimes I lose some number on my barcode, or sometimes I receive ‘?’ instead of a number.


If I create a thread that read the standard input, it works, I always receive all my numbers, but the problem is that I have the standard input that is visible and I don’t want.

 

I tried to used keyboard methods from the windows library , but I don’t know how to proceed.

 

Thanks for your help.

0 Kudos
Message 1 of 6
(5,150 Views)

Hi.

 

Nobody has any idea for my issue?

How can I get barcode scanner input without losing data?

Thanks a lot.

0 Kudos
Message 2 of 6
(5,120 Views)

Hi YPO,

 

It will be easiest to help you if we have a code exemple.

 

How do you have configured the buffer input ?

Valentin
Certified LabVIEW Architect
Certified TestStand Architect
Certified LabWindowsCVI Developer
National Instruments France

0 Kudos
Message 3 of 6
(5,117 Views)

Hi Valentin, 

 

Thanks for your help.

Here is my code that managed the keyboard input.

 

This call back is the main panel CB.

 

 

int CVICALLBACK panel_cb (int panel, int event, void *callbackData,
int eventData1, int eventData2)
{
   static int cpt=0;
   static unsigned char bar_code[NB_MAX_CHAR];
   switch (event)
   {
        case EVENT_KEYPRESS:
        if(VAL_ENTER_VKEY == eventData1)
        {
            prinft("bar code : %s ", bar_code 😞

            memset(bar_code,0,30);
            cpt=0;
        }
        else
        {
            bar_code[cpt++] = eventData1 & VAL_ASCII_KEY_MASK;
        }
        break;
        }
    return 0;
}

0 Kudos
Message 4 of 6
(5,114 Views)

Hi Cindy.

 

Not exactly, In fact my application needs to get serial number of the product to test, for that we are using the ds6707 motorola scanner to read the barcode.

 

So in the uir of my application I added an "Edit String" control. When my application is in idle (I mean when all the others thread are waiting for a message) I am able to read correctly the serial number. But when I scan the serial number while some threads are running, I loose some numbers of the serial code, or sometimes I received "?".

 

At the begin I believed that the issue came form the scanner, so What I did is to start a thread : while(1) {getchar ();}, I receive always the good number, but I can't use "stdin" because I have a windows that appears.

 

So I don't know what to do , to be sure that I will receive always the serial number.

 

And Sorry for my bad English .

 

Thanks.

0 Kudos
Message 5 of 6
(5,055 Views)

I have a question about a keyboard wedge scanner input.

 

I have a single panel with several text boxes placed in a grid.

I post the output from 8 flash programmers in the boxes.

I have a single wide text box below these to display general program status.

 

My problem is when I scan the barcodes from the panel array, all data goes

through the Upper Left text box. i want the data to go through the big box on the bottom.

 

The reason I am using the text box in the upper left, is because that is where the data went

when I scanned the bar codes. I was desperate to get the project moving forward.

And the StdIO window caused too many problems.

 

Question,  How do I move the cursor to the other text box ? I have tried many Set / Get

Attribute parameters.  If there exists any "how-To" example code I would be grateful.

 

//////////\\\\\\\\\\**********//////////\\\\\\\\\\**********//////////\\\\\\\\\\**********//////////\\\\\\\\\\**********

void ReadSerialNumber1 (char* BigBuffer9)
 {
 statspanelHandle  = TESTER_DialogGetSubPanelCVIHandle(&StatsHandle);
 statspanelHandle  = GetCtrlVal (StatsHandle, STATSPANEL_TEXTBOX_2, BigBuffer9);

 DisplayPanel(StatsHandle);
 fprintf(Stream1,"Serial Number..~%s~\n",BigBuffer9);
 }
//////////\\\\\\\\\\**********//////////\\\\\\\\\\**********//////////\\\\\\\\\\**********//////////\\\\\\\\\\**********

code in main section

//////////\\\\\\\\\\**********//////////\\\\\\\\\\**********//////////\\\\\\\\\\**********//////////\\\\\\\\\\**********

  sprintf(LittleBuffer1,"\n  -- SCAN Serial Number Nest 1-- ");
  WriteTextBox1(LittleBuffer1);
  PN_Size = strlen(LittleBuffer1);

  for(x=0;x<128;x++){ LittleBuffer1[x] = '\0';}
  PN_Size = strlen(LittleBuffer1);
  while(PN_Size != 10){
     int Stat_Val;
     Delay(0.5);  
  ReadSerialNumber1(LittleBuffer1);
     PN_Size = strlen(LittleBuffer1);
  if(TEST_CHECK_BREAK) break;
  }
  if(PN_Size == 10)  Ready_Go = 1;
  strcpy(sSerialNum1,LittleBuffer1);
  strcpy(Scan_Buffer[0],LittleBuffer1);
  if(!strcmp(ModuleType2,"DSM")) strcpy(Scan_Buffer[1],LittleBuffer1);
  ResetTextBox2();
  if(TEST_CHECK_BREAK) break;
  }
  sprintf(LittleBuffer1,"____%s____",Scan_Buffer[0]);  
  WriteTextBox1(LittleBuffer1); 
  Ready_Go = 0;
//////////\\\\\\\\\\**********//////////\\\\\\\\\\**********//////////\\\\\\\\\\**********//////////\\\\\\\\\\**********

 

0 Kudos
Message 6 of 6
(4,243 Views)