ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING USB module Ke-USB24A. Encyclopedia of radio electronics and electrical engineering Encyclopedia of radio electronics and electrical engineering / Computers In this article, I would like to introduce you to the Ke-USB24A USB module from KERNELCHIP (kernelchip.ru). What is it and why is it needed? Surely, those who are engaged in the development and operation of interface devices with a computer are well aware of both LPT and COM ports - of course, because until recently they were the main means of communication between an external circuit and a computer. However, at the present time, these ports are gradually disappearing from the motherboards of modern computers. There is a question about the transition to the USB bus. In addition to a bunch of advantages, using this bus requires much more effort than, for example, a regular COM port. Now you need to program the USB microcontroller, develop a USB driver, and significantly complicate the software. Even using a HID device is not always convenient - a rather cumbersome procedure for working with the device on the PC side is required. Examples for working with it are widespread for the C++ language. But what if we want to use, for example, Java? If we are faced with the task of controlling external devices, for example, keys, relays, etc. via the USB bus, an interesting move would be to use the Ke-USB24A module. It is designed to interface external digital and analog devices, sensors and actuators with a computer via the USB bus. The module has 24 input/output lines with the ability to independently set the direction of data transfer. One of the most interesting features of this module is that when it is connected to a computer, it is defined by the operating system as an additional COM port! Those. if you install drivers for the module (ready-made and available for download on the developer's website), then a new COM port will appear in the device manager in the serial ports section. It is through it that we will communicate with the module. This means that from a software point of view, the exchange of information between the module and the computer is carried out through the interface of a conventional serial port. The latter circumstance greatly simplifies programming, since there is no need to use additional dynamic libraries, complex interfaces and direct communication with the driver. To write your own control programs for the module, you can use any programming language/environment that supports the ability to work with COM ports. You can use C++, Delphi, VisualBasic, Java, and even Excel's built-in VBA! Also, a 10-bit analog-to-digital converter (ADC) with a sampling frequency of up to 400 Hz is already integrated inside the module. Also, the module has the ability to save the settings for the directions of input / output lines, allows you to save user data in its memory. The module also allows you to change your USB device string descriptor. This is the text that appears in Windows when a new USB device is connected. You have the ability to set and save your own text that will appear when you connect the module to your computer. How is the module managed? The solution is also very interesting - text commands are used, similar to those used in modem control. For example, to set a high voltage level (+5 V) on the input/output line number 14, you need to write a command of the form to the COM port associated with the module $KE,WR,14,1to apply a logical zero - $KE,WR,14,0 etc. For further acquaintance with the module, I recommend downloading the description of the Ke-USB24A control commands (kernelchip.ru/Ke-USB24A.php). Let's take a closer look at the conclusions of the module. The purpose and layout of their location are shown in the figure and in the table below.
Now let's move on to the practical use of the module. Let's assemble a module-based circuit to control external loads via the USB bus, for example, let's control the LEDs connected to the I / O lines. The recommended scheme from the manufacturer is presented below. The circuit is extremely simple - LEDs are simply connected to the I / O lines. All LEDs are planted on a common wire of the circuit - for example, terminal 16 of the module. Please note that if you want to drive more powerful loads, such as light bulbs, relays or motors, you need to take care of the buffer circuit, because. Ke-USB24A will not withstand such a load and will burn out. LEDs can be connected quite easily. We figured out the circuitry - it's time to move on to the software. We need a program that could transmit data through the COM port. There are several options here - you can use a ready-made program, for example, HyperTerminal, which is part of any Windows OS. You can use a special terminal program KeTerm recommended by the developer (source codes are available for it in C++, Microsoft Visual C++ 6.0 development environment). You can download it from the Kernelchip website. And finally, the most interesting option is to write your own program. This is quite simple, because we only need knowledge of COM port programming - we don’t even need to remember about USB programming. Let's start with HyperTerminal. it is in any version of Windows and is always at hand. To launch it, select Start -> Programs -> Accessories -> Communications -> HyperTerminal. The wizard for creating a new connection will immediately launch, prompting you to specify a name for the connection. Specify any name, click "OK". The next step is to select the COM port through which you want to establish a connection. In the list, select the port number that was allocated by Windows for the module (you can see it in the device manager). Click OK. Next, the wizard will offer to change the port settings. Here it is necessary to make an important remark - such parameters as speed, number of data bits, parity bits and other settings do not have any meaning for the module, because. in fact, the data is transferred over the USB bus. You can safely leave all the default settings. Click OK". So, the connection is established. Next, it is strongly recommended to change some settings in the program for ease of use. In the main program panel, click on the "Properties" button. In the window that opens, go to the "Settings" tab and click on the "ASCII Options... ". Check the boxes as in the picture below. Pay attention to the first box. The command syntax of the module requires that all commands end with a carriage return and a newline character. Click "OK". All settings are done. You can get to work. First, let's send the module the simplest $KE command - the check command. Type the text $KE and press Enter. In response, we get the string #OK - this means that the module is working and ready to work. Well, then it's a matter of technology - we use the $KE,WR command with the desired line number and the required value for recording. We send different commands - blink LEDs. With this, I would like to end this introductory article. Next, we will get acquainted with how to manage the module from programs written in C ++, Delphi and even from EXcel. Get to know other useful features of the module, such as ADC. Go to the second part of the article: Ke-USB24A module control from Excel Author: Dmitry Ivanov (Grirog); Publication: cxem.net See other articles Section Computers. Read and write useful comments on this article. Latest news of science and technology, new electronics: Artificial leather for touch emulation
15.04.2024 Petgugu Global cat litter
15.04.2024 The attractiveness of caring men
14.04.2024
Other interesting news: ▪ Video games on the real world map ▪ Characters and musical tastes ▪ The danger of global warming for aircraft News feed of science and technology, new electronics
Interesting materials of the Free Technical Library: ▪ section of the site Tools and mechanisms for agriculture. Article selection ▪ article Physiological effects of meteorological conditions on a person. Basics of safe life ▪ article Which country has several heavy metal bands specifically for children? Detailed answer ▪ Article Canarium Indian. Legends, cultivation, methods of application ▪ article Improved musical metronome. Encyclopedia of radio electronics and electrical engineering ▪ article Focus with four cards. Focus Secret
Leave your comment on this article: All languages of this page Home page | Library | Articles | Website map | Site Reviews www.diagram.com.ua |