I have a pic24FJ1024GB10 explorer board, and a brand new LS2208 barcode scanner. The barcode scanner outputs 5V. Im trying to read the serial rs233 signal using only the ground, tx, rx, pins from the barcode reader with no success. I have analyzed the signal coming from the barcode reader using Saleae logic software and the output is read correctly using a 9600 baud rate, 8-bit transfer mode, 1 stop bit, no parity bit, least significant bit sent first, inverted. So the signal seems to be sending correctly and I'm initializing the board with the same parameters. The Saleae output is attached.
The barcode scanner reference manual is too large to attach but the pdf can be found here:
https://www.zebra.com/content/dam/z...ners/ls2208-product-reference-guide-en-us.pdf
[/I]
The barcode scanner reference manual is too large to attach but the pdf can be found here:
https://www.zebra.com/content/dam/z...ners/ls2208-product-reference-guide-en-us.pdf
C:
void InitU1(void){
U1MODEbits.BRGH = 0;
U1BRG =12;
U1MODE =0x8070;
RPINR18 = 0x000E;
U1STA = 0x5400;
TRISBbits.TRISB1 = 1; // enable RTS , output
RPINR18bits.U1CTSR = 6; //set CTS pin RP6
//RPINR18bits.U1RXR = 14; //set RX pin RP8
RPOR0bits.RP1R = 3; //set TX pin RP1
RPOR1bits.RP3R = 4; //set RTS pin RP3
}
char getU1 (void)
{
//RTS = 0; // telling the other side !RTS
//while (!U1STAbits.URXDA ); // wait
//RTS =1; // telling the other side RTS
return U1RXREG ; // from receiving buffer
}
int main(void) {
LCD_Initialize();
InitU1();
int i=0;
char readRX;
char rx[15];
ms_delay(120);
readRX = getU1();
ms_delay(2);
printf("Value of readRX %c\n", readRX);
ms_delay(100);
while(i<14){
for (i=0; i<15; i++){
rx[I] = getU1();[/I]
[I]ms_delay(1);
}
}[/I]
[I]printf("\f");
printf("RX input: %s\n", rx);[/I]
[I]ms_delay(100);[/I]
[I]}
Attachments
Last edited by a moderator: