as a Word document

advertisement
Chapter 4 The input method for the parallel port
Overview
In the former chapter, we present three practices of the parallel ports to demonstrate the
procedure of output control, it make us understand how to change a byte content throughput to
external led. In this chapter we will introduce how to aquire signal from external circuits via the
parallel output ports. Those data could appear on the data registers and status registers of the
parallel ports, farther they could change the interface status of LabVIEW graphical control. Most of
signal from input devices, which are keyboard and/or sensor must be amplified and converted to
digital signal by A/D converter before sending to the parallel ports. We will mention those
technique to you in the following chapters.
Objective
■ To understand the control procedure of input control by using parallel ports
■ To study the output functions jugments of pins on parallel port with keystroke
■ To study how to change the status of LabVIEW graphical control interface with input
keystroke.
Keyword
■ Keyboard
■ Sensor
■ Analog to digital converter (A/D converter)
■ Explanation of function
Path
All Functions ► Mathematics ►Numeric ► Data
Manipulation ► Rotate Right With Carry
Rotates each bit in the input value to the left,
Explanation inserts carry in the low-order bit, and returns the
most significant bit.
Input
Carry is the new low-order bit of value. Value
must be an integer. It cannot be an array or a
cluster.
Output
msb carry out is the former high-order bit of
value.
value is the new value. The data type of the
output value is determined by the input value.
Path
All Functions ► Programming ► Boolean ►
True Constant
Explanation
Use this constant to provide a constant TRUE
value to the block diagram.
Path
All Functions ► Programming ► Boolean ►
Number To Boolean Array
Explanation
Input
Output
Converts an integer number to a Boolean array of
8. 16, or 32 elements
Number can be a number
Boolean array can have 8, 16, or 32 elements
Path
All Functions ► Programming ►
Boolean ► Not
Explanation
To reverse the direction of Boolean
status of the input
Input
The boolean status of the input( x)
Output
The Boolean Status of the output
(.not.x?)
Path
All Functions ► Programming ► Array
► Index Array
Explanation
Returns the element or sub-array of ndimension array at index.
Input
n-dimension array can be an ndimensional array of any type index
0..n-1 must be numeric. The number of
index input matches the number of
dimensions in n-dimension array.
Output
element or subarray has the same type
as elements of n-dimension array.
Brief
We have talk about the data register and status register as input storage for parallel ports
in some parts of the chapter one. The data register must be set by the fifth bit of the control register,
please refer to the control register parts of the chapter one. In the first part of this chapter we will
learn how to set up a keypad in order to display the byte register by LabVIEW, and next we will
learn how to set up a stopwatch in the second practice. We will divide the input part into three
keypads: controlling start, controlling stopping, and controlling clearance. For convenience´sake to
correspond LabVIEW, we will set up a table in which the first column represents for which pins has
been pressed, the second column represents for hexadecimal content of status register, the forth
column represents for decimal content of status register. In the LabVIEW program, we usually use
decimal content status register for making decision.
The pin has been
pressed
The binary systems
representation of the
status register
B7.................B0
Hexadecimal systems
representation
Decimal systems
representation
All pins have not
pressed
01111111
7F
127
ERROR(N)
01110111
77
119
SELECT
01101111
6F
111
PE
01011111
5F
95
ACKNLG(N)
00111111
3F
63
BUSY
11111111
FF
255
Download