vb.net barcode reader Expanding Available I/O Lines in Software

Generation Data Matrix ECC200 in Software Expanding Available I/O Lines

Expanding Available I/O Lines
Scan Data Matrix In None
Using Barcode Control SDK for Software Control to generate, create, read, scan barcode image in Software applications.
Generating Data Matrix In None
Using Barcode generation for Software Control to generate, create ECC200 image in Software applications.
A bane of the microcontroller- and computer-controlled robot is the shortage of input/output pins. It always seems that your robot needs one more I/O pin than the computer or microcontroller has. As a result, you think you either need to drop a feature or two from the robot or else add a second computer or microcontroller. Fortunately, there are alternatives. Perhaps the easiest is to use a data demultiplexer, a handy device that allows you to turn a few I/O lines into many. Demultiplexers are available in a variety of types; a common component offers three input lines and eight output lines. You can individually activate any one of the eight output lines by applying a binary control signal on the three inputs. The following table shows which input control signals correspond to which selected outputs.
ECC200 Decoder In None
Using Barcode scanner for Software Control to read, scan read, scan image in Software applications.
ECC200 Drawer In Visual C#.NET
Using Barcode creation for .NET framework Control to generate, create ECC200 image in .NET applications.
INPUT CONTROL SELECTED OUTPUT
Data Matrix ECC200 Drawer In Visual Studio .NET
Using Barcode creator for ASP.NET Control to generate, create DataMatrix image in ASP.NET applications.
Data Matrix Generator In Visual Studio .NET
Using Barcode printer for .NET Control to generate, create DataMatrix image in Visual Studio .NET applications.
000 001 010 011
Making Data Matrix ECC200 In Visual Basic .NET
Using Barcode drawer for Visual Studio .NET Control to generate, create Data Matrix 2d barcode image in .NET applications.
Generating Barcode In None
Using Barcode drawer for Software Control to generate, create bar code image in Software applications.
1 2 3 4
Generating EAN-13 In None
Using Barcode printer for Software Control to generate, create EAN13 image in Software applications.
Generate UPC-A In None
Using Barcode encoder for Software Control to generate, create Universal Product Code version A image in Software applications.
452 INTERFACING WITH COMPUTERS AND MICROCONTROLLERS
Code 128A Encoder In None
Using Barcode encoder for Software Control to generate, create Code 128C image in Software applications.
ANSI/AIM Code 39 Drawer In None
Using Barcode drawer for Software Control to generate, create Code 3/9 image in Software applications.
INPUT CONTROL
Creating OneCode In None
Using Barcode drawer for Software Control to generate, create 4-State Customer Barcode image in Software applications.
Encoding UPC A In Java
Using Barcode generator for Java Control to generate, create GTIN - 12 image in Java applications.
SELECTED OUTPUT (CONTINUED)
GS1 - 13 Drawer In None
Using Barcode printer for Online Control to generate, create EAN13 image in Online applications.
Code128 Drawer In None
Using Barcode maker for Word Control to generate, create ANSI/AIM Code 128 image in Word applications.
100 101 110 111
Making Barcode In Objective-C
Using Barcode creator for iPhone Control to generate, create barcode image in iPhone applications.
Scanning Code 3 Of 9 In None
Using Barcode decoder for Software Control to read, scan read, scan image in Software applications.
5 6 7 8
Making UPC A In None
Using Barcode maker for Word Control to generate, create UPC A image in Word applications.
Code 39 Full ASCII Printer In Objective-C
Using Barcode creator for iPad Control to generate, create ANSI/AIM Code 39 image in iPad applications.
The demultiplexer includes the venerable 74138 chip, which is designed to bring the selected line LOW, while all the others stay HIGH. One caveat regarding demultiplexers is that only one output can be active at any one time. As soon as you change the input control, the old selected output is deselected, and the new one is selected in its place. One way around this is to use an addressable latch such as the 74259; another way is to use a serial-to-parallel shift register, such as the 74595. The 74595 chip uses three inputs (and optionally a fourth, but for our purposes it can be ignored) and provides eight outputs. You set the outputs you want to activate by sending the 74595 an eight-bit serial word. For example,
SERIAL WORD SELECTED OUTPUT(S)
00000001 00001001 01000110
1 1 and 4 2, 3, and 7
and so on. Fig. 29.22 shows how to interface to the 74595. In operation, software on your robot s computer or microcontroller sends eight clock pulses to the Clock line. At each clock pulse, the Data line is sent one bit of the serial word you want to use. When all eight pulses have been received, the Latch line is activated. The outputs of the 74595 remain active until you change them (or power to the chip is removed, of course). If this seems like a lot of effort to expend just to turn three I/O lines into eight, many microcontrollers (and some computers) used for robotics include a Shiftout command that does all the work for you. This is the case, for example, with the Basic Stamp II (but not the Basic Stamp I), the BasicX-24, and several others. To use the Shiftout command, you indicate the data you want to send and the I/O pins of the microcontroller that are connected to the 74595. You then send a short pulse to the Latch line, and you re done! A key benefit of the 74595 is that you can cascade them to expand the I/O options even more. There are still other ways to expand I/O lines, including serial peripheral interface (SPI), the Dallas 1-Wire protocol, and others. We briefly introduced several of the more commonly used systems earlier in this chapter. If your computer or microcontroller supports one or more of these systems you may wish to investigate using these systems in case you find you are running out of I/O lines for your robot.
BITWISE PORT PROGRAMMING 453
Latch all Clear all Serial clock Serial data in
74595 Serial-in/parallel out shift register 15 13 A 1 /G B 12 C 2 3 D 10 4 E 5 F 6 G 11 7 H 14
Parallel outputs
To additional 74595s, if any
FIGURE 29.22 The 74595 serial-in/parallel-out (SIPO) shift register lets you expand the data lines and select multiple lines at the same time.
Bitwise Port Programming
Controlling a robot typically involves manipulating one or more input/output lines ( bits ) on a port attached to a computer or built into a microcontroller. A common layout for an I/O port is eight bits, comprising eight individual connection pins. This is the same general layout as the parallel port found on IBM PC-compatible computers, which provides eight data lines for sending characters to a printer or other device (along with a few additional input and output lines used for control and status). The design of the typical microcontroller or computer, as well as the usual program tools for it, doesn t make it easy to directly manipulate the individual bits of a port. Rather, you must manipulate the whole port all at once and, in doing so, hopefully alter only the desired bits. The alternative is to send a whole value from 0 to 255 for an eightbit port, and 0 to 15 for a four-bit port to the port at the same time. This value corresponds to the bits you want to control. For example, given an eight-bit port, the number 54 in binary is 00110110. Fortunately, with a little bit of programming it s not hard to convert numeric values into their corresponding bits, and vice versa. Each programming language provides a different mechanism for these procedures, and what follows in the next few sections are simple approaches using Visual Basic. Other languages, such as C, offer more robust bit-handling operators that you can take advantage of. The sample code that follows is meant more to teach you the fundamentals than to be applied directly with a robot. Take the ideas and adapt them to your particular case.
Copyright © OnBarcode.com . All rights reserved.