There is a problem.
This function does not work.
Code: Select all
Procedure put_str(x, y : byte; var str : string);
var i : byte;
Begin
gotoxy(x,y);
for i := 0 to length(str)-1 do
Begin
put_char(str[i]);
End;
End;
Code: Select all
Procedure put_str1(x, y : byte; var str : string);
var i: byte;
Begin
gotoxy(x,y);
i := 0;
while i < length(str) do
Begin
put_char(str[i]);
inc(i);
End;
End;
Code: Select all
//######################
_sclk : byte =5; //#####
_sda : byte =4; //#####
_cs : byte =3; //#####
_rst : byte =2; //#####
//######################
_data : byte =1; //#####
_cmd : byte =0; //#####
//######################
Procedure LCD_WRITE (cd,simvol : byte);
Var i : integer;
Begin
CLEARBIT ( PORTC , _sclk );
CLEARBIT ( PORTC , _cs );
if cd then SETBIT ( PORTC , _sda ) else CLEARBIT ( PORTC , _sda ); //
SETBIT ( PORTC , _sclk );
for i := 7 downto 0 do
begin
CLEARBIT ( PORTC , _sclk );
if TestBit(simvol,i) then SETBIT ( PORTC , _sda ) else CLEARBIT ( PORTC , _sda );
SETBIT ( PORTC , _sclk );
end;
SETBIT ( PORTC , _cs );
End;
Procedure put_char(c : char);
var
i : Byte;
begin
i := 0;
for i := 0 to 4 do
begin
if((32<=c)and(c<=64)) then LCD_WRITE(_data,nlcd_Font[c-32][i]) else LCD_WRITE(_data,nlcd_Font[c-159][i]); //nlcd_Font -> array[] of array[5] of byte
end;
LCD_WRITE(_data,0x00);
end;
Procedure gotoxy(x,y : byte); // LCD NOKIA 1100
begin
LCD_WRITE(_cmd,(0xB0 or (y and 0x0F)));// Y axis initialisation: 1011 yyyy
LCD_WRITE(_cmd,(0x00 or (x and 0x0F))); // X axis initialisation: 0000 xxxx ( x3 x2 x1 x0)
LCD_WRITE(_cmd,(0x10 or ((x shr 4) and 0x07) ) ); // X axis initialisation: 0001 0xxx ( x6 x5 x4)
end;
Procedure put_str(x, y : byte; var str : string);
var i : byte;
Begin
gotoxy(x,y);
for i := 0 to length(str)-1 do
Begin
put_char(str[i]);
End;
End;
Procedure put_str1(x, y : byte; var str : string);
var i: byte;
Begin
gotoxy(x,y);
i := 0;
while i < length(str) do
Begin
put_char(str[i]);
inc(i);
End;
End;
//**************************************
put_str1(3,3,'0000'); <- OK!!!!
put_str(3,3,'0000'); <- FREEZE!!!!!!!!!!!!!!!!!!!!!