My Link

Photobucket

Macam-macam rangkaian digital

Counter Teller

Schema Digitale teller

ADC menggunakan Port Paralel

procedure TForm1.Timer1Timer(Sender: TObject);
begin
asm
push dx
mov dx,$37A //alamat ofset control parallel
mov al,$32 //isi dengan 32 {0010 0000} enable Bi-Directional
out dx,al
pop dx
end;

begin
asm
push dx
mov dx,$37A //alamat ofset control parallel
mov al,$36 //isi dengan 36 {0010 0100} aktifkan pin no.3 ADC 804
out dx,al
pop dx
end;

begin
asm
push dx
mov dx,$37A //alamat ofset control parallel
mov al,$37 //isi dengan 37 {0010 0101} strobe (enable ADC Output)
out dx,al
pop dx
end;

begin
asm
push dx
mov dx,$378 //alamat dasar parallel
in al,dx // baca input Parallel port
mov data,al
pop dx
end;

begin
asm
push dx
mov dx,$37A //alamat ofset control parallel
mov al,$36 //isi dengan 36 {0010 0100} disable ADC Output
out dx,al
pop dx
end;
data1:=(5/255)*data; //konversi ke 0-5Volt
lcdnumber1.Value:=floattostr(data1); //tampilkan hasil
end;
end;
end;
end;
end;

PPI 8255 48 port

COMPUTER INTERFACE(ComIt) - ISA48 I/O CARD BY KFW

BASE ADDRESS

The example above set the base address to 0x300. The ISA48 I/O card uses a total of 8 address, as shown below:

PIO #1

BASE ADDRESS + 0x00 = Port A Register

BASE ADDRESS + 0x01 = Port B Register

BASE ADDRESS + 0x02 = Port C Register

BASE ADDRESS + 0x03 = Control Register

PIO #2

BASE ADDRESS + 0x04 = Port A Register

BASE ADDRESS + 0x05 = Port B Register

BASE ADDRESS + 0x06 = Port C Register

BASE ADDRESS + 0x07 = Control Register

PROGRAMMING EXAMPLE

Using MicroSoft Quick C as an example:

To set port A, port B and Port C to all outputs on PIO #1

#define BASE 0x300

#include

#include

main()

{

outp(BASE+0x03,0x80); // control register of PIO#1 - all ports to outputs

outp(BASE+0x00,0xff); // set all bits of port A high

outp(BASE+0x01,0x00); // set all bits of port B low

outp(BASE+0x02,0x40); // higher nibble of port C high, lower nibble low

}

See 82C55 datasheet for port configuration details

ISA48 I/O CARD BY KFW

PIO #1 25SUB D CONNECTOR PIO #2 25SUB D CONNECTOR

PIN FUNCTION PIN FUNCTION

1 ground 1 PA3

2 PA2 2 PA2

3 PA6 3 PA1

4 PA1 4 ground

5 PA7 5 PB2

6 PA0 6 PB0

7 PC7 7 PC2

8 PC5 8 PB7

9 PC0 9 PB6

10 PC2 10 PB5

11 PC3 11 PB4

12 PB0 12 PB3

13 PB1 13 PC1

14 PA5 14 PA4

15 PA3 15 PA5

16 PA4 16 PA6

17 PB3 17 PA0

18 PB2 18 PA7

19 PB4 19 PB1

20 PC6 20 PC3

21 PC4 21 PC0

22 PC1 22 PC7

23 PB7 23 PC6

24 PB6 24 PC5

25 PB5 25 PC4

Parallel Port Relay Interface

Below are three examples of controlling a relay from the PC's parallel printer port (LPT1 or LPT2). Figure A shows a solid state relay controlled by one of the parallel port data lines (D0-D7) using a 300 ohm resistor and 5 volt power source. The solid state relay will energize when a "0" is written to the data line. Figure B and C show mechanical relays controlled by two transistors. The relay in figure B is energized when a "1" is written to the data line and the relay in figure C is energized by writing a "0" to the line. In each of the three circuits, a common connection is made from the negative side of the power supply to one of the port ground pins (18-25).

There are three possible base addresses for the parallel port You may need to try all three base addresses to determine the correct address for the port you are using but LPT1 is usually at Hex 0378. The QBasic "OUT" command can be used to send data to the port. OUT, &H0378,0 sets D0-D7 low and OUT, &H378,255 sets D0-D7 high. The parallel port also provides four control lines (C0,C1,C2,C3) that can be set high or low by writing data to the base address+2 so if the base address is Hex 0378 then the address of the control latch would be Hex 037A. Note that three of the control bits are inverted so writing a "0" to the control latch will set C0,C1,C3 high and C2 low.

Menu

Reading Data From The Parallel Port

The diagram below shows 5 switches connected to the 5 input lines of the parallel port. An external 5 volt power supply is used to provide high logic levels to the input pins when the switches are open. Three 1.5 volt batteries in series can be used to obtain 4.5 volts which is close enough. The 330 ohm resistors in series with the port connections provide some protection in case a connection is made to the wrong pin. If you are sure of the connections, the 330 ohm resistors can be left out and the switches connected directly to the input pins. The negative side of the power supply should be connected to the ground point, or any pin from 18 to 25.

The following short QBasic program can be used to read the state of the switches. QBASIC.EXE can be found in the "OLDMSDOS" directory of the Windows 95/98 CD Rom. Note that there are three possible printer port address that correspond to LPT1, LPT2 and LPT3 and LPT1 is usually the one to use which is at address decimal 889. The program waits for the user to press the enter key before reading the state of the 5 input lines. The state of the 5 lines is received as a single 8 bit number between 0-255 which is stored as the value of (V). Each switch input represents a decimal value of 8,16,32,64 and 128 which correspond to pins 15,13,12,10 and 11. The last 3 bits (1,2 and 4) are not used and should return a high level, so the value received with all switches open should be 1+2+4+8+16+32+64=127. If a switch is closed and the input is at ground, the value will be 0 except for pin 11 which is inverted and yields a value of 128 and 0 when high, so the value received when all switches are closed should be 1+2+4+128=135.
-----------------------------------------------------------------------

CLS
DEFINT A-Z
Address = 889: REM 889 = port address, other addresses could be 633 or 957
PRINT "Press the enter key to read printer port pins (15,13,12,10,11)"
PRINT "A (0) reading indicates the pin is at ground level, (1) indicates"
PRINT "the pin is at a high level or unterminated."
INPUT A$
V = INP(Address)
PRINT V
P11 = 1
IF V > 127 THEN P11 = 0: V = V - 128
IF V > 63 THEN P10 = 1: V = V - 64
IF V > 31 THEN P12 = 1: V = V - 32
IF V > 15 THEN P13 = 1: V = V - 16
IF V > 7 THEN P15 = 1
PRINT
PRINT "Pin 15 ="; P15
PRINT "Pin 13 ="; P13
PRINT "Pin 12 ="; P12
PRINT "Pin 10 ="; P10
PRINT "Pin 11 ="; P11
END

12 Volt Lamp Dimmer

Here is a 12 volt / 2 amp lamp dimmer that can be used to dim a standard 25 watt automobile brake or backup bulb by controlling the duty cycle of a astable 555 timer oscillator. When the wiper of the potentiometer is at the uppermost position, the capacitor will charge quickly through both 1K resistors and the diode, producing a short positive interval and long negative interval which dims the lamp to near darkness. When the potentiometer wiper is at the lowermost position, the capacitor will charge through both 1K resistors and the 50K potentiometer and discharge through the lower 1K resistor, producing a long positive interval and short negative interval which brightens the lamp to near full intensity. The duty cycle of the 200 Hz square wave can be varied from approximately 5% to 95%. The two circuits below illustrate connecting the lamp to either the positive or negative side of the supply.

0 komentar: