As the title says, I want to use a USB keyboard as an input device for my PLC.
I’ve been doing some research and I’ve found some library’s for USB (AsUSB, dvframe), But I don’t think this is what I’m looking for.
I’ve also been able to find the “USB-Keyboard” hardware module, this one needs a visualization object to map its inputs. Although I don’t fully understand how this works.
I’m currently doing an internship and don’t have much experience with PLCs so
please excuse my lack of knowledge.
Without knowing the answer but being curious… I think it helps if you provide a bit more information. What do you want to do with the keyboard? Text input on an HMI? Using the keys as inputs to the program?
A “free configurable bunch of hardware buttons” is exactly what I want to achieve.
In the configuration of the keyboard, under “Key mapping file” is an option for “VC/USB-Keyboard.dis”. Is this what I need? when I try to open it, I get the error: “There is no visualization object mapped to the file VC/USB-Keyboard.dis. To open a visualisation in HW-mode please map a suitable visualisation object”.
I’ve created a VC4 object in my logical view, but I’m not sure what I can do there.
We are little bit in circle of knowing nothing. So lets start from beginning, what hw do you have in plan to use for your visualization and what kind of visualization (VC4, mappView,.) do you have in plan to use?
So you have PLC with USB interface and you would like to read cyclically input from external keyboard plugged into the USB. For this usecase, if Im not mistaken, you have to use AsUSB library. There are samples included and I think barcode reader sample is the right one, because it acts usually as a USB keyboard.
You should look at the AsUsb library.
The AsUSB - USBNodeListGet() should be able to detect the USB-keyboard.
Look at one of the samples and adapt it for the keyboard.
You will also need functions from the DvFrame library to read the data from the keyboard.
See also one of the samples in the AS-Help for this.
I did not find a specific USB-keyboard sample, but perhaps someone else has made it.