Hi!
For too many days I have spent my time on this already. I have a barcodereader for serial port and I need to read barcodes with beckhoff twincat. In system manager I have created a com-port, set up speed and made it "KL6xx1" emulation as I have understood from the help, that should work fine. Barcodes which I need to read are always 13 characters long +linefeed or so.
If I understood right, I should be able to read it from data1-data16 (I setup it so that there are 16 databytes) using cntrl-byte to keep up with happenings.
Now the problem is, that I can't quite find sense in what readings I'm getting.
I want to have the barcode, at the same location on the databytes, everytime I read it, but it seems to go around a lot. I'm driving a progrmam which circulates values 3 and 1 in the cntrl-byte and if I use the scanner, when the value is 3 I get a decent information in sensible place.
Now I reset the buffers and all, with putting value of 7 in the cntrl-bit and going back to my routine, with 3, 1, 3, 1 and so on. I would stop my program when the value is 3, but then, the statusbyte won't change and I don't know when data is entered.
If I try with different routine, with just commanding it to gove me more data, it starts to give data in databyte1-databyteN. But it wont give me the whole line, it cuts it middle. And of course it won't erase data from the rest of the bytes, so I can't figure, which data is old and which is new. When I command it to give me more data, it writes it again from databyte1 to databyteN, overwriting the data it just gave me.
I'm going nuts.
Hope someone can understand what I'm trying to explain and maybe even help me with this.
For too many days I have spent my time on this already. I have a barcodereader for serial port and I need to read barcodes with beckhoff twincat. In system manager I have created a com-port, set up speed and made it "KL6xx1" emulation as I have understood from the help, that should work fine. Barcodes which I need to read are always 13 characters long +linefeed or so.
If I understood right, I should be able to read it from data1-data16 (I setup it so that there are 16 databytes) using cntrl-byte to keep up with happenings.
Now the problem is, that I can't quite find sense in what readings I'm getting.
I want to have the barcode, at the same location on the databytes, everytime I read it, but it seems to go around a lot. I'm driving a progrmam which circulates values 3 and 1 in the cntrl-byte and if I use the scanner, when the value is 3 I get a decent information in sensible place.
Now I reset the buffers and all, with putting value of 7 in the cntrl-bit and going back to my routine, with 3, 1, 3, 1 and so on. I would stop my program when the value is 3, but then, the statusbyte won't change and I don't know when data is entered.
If I try with different routine, with just commanding it to gove me more data, it starts to give data in databyte1-databyteN. But it wont give me the whole line, it cuts it middle. And of course it won't erase data from the rest of the bytes, so I can't figure, which data is old and which is new. When I command it to give me more data, it writes it again from databyte1 to databyteN, overwriting the data it just gave me.
I'm going nuts.
Hope someone can understand what I'm trying to explain and maybe even help me with this.