You are on page 1of 8

BASCOM Codes

Dim A As Byte , Index As Byte


Config Lcdpin = Pin , Db4 = P0.2 , Db5 = P0.3 , Db6 = P0.4 , Db7 = P0.5 , E = P0.6 ,
Rs = P0.7
Config Lcd = 16 * 2
Begin:
Cls
Home Upper
Lcd "ASSALAMUALAIKUM"
Lowerline
Lcd " WELCOME "
Wait 3

'Text Displayed
'Text Displayed
'Delay for 3 sec

Do
'If SW1 pressed
If P0.0 = 0 Then
'LED set to be HIGH
P2 = 1
Cls
Home Upper
Lcd "GATE IS OPEN"
Waitms 50
Lowerline
Waitms 15
Lcd "SELAMAT DATANG"
For A = 1 To 4 Step 1

'Text Displayed

'LED move to left bit by

bit
Shift P2 , Left , 1
Wait 1
Reset P2.0
Shiftlcd Right
Waitms 50
Next
For A = 1 To 4 Step 1
Shift P2 , Left , 1
Wait 1
Reset P2.0
Shiftlcd Left
Waitms 50
Next
P3 = 01
(open gate)
Waitms 500
P3 = 00
Goto Begin
End If

'Motor start do forward


'Delay 500ms
'Motor stop operate
'Return to first instruction

If P0.1 = 0 Then
P2 = 128
Cls
Home Upper
Lcd "GATE IS CLOSE"
Waitms 50
Lowerline
Waitms 15
Lcd "DATANG LAGI"
For A = 1 To 4 Step 1
bit
Shift P2 , Right , 1
Wait 1
Reset P2.7
Shiftlcd Right
Waitms 50
Next
For A = 1 To 4 Step 1
Shift P2 , Right , 1
Wait 1
Reset P2.7
Shiftlcd Left
Waitms 50
Next
P1 = 0
9-0
For Index = 0 To 9 Step 1
P1 = Lookup(index , 7seg)
Wait 1
Next
P3 = 02
reverse(close gate)
Waitms 500
P3 = 00

'If SW2 pressed


'Text displayed

'LED move to right bit by

'7-segment start counting

'Motor will do
'Delay for 500ms
'Motor will stop operates

Goto Begin
instruction
End If
7seg:
Data 103 , 127 , 7 , 125 , 109 , 102 , 79 , 91 , 6 , 63
Loop
End

'Then its return to first

Project Operation

-LCD displayed texts.


- The system is ready to be used.

Open Gate
-

Select P0.0 to start operation.


LCD will display the text and move to
left.
LED at P2 will high and move to the left
bit by bit

When the LCD stop moving and the all


LED reset,
The motor at P3 will do forward
operation.
The gate open.

Close Gate
-

SW2 at P0.1 is used to close the gate.


LCD will display the text and move to
right.
LED at P2 will high and move to the
right bit by bit

When the operation of


LCD and LED done,

The 7-segment will


start counting for 10
second
starting at 9 to 0.

The motor will do reverse operation


since the 7-segment complete the
counting to 0.
The gate start to close.

INPUT/OUTPUT

Finally, its return to the first instruction.


Requires us what to do next action.

LCD Display
SW
1
SW
2

Block Diagram
DC
Motor
(Open
gate/Clo
se gate)

Task Delegation

GROUP MEMBER
Mohd Farhan Bin Mohd Shahrin Silva
Fikrul Hakim Bin Othman
Muhammad Khalid Bin Md Taib

Week
6
7
8

Person In charge
All team members
Fikrul, Farhan and Khalid
Fikrul, Khalid, and Farhan

Task
Project Design
Design program
1)Test program
2)Design target board

All members

10
11
12
13
14

All members
All members
All members
All members
All members

Construct and assemble target


board
Test and troubleshoot
Final test and complete project
Report writing
Presentation
Presentation

Ghant Chart for Project Operation.

You might also like