Пт дек 10, 2021 00:56:47
Пт дек 10, 2021 02:08:40
MPLAB Вам не поможет. В нём можно писать только на АСМ и С. А этот код на каком-то непонятном языке.maksdonetskiy писал(а):скачал mplab, компиляторы,
Пт дек 10, 2021 02:39:03
Пт дек 10, 2021 09:32:28
Пт дек 10, 2021 13:30:17
Пт дек 10, 2021 16:14:07
program bakometr;
const
stNormal : byte = 1;
stCalibr : byte = 2;
AdrHi : byte = 12;
litr : array [0..AdrHi] of byte = (0,5,10,15,20,25,30,35,40,45,50,55,60);
var
C1 : sbit at porta.5;
C2 : sbit at porta.2;
i,j,cc: byte;
V : word; absolute 0x30;
Vhi : byte; absolute 0x31;
VLo : byte; absolute 0x30;
L10,L1:byte;
dat : array [0..AdrHi] of byte;
mode : byte;
calibrN : byte;
procedure Led(i: byte);
begin
if I=0 then begin
portc:=$04;
porta.4:=0;
end;
if I=1 then begin
portc:=$2D;
porta.4:=1;
end;
if I=2 then begin
portc:=$22;
porta.4:=0;
end;
if I=3 then begin
portc:=$28;
porta.4:=0;
end;
if I=4 then begin
portc:=$09;
porta.4:=1;
end;
if I=5 then begin
portc:=$18;
porta.4:=0;
end;
if I=6 then begin
portc:=$10;
porta.4:=0;
end;
if I=7 then begin
portc:=$0D;
porta.4:=0;
end;
if I=8 then begin
portc:=$00;
porta.4:=0;
end;
if I=9 then begin
portc:=$08;
porta.4:=0;
end;
end;
procedure delay10;
begin
delay_ms(10);
end;
procedure ReadData;
begin
for i := 0 to AdrHi do dat[i]:=EEPROM_Read(i);
end;
begin
porta := %00010000;
trisa := %11001011;
portc := $FF;
trisc := 0;
wpua := 1;
cmcon := $07;
ansel := 2;
adcon0:= 4;
adcon1:= $30;
mode:=stNormal;
ReadData;
ADC_Init;
i:=0;
while true do
begin
inc(I);
if mode = stNormal then
begin
if (i.7) and (V<6) then
begin
C1:=0;
C2:=0;
end;
if i=0 then
begin
V:=ADC_Read(1);
V:=V shr 2;
if V<=dat[AdrHi]
then V:=litr[adrHi]
else begin
if V>=dat[0]
then V:=litr[0]
else begin
for j:=0 to AdrHi-1 do
if (V<=dat[j]) and (V>dat[j+1]) then cc:=j;
if cc=AdrHi
then V:=Litr[AdrHi]
else begin
V:= (dat[cc]-V);
j:=(Litr[cc+1]-Litr[cc]);
V:= V * j;
j:=(dat[cc]-dat[cc+1]);
V:= V / j;
V:= V + litr[cc];
end;
end;
end;
L10:= v div 10;
L1 := V mod 10;
if (porta.0 = 0) then
begin
C1:=1;
C2:=1;
portc:=$3B;
porta.4:=1;
calibrN:=0;
mode:=stCalibr;
delay10;
repeat until porta.0 = 1;
delay10;
end;
end;
end;
if mode = stCalibr then
begin
L10:=litr[calibrN] div 10;
l1:=litr[calibrN] mod 10;
if i>127 then
begin
C1:=0;
C2:=0;
end;
if porta.0 = 0 then
begin
delay10;
repeat until porta.0 = 1;
delay10;
V:=adc_read(1);
V:=V shr 2;
EEPROM_Write(calibrN,VLo);
inc(calibrN);
if calibrN>AdrHi then
begin
mode:= stNormal;
CalibrN:=0;
delay10;
delay10;
delay10;
delay10;
ReadData;
end;
end;
end;
delay_ms(1);
if i.0 then begin
C2 := 0;
Led(L10);
C1 := 1;
end else
begin
C1 := 0;
Led(L1);
C2 := 1;
end;
end;
end.
Пт дек 10, 2021 20:33:40
Пт дек 10, 2021 21:39:44
Сб дек 11, 2021 02:57:29
Сб дек 11, 2021 10:05:16
if (i.7) and (V<6) then
begin
C1:=0;
C2:=0;
end;
Сб дек 11, 2021 11:53:59
Вс дек 12, 2021 21:28:22
Пн дек 13, 2021 17:46:18
Пн дек 13, 2021 18:37:01
Пн дек 13, 2021 19:58:47
Пн дек 13, 2021 21:36:43
Вт дек 14, 2021 00:22:10
Вт дек 14, 2021 09:43:37
Вт дек 14, 2021 10:35:28
Вт дек 14, 2021 10:52:15