nadjib
05-19-2006, 10:56 AM
السلام عليكم ورحمة الله و بركاته
عندي برنامج بلغة basic و هو برنامج يوضع بعد تحويله في PIC 16F628A لكن للأسف وجدت البرنامج بدون وضع المتغيرات فيه (variable)كل ما أريده من يستطيع أن يساعدني على وضع المتغيرات
البرنامج
MAIN:
pause 10
compte=0
GOSUB FREQ40
if compte<125 then
led=compte/10
input leda
input ledb
low ledb
endif
if compte>125 and compte<245 then ‘5÷45 cm
led=(compte-125)/10
input leda
input ledb
high ledb
endif
if compte>245 and compte<365 then ‘45÷90 cm
led=(compte-245)/10
input leda
input ledb
high leda
endif
if compte>365 and compte<485 then ‘90÷135 cm
led=(compte-365)/10
input leda
input ledb
low leda
endif
if compte>485 then ‘135÷180 cm
led=(compte-485)/10
input leda
input ledb
INPUT LED1
INPUT LED2
INPUT LED3
INPUT LED4
INPUT LED5
INPUT LED6
led=15
endif
iF DISPLAY=1 THEN
GOSUB LCD
ELSE
gosub allumeled
ENDIF
pause 100
if PULS=0 THEN
tmp=0
while puls=0 and tmp<60
high buzzer
tmp=tmp+1
pause 50
wend
if tmp<58 then
deshabilite=1
else
pulsout buzzer,20000
if compte>=10000 then
compte=0
endif
Write 1,COMPTEL
Write 2,COMPTEH
IF DISPLAY=1 THEN
if compte<12000 then
tmp= (compte*11)/30
endif
LCDOut $FE,$01,”Distance “
LCDOut $FE,$C0,”d'alarme: “,dec3 tmp,” Cm”
PAUSE 2000
else
for tmp=0 to 2
INPUT LED1
INPUT LED2
INPUT LED3
INPUT LED4
INPUT LED5
INPUT LED6
pause 250
gosub allumeled
pause 250
next tmp
ENDIF
endif
ENDIF
if deshabilite=0 then
READ 1,TMPL
READ 2,TMPH
IF compte<tmp THEN
if compte>20 then
high buzzer
pulsout buzzer,15000
if compte>180 then
compte=180
endif
compte=(compte*compte)*2
pauseus compte
else
low buzzer
endif
ELSE
high BUZZER
ENDIF
else
high BUZZER
timer=timer+1
if timer=>140 then ‘15 secondes
timer=0
deshabilite=0
endif
endif
GOTO MAIN
عندي برنامج بلغة basic و هو برنامج يوضع بعد تحويله في PIC 16F628A لكن للأسف وجدت البرنامج بدون وضع المتغيرات فيه (variable)كل ما أريده من يستطيع أن يساعدني على وضع المتغيرات
البرنامج
MAIN:
pause 10
compte=0
GOSUB FREQ40
if compte<125 then
led=compte/10
input leda
input ledb
low ledb
endif
if compte>125 and compte<245 then ‘5÷45 cm
led=(compte-125)/10
input leda
input ledb
high ledb
endif
if compte>245 and compte<365 then ‘45÷90 cm
led=(compte-245)/10
input leda
input ledb
high leda
endif
if compte>365 and compte<485 then ‘90÷135 cm
led=(compte-365)/10
input leda
input ledb
low leda
endif
if compte>485 then ‘135÷180 cm
led=(compte-485)/10
input leda
input ledb
INPUT LED1
INPUT LED2
INPUT LED3
INPUT LED4
INPUT LED5
INPUT LED6
led=15
endif
iF DISPLAY=1 THEN
GOSUB LCD
ELSE
gosub allumeled
ENDIF
pause 100
if PULS=0 THEN
tmp=0
while puls=0 and tmp<60
high buzzer
tmp=tmp+1
pause 50
wend
if tmp<58 then
deshabilite=1
else
pulsout buzzer,20000
if compte>=10000 then
compte=0
endif
Write 1,COMPTEL
Write 2,COMPTEH
IF DISPLAY=1 THEN
if compte<12000 then
tmp= (compte*11)/30
endif
LCDOut $FE,$01,”Distance “
LCDOut $FE,$C0,”d'alarme: “,dec3 tmp,” Cm”
PAUSE 2000
else
for tmp=0 to 2
INPUT LED1
INPUT LED2
INPUT LED3
INPUT LED4
INPUT LED5
INPUT LED6
pause 250
gosub allumeled
pause 250
next tmp
ENDIF
endif
ENDIF
if deshabilite=0 then
READ 1,TMPL
READ 2,TMPH
IF compte<tmp THEN
if compte>20 then
high buzzer
pulsout buzzer,15000
if compte>180 then
compte=180
endif
compte=(compte*compte)*2
pauseus compte
else
low buzzer
endif
ELSE
high BUZZER
ENDIF
else
high BUZZER
timer=timer+1
if timer=>140 then ‘15 secondes
timer=0
deshabilite=0
endif
endif
GOTO MAIN
