09-01-2014، 10:16 PM
کد پیاچپی:
$regfile = "m32def.dat"
$crystal = 4000000
Dim D As Word
Dim E As Single
Dim F As Word
Dim G As Single
Config Single = Scientific , Digits = 1
Config Pinc.0 = Output
Config Pinc.2 = Output
Config Pinc.1 = Input
Config Pinc.3 = Input
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db7 = Pb.7 , Db6 = Pb.6 , Db5 = Pb.5 , Db4 = Pb.4 , Rs = Pb.2 , E = Pb.3
Cursor Off
Reset Portc.0
Reset Portc.2
D = 0
F = 0
Locate 1 , 3
Lcd "POWERED BY"
Locate 2 , 3
Lcd "NAVIDKASHI"
Wait 2
Cls
Locate 1 , 1
Lcd "ULTRA 1="
Locate 2 , 1
Lcd "ULTRA 2="
A:
Pulseout Portc , 0 , 20
Pulsein D , Pinc , 1 , 1
Pulseout Portc , 2 , 20
Pulsein F , Pinc , 3 , 1
D = D * 4
F = F * 4
E = D / 5
G = F / 5
Locate 1 , 9
Lcd E ; "cm"
Locate 2 , 9
Lcd G ; "cm"
Goto A