Printer Porta Bağlanan Likit Kristal Ekran


Aşağıdaki sistem monitörlerde az miktarda bilgi görülmesi gerektiği durumlarda monitör yerine likit kristal ekran kullanılması için tasarlanmıştır. Piyasadan rahatça temin edilebildiği için Sharp LM40x21a tercih edilmiştir. Montajı son derece basittir. 5 Volt besleme gerilimi bilgisayardan alındığı takdirde ayrıca besleme devresi yapmaya gerek kalmaz. Bağlantı şeması şekilde görüldüğü gibidir.

Test etmek için aşağıdaki Pascal kodunu kullanabilirsiniz.

{$A-,B-,D-,E-,F-,G-,I+,L-,N-,O-,P-,Q-,R-,S-,T-,V-,X-}
{$M 16384,0,655360}

uses Crt;

{
LM40x21A Lcd Display Pin Connections
-----------------------------------------------------------
Pin No  Symbol  Description          Connection       
-----------------------------------------------------------
  1      Vss    Ground potential     GND: 0 V          
  2      Vdd    Lojik power supply   +5 V power supply  
  3      Vo     Constrast Voltage    0..5 V             
  4      RS     Register select      Control signal inputs    
  5      R/W    Read/Write                              
  6      E      Enable                                  
  7      D0     Code I/O data LSB    Data bus line      
  8      D1     Code I/O data                           
  9      D2     Code I/O data                           
  10     D3     Code I/O data                           
  11     D4     Code I/O data                           
  12     D5     Code I/O data                           
  13     D6     Code I/O data                           
  14     D7     Code I/O data MSB                       
}

const
     pin17 = 8;
     pin14 = 2;
     pinRS = pin17;
     pinE  = pin14;
     Low   = 0;
     High  = 1;

var
   BaseAdr : word absolute $0000:$0408;

procedure SetPinStat(PinNo,Stat: byte);
var
   Temp : byte;
begin
 Temp := Port[BaseAdr + 2];
 case Stat of
  Low   : Temp := Temp or PinNo;
  High  : Temp := Temp and (not PinNo);
 end;
 Port[BaseAdr + 2] := Temp;
end;

procedure SendCP;
begin
 SetPinStat(pinE,High);
 Delay(1);
 SetPinStat(pinE,Low);
 Delay(1);
end;

procedure LcdCommand(Command:byte);
begin
 SetPinStat(pinRS,Low);
 Port[BaseAdr] := Command;
 SendCP;
 SetPinStat(pinRS,High);
 Delay(1);
end;

procedure LcdChar(C: char);
begin
 Port[BaseAdr] := byte(C);
 SendCP;
end;

procedure ClrLcd;
begin
 LcdCommand($01);
end;

procedure LcdXY(X,Y:byte);
var
   Adres : byte;
begin
 Adres := X + (Y * 40);
 if Adres > 80 then Exit;
 LcdCommand(128 + Adres);
end;

procedure LCursorOff;
begin
 LcdCommand($0C);
end;

procedure LCursorOn;
begin
 LcdCommand($0E);
end;

function InToStr(I,F: longint):string;
var
   S : string;
begin
 Str(I:F,S);
 InToStr := S;
end;

procedure LcdWrite(S:string);
var
   Size : byte absolute S;
   I    : byte;
begin
 for I := 1 to Size do LcdChar(S[I]);
end;

procedure ResetLcd;
begin
 LcdCommand($38);
 LcdCommand($0F);
 ClrLcd;
end;

procedure Demo1;
var
   I     : byte;
   Sayac : longint;
   S     : string;
   Ch    : char;
begin
 ClrLcd;
 LcdWrite(' Demo-1!!! Hizli sayarsa [Esc] :)) ');
 LCursorOff;
 Sayac := 0;
 repeat
  S := InToStr(Sayac,6);
  LcdXY(1,1);
  for I := 1 to 6 do LcdWrite(S[I]);
  Inc(Sayac);
  if KeyPressed then
   begin
    Ch := ReadKey;
    if Ch = #27 then Exit;
    if Ch = #0 then Ch := ReadKey;
   end;
 until False;
end;

procedure Demo2;
var
   Ch : char;
begin
 ResetLcd;
 LcdWrite('Demo-2!!! Yaz bakalim..:))');
 LcdXY(2,1);
 LcdWrite('Bitirince de [0]''a basiver..');
 repeat
  Ch := ReadKey;
  if Ch = '0' then Exit;
  if Ch = #27 then begin ClrLcd; continue; end;
  LcdChar(Ch);
 until False;
end;

begin
 ResetLcd;
 Demo1;
 Demo2;
end.

[ sayfa başı ] [ ana sayfa ] [ projeler ] [ programlar ] [ şarkılar ] [ linkler ] [ e-mail ]
Hosted by www.Geocities.ws

1