You are on page 1of 5

$large Dim A As Byte Dim C As Byte Dim T As Byte Dim G As Byte Dim Tone As Byte Dim B0 As Byte Dim

B1 As Byte Dim B2 As Byte Dim B3 As Byte Dim B4 As Byte Dim Addr As Byte Dim Datain[addr] As Byte Dim Count As Long Dim Pass As String * 4 Dim Text As String * 4 Dim Time As Byte $crystal = 11059200 Pass = "456" P0 P1 P2 P3 = = = = 255 255 255 0

Cls Cursor Off Noblink Lcd " 3G Robot" Lowerline Lcd " " Wait 2 Cls Lcd " S.I.E.S" Wait 2 Cls Lcd " Guided By:Prof.:" Lowerline Lcd " Vandana Khot" Wait 2 Do While P0.0 = 0 Tone = 0 Text = "" Cls Lcd " Enter the" Lowerline Lcd " Passkey" Waitms 100 Wend Cls For Tone = 1 To 5 While P0.0 = 0

Wend If P0.0 = 1 Then Tone = Tone + 1 B0 = 0 B1 = P1.7 If B1 = 1 Then B0 = B0 + 1 End If B2 = P1.6 If B2 = 1 Then B0 = B0 + 2 End If B3 = P1.5 If B3 = 1 Then B0 = B0 + 4 End If B4 = P1.4 If B4 = 1 Then B0 = B0 + 8 End If If If If If If If If If If B0 B0 B0 B0 B0 B0 B0 B0 B0 = = = = = = = = = 1 2 3 4 5 6 7 8 9 Then Then Then Then Then Then Then Then Then Text Text Text Text Text Text Text Text Text = = = = = = = = = Text Text Text Text Text Text Text Text Text + + + + + + + + + "1" "2" "3" "4" "5" "6" "7" "8" "9"

Cls Lcd "Passkey:" Lowerline Lcd Text Waitmse 500 End If Next If Text = Pass Then Cls Lcd "Pass Accepted" Wait 2 Do If P0.0 = 1 Then B0 = 0 B1 = P1.7 If B1 = 1 Then B0 = B0 + 1 End If

B2 = P1.6 If B2 = 1 Then B0 = B0 + 2 End If B3 = P1.5 If B3 = 1 Then B0 = B0 + 4 End If B4 = P1.4 If B4 = 1 Then B0 = B0 + 8 End If Cls Lcd "Direction No:" ; B0 If B0 = 2 Then P3 = 0 P3.1 = 1 P3.3 = 1 End If If B0 = 4 Then P3 = 0 P3.1 = 1 P3.2 = 1 End If If B0 = 5then P3 = 0 End If If B0 = 6 Then P3 = 0 P3.0 = 1 P3.3 = 1 End If If B0 = 8 Then P3 = 0 P3.0 = 1 P3.2 = 1 End If If B0 = 1 Then P3 = 0 P3.4 = 1 Waitms 250 P3.4 = 0 End If If B0 = 3 Then P3 = 0 P3.5 = 1 Waitms 250 P3.5 = 0 End If

If B0 = 7 Then P3 = 0 P3.6 = Not P3.6 End If If B0 = 9 Then P3 = 0 P3.7 = Not P3.7 End If If B0 = 10 Then P3 = 0 End If Waitmse 100 End If Call Adc P0.0 P1.4 P1.5 P1.6 P1.7 Loop = = = = = 1 1 1 1 1

Else Cls Lcd " Wrong Passkey" Lowerline Lcd " " Wait 3 End If Loop

Sub Adc For Addr = 0 To 1 adc ic P1 = Addr Waitms 1 ort1 to ADC P1.3 = 1 Waitms 1 P1.3 = 0 Waitms 1 ' adress of CT on

' send addr from P ' Make ALE high

' Make ALE low Datain[addr] = 0 r ' clear data buffe

If P2.0 = 1 Then ta to decimal number Datain[addr] = Datain[addr] + decimal power to data buffer End If the line If P2.1 = 1 Then Datain[addr] = Datain[addr] + End If If P2.2 = 1 Then Datain[addr] = Datain[addr] + End If If P2.3 = 1 Then Datain[addr] = Datain[addr] + End If If P2.4 = 1 Then Datain[addr] = Datain[addr] + End If If P2.5 = 1 Then Datain[addr] = Datain[addr] + End If If P2.6 = 1 Then Datain[addr] = Datain[addr] + End If If P2.7 = 1 Then Datain[addr] = Datain[addr] + End If If Addr = 0 Then T = Datain[addr] to Variable End If If Addr = 1 Then G = Datain[addr] to Variable End If Next

'Convert Binary da 128 'if bit is 1 ,add 'if bit is 0, skip 64 32 16 8 4 2 1

' Data is assigned

' Data is assigned

Lowerline Lcd "Gas:" ; G ; " Temp.:" ; T ; " or End Sub

"

' Adjust Gain Fact