speedEC
Full Member level 6
Hello All,
I am facing a problem in accessing Barcode Scanner data. I am using PIC24FJ... uC for communicating with USB Barcode Scanner. Everything works fine as expected but with one issue. I am using PIC16F... uC.
PIC16F... (RX PIN) <- PIC24FJ... <- USB Barcode Scanner (ONLY INCOMING DATA. NO OUTGOING TO SCANNER. SO TX PIN NOT USED).
I can able to receive data from Scanner. If data received, I am validating the data. If valid data do some process. If Invalid data send Error message thru' BEEP sound for 3 seconds. Here the problem starts. If I show barcode label in front of scanner while uC sound BEEP, i.e. within the 3 seconds period, error occurred. I am receiving some digits and code hanged some where else.
Usually what I do is, disable USART and re_enable USART after process is completed. I tried that method here. But, scanner shuts down and restart everytime disable & reenable USART. I have not write code for PIC24FJ... (for USB scanner). I bought the board from ebay.
disableUSART and ReenableUSART functions;
How can I solve this issue?
thank you all
I am facing a problem in accessing Barcode Scanner data. I am using PIC24FJ... uC for communicating with USB Barcode Scanner. Everything works fine as expected but with one issue. I am using PIC16F... uC.
PIC16F... (RX PIN) <- PIC24FJ... <- USB Barcode Scanner (ONLY INCOMING DATA. NO OUTGOING TO SCANNER. SO TX PIN NOT USED).
I can able to receive data from Scanner. If data received, I am validating the data. If valid data do some process. If Invalid data send Error message thru' BEEP sound for 3 seconds. Here the problem starts. If I show barcode label in front of scanner while uC sound BEEP, i.e. within the 3 seconds period, error occurred. I am receiving some digits and code hanged some where else.
Usually what I do is, disable USART and re_enable USART after process is completed. I tried that method here. But, scanner shuts down and restart everytime disable & reenable USART. I have not write code for PIC24FJ... (for USB scanner). I bought the board from ebay.
Code C - [expand] 1 2 3 4 5 6 unsigned char getch() { /* retrieve one byte */ while(!RCIF) /* set when register is not empty */ continue; return RCREG; }
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 if (ERROR_1){ printf("\r\n%s\r\n",ERROR); BAD_READ_LED = 1; ERROR_BEEP(); [B][I][COLOR="#FF0000"]// 3 seconds (if we show barcode label, while code runs here, Coliision occurs here?!)[/COLOR][/I][/B] BAD_READ_LED = 0; ERROR_1 = 0; } else{ printf("\r\n%s\r\n",OK); GOOD_READ_LED = 1; OK_BEEP(); GOOD_READ_LED = 0; }
disableUSART and ReenableUSART functions;
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 void disableRX(void){ TRISC7 = 0;// RX PIN AS OUTPUT SPEN = 0; CREN = 0; } void re_enableRX(void){ TRISC7 = 1;// RX PIN AS INTPUT AGAIN SPEN = 1; CREN = 1; }
How can I solve this issue?
thank you all