4
designideas time that Pin 1 remains high. After 0.5 sec, the huzzer sounds a short beep. The buzzer then sounds two, three, and fdur fast heeps in 0.5-sec intervals. By Immediately releasing contacts C and D after hearing any number of beeps, you can set the switch for 30 second.^, 30 minutes, four hoiit^, and eight hours of operation, respectively. The choic- es of operating times are arbitrary; you can modify the code in Listing 1 to whatever fits yt)ur application. Jump- er switch J is optional. If you leave it open, touching C and D turns it off. Short-circuiting J ^ disables this option, and the switch wilt turn off only at the end of the programmed time. As is the case with the analog implemen- tation, you mount all components ex- cept the buzzer at the edge of Item A. The buzzer i.s a small piezoelectric el- ement with a resonant frequency of 4 kHz and can easily fit it\side the bat- tery compartment. In some cases, you may not have access to the negative contact of the battery holder. The circuit in Figure 3 addresses this situation. It is es- sentiniiy the same as the circuit in Figure 2, except that you place Item A in series with the positive pole and attach B to the negative pole of the battery. A P-channel MOS transistor acts as a switch, and you modify the microcontroller's program to provide a low level to drive Q,. A comment in Listing 1 indicates the proper line of code for the options in either Figure 2 or Figure 3.EDN Control system uses LabView and a PC's parallel port Carlos Alberto Aguilar Sandez, Centro de Estudios Superiores del Estado de Sonora, Unidad sede San Luis Rio Colorado, Sonora, Mexico SENSOR 2 SENSOR 3 SENSOR 4 SENSOR 5 PARKING-LOT- FULL LIGHT Figure 1 The sensors, indicator lights, and door motor of a parking lot connect through relays to the parallel port of a PC. The circuit in this Design Idea controls the inbound and out- bound traffic of cars in a parking lot. This project uses National Instru- ments' (www.ni.com) LabVlew as the main programming tool and a PC's -— parallel port for I/O. The cir- cuit uses the PC's status port, 379h, as an input for sensors, which a relay isolates to prevent damage on the PC (Figure I). At the data port, 378h, the DO bit controls a door, DI is a stop signal, D2 is the go signal, and D3 is an indicator of when the parking lot reaches its limit. All the signals drive PN2222A transistors having an external power supply—in this case, the PC's power supply, In this way, you can use relays as loads and control ac voltage for the traf- fie lights and door motor. The transistor, wbich DO drives, controls a DPDT (double-pole/ double-throw) relay to invert the motors polarity. Figure 2 shows the Lab- View diagrammatic program for controlling the parking lot. The VI (virtual instrument) in Figure 3a changes the inputs to a low state because all in- puts are high by default inside the status register. All inputs have a low state when you do not activate the sensors. The VI in Figure 3b determines a limit for the parking lot, allowing incrementing and decrement- ing the number of cars parked. 48 EDN EUROPE AUGUST 2008 www.edn-europe.com

Control system uses LabView and PCs parallel port

  • Upload
    cagh21

  • View
    134

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Control system uses LabView and PCs parallel port

designideastime that Pin 1 remains high. After0.5 sec, the huzzer sounds a short beep.The buzzer then sounds two, three, andfdur fast heeps in 0.5-sec intervals. ByImmediately releasing contacts C andD after hearing any number of beeps,you can set the switch for 30 second.̂ ,30 minutes, four hoiit̂ , and eight hoursof operation, respectively. The choic-es of operating times are arbitrary; youcan modify the code in Listing 1 towhatever fits yt)ur application. Jump-er switch J is optional. If you leave it

open, touching C and D turns it off.Short-circuiting J ̂ disables this option,and the switch wilt turn off only atthe end of the programmed time. Asis the case with the analog implemen-tation, you mount all components ex-cept the buzzer at the edge of Item A.The buzzer i.s a small piezoelectric el-ement with a resonant frequency of4 kHz and can easily fit it\side the bat-tery compartment.

In some cases, you may not haveaccess to the negative contact of the

battery holder. The circuit in Figure 3addresses this situation. It is es-sentiniiy the same as the circuit inFigure 2, except that you place ItemA in series with the positive pole andattach B to the negative pole of thebattery. A P-channel MOS transistoracts as a switch, and you modify themicrocontroller's program to providea low level to drive Q,. A comment inListing 1 indicates the proper line ofcode for the options in either Figure 2or Figure 3.EDN

Control system usesLabView and a PC's parallel portCarlos Alberto Aguilar Sandez, Centro de Estudios Superiores del Estadode Sonora, Unidad sede San Luis Rio Colorado, Sonora, Mexico

SENSOR 2

SENSOR 3

SENSOR 4

SENSOR 5

PARKING-LOT-FULL LIGHT

Figure 1 The sensors, indicator lights, and door motor of a parking lot connect throughrelays to the parallel port of a PC.

The circuit in this Design Ideacontrols the inbound and out-

bound traffic of cars in a parking lot.This project uses National Instru-ments' (www.ni.com) LabVlew as themain programming tool and a PC's-— parallel port for I/O. The cir-

cuit uses the PC's status port,379h, as an input for sensors,which a relay isolates to preventdamage on the PC (Figure I).At the data port, 378h, the DObit controls a door, DI is a stopsignal, D2 is the go signal, andD3 is an indicator of when theparking lot reaches its limit.All the signals drive PN2222Atransistors having an externalpower supply—in this case, thePC's power supply, In this way,you can use relays as loads andcontrol ac voltage for the traf-fie lights and door motor. Thetransistor, wbich DO drives,controls a DPDT (double-pole/double-throw) relay to invertthe motors polarity.

Figure 2 shows the Lab-View diagrammatic programfor controlling the parking lot.The VI (virtual instrument) inFigure 3a changes the inputsto a low state because all in-puts are high by default insidethe status register. All inputshave a low state when you donot activate the sensors. The VIin Figure 3b determines a limitfor the parking lot, allowingincrementing and decrement-ing the number of cars parked.

48 EDN EUROPE AUGUST 2008 www.edn-europe.com

Page 2: Control system uses LabView and PCs parallel port

designideas

Input 3

Iryut 5Input 6Input 7

1>[AVAILABLE SLQTSI

AUTOMATICt

MANUAL

!nInput 3Input 4

InputsInput 6Input 7

Iteiation 1Feedback lA

Iteration Z

Feedback ^Iteration 3

Feedback 3AFeedback 38

Iteration 4Feedback 4A

4BIteration 5

Feedback SAFeetfcöckSB

COKTRCM.ANDiiiirr

IrKrementDecremeni

wirue - r r

1."L

Figure 2 This LíüsView VI (virtual instalment) controls the operation of a parking lot.

D825

INPUT 3INPUT 4INPUT 5INPUT 7INPUT 6

SENSOR IN

FEEDBACK 1

FEEDBACK 2

(c)

UTCHER

INCREMENT

DECREMENT

LIMIT

FEEDBACK

-

CNT+

LIMITE

DISPLAY SET

ITERATION RESET •

StopI

—B

ITERATIONS

LATCHED OUTPUT

(a)

FLIP FLOP

Q

• QNOT

(b)

Figure 3 These Vis change the Inputs to a low state (a), determine a limit for the number of cars in the parking lot (b), workas a latch-on-reiease circuit ic), and act as a flip-flop (d).

52 EDN EUROPE I AUGUST 2008 www.edn-europe.com

Page 3: Control system uses LabView and PCs parallel port

This VI also drives a user-oriented dis-play and the shift-register connectors,feedback and iteration, on a "while"loop. The VI in Figure 3c works as alatch-on-release circuit; it generates apulse upon an itemtion when the cir-cuit teleases the high state on any ofrhe input signal.s. The VI in Figure 3dworks as a flip-flop. The VI in Figure 4allows switching from automatic tomanual mode. Feedback and iterationterminals connect to .shift registers,so that the latches and the flip-flopsinside the VI work correctly.EDN

FEEDBACK 1AFEEDBACK IBFEEDBACK 2AFEEDBACK SB

GCOUT

INMODE

FEEDBACK 5BFEEDBACK 4BFEEDBACK 4AFEEDBACK 38FEEDBACK 3AFEEDBACK 5A

INPUT 7

INPUT 4INPUT 3

TMANUAL

GQ SIGNAL

STOP SIGNAL

INCREMENT

DECREMENT

FTERATION 5

FTE RATION 4

ITERATION 3

JTERATIONÎ

ÍTE RATION 1

Figure 4 This VI allows switching from automatic to manual mode.

Low-cost circuit incorporatesmixing and amplifying functionsGuus Colman, Guy Torfs, Johan Bauwelinck, and Jan Vandewege,INTEC/iMEC, Ghent University, Ghent, Belgium

In many application.s, the tve-quency-ctmversion steps com-

prise a buffer, preferably with someextra voltage gain; a mixer; and somefiltering, lastead of including an am-plifier in front of the mixer, you caneasily integrate the mixer functionwith the amplifier. A low-cost imple-mentation uses an amplifier with apower-down-disahle feature. When asquare-wave local oscilkttor drives thedisable pin, a square wave at the oscil-lator's frequency multiplies the inputsigna!, and frequency conversion takesplace.

The circuit in Figure I uses anAnalog Devices (www.analog.com)

lüw-c()st, î00-MHz, rail-to-railAD8063 amplifier. The test circuitcomprises a noninverting-op-amp cir-cuit, which drives a load of 4 kil. Thetwo resistors in the feedback Ktop reg-ulate the voltage-conversion gain.In the test circuit, the voltage gain is20 dB. However, you must consider theswitching loss, which is about 10 dBwhen using an ideal switch and a 50%-duty-cycle clock. This scenario resultsin a 10-dB voltage-conversion gain.

Because the switching interruptsthe power-supply current, the device'sturn-on and tum-oft times have a non-negligible influence on conversiongain and nonlinearities. The AD8063's

iLim-on time, at 40 nsec, is less thanthe tum-off time of 300 nsec. In the.secases, more signal power passes to theoutput, which results in an increasein voltage-conversion gain. Figure 2shows the volrage-conversion gain ofthe rest circuit when downconvertingan input signal to 12 kH: with a local-oscillator duty cycle of 50%. You caneasily adjust this conversion gain bychanging tbe two resistors in the feed-back loop.

.'\notber aspect of a mixer's ac per-formance is distortion. The test circuitmaintains a second-order harmonicdistortion of 35 dB and a third-orderharmonic distortion of 43 dB whenmixing a 5-MHz signal to a 12-kHz,lV-p-p output signal. The circuitcan downconvert two sine waves ofidentical power at 5 and 5.002 MH:to 12 and 14 kHz, respectively, witban intermodulation distortion of47 dB.coN

LOCAL OSCILLATOR

OUT

Rgure 1 This circuit integrates the mixer functionwith a noninverting amplifier. The two resistors inthe feedback loop set the voltage-convisrsion gain.

VOLTAGE-

CONVERSION

GAIN

(dBl

10 30 30 40 50 60 70

INPUT FREQUENCY (MHz)

Figure 2 This graph shows Ihe voitage-conversion gain of thetest circuit when downconverting an input signal to 12 kHz with alocal-oscillator duty cycle of 50%. You can easily adjust this con-version gain by changing the two resistors in the feedback loop.

www.edn-Gurope.com AUGUST 2008 EDN EUROPE 53

Page 4: Control system uses LabView and PCs parallel port