Control Block
We use micro-controller PIC 16F877a with:
- 40 pins. 5 I/O ports RA, RB, RC, RD, RE.
- Up to 256 x 8 bytes of EEPROM Data Memory
Figure 1: PIC16F877
Choosing the ports connect with peripheral device:
+ Because of in CCS software support file LCD.C default using in PORTD,
so we use port RD to connect with the LCD. Set up: SET_TRIS_D(0x00).
- Pins RD4 => RD7 of PIC connect with data pins D4 => D7 of LCD.
- Pin RD0 of PIC connects with enable pin (E) of LCD.
- Pin RD1 of PIC connects with pin RS – Register Selected of LCD
- Pin RD2 of PIC connects with pin RW – Read/Write selecting mode of LCD.
+ Choosing port RB connecting with the 4x4 keyboard.
+ Choosing port RC to control the motor, switches and alert (using led).
- Pins RC0, RC1 connect to switches to control the motor stopping.
- Pins RC6, RC7 control motor through H bridge circuit.
- Pins RB5 send the signal to warning system.
Display Block
The display block is
the LCD 16x2.
Figure 2: LCD's pins
When making the LCD, manufacture integrated control chip (HD44780) inside
and only bring out necessary pins. The HD44780 has two importance 8 bit
register: IR (Instructor Register), DR (Data Register).The command register stores
the command instructions given to the LCD. A command is an instruction given to
LCD to do a predefined task like initializing it, clearing its screen, setting the cursor position,
controlling display etc. The data register stores the data to be displayed on
the LCD. The data is the ASCII value of the character to be displayed on the
LCD. By
controlling two pins RS and R/W, we can shift between two register when
communicate with MPU. The table below is the set up with two pins RS and R/W:
RS
|
R/W
|
|
0
|
0
|
Write to RS register to order the register
|
0
|
1
|
Read the busy flag at DB7 and the value of address
counter at DB0-DB6
|
1
|
0
|
Write to the DR register
|
1
|
1
|
Read data from DR
|
In the
program using LCD at mode 4 bit. The instruction using:
- lcd_send_byte( BYTE address, BYTE n ) to control LCD. For example the instruction: lcd_send_byte(0,0x01) using to clear screen, lcd_send_byte(0,0x08) display off without clearing.
- lcd_gotoxy(a,b): set write position x,y on LCD .
- printf(lcd_putc,”…”): display a string < 16 characters on the LCD.
- lcd_putc(‘…’) : display a character on the next position on the LCD .
Keyboard Block
Figure 3: Keyboard block
- Communicating with PIC 16F877a, to display, enter password, change password, open and close the door…
- Using 4x4 keyboards with the key number from 0 => 9 and functional key: open door, close door, change pass.
- To connect with microcontroller, we need to connect 8 inputs of keyboards with pull up resistor to the power terminal.
Amplifier Signal Block (Motor)
Figure 4: Motor block
- Forward controlling mode:
In this mode, 4 signals
controlling connected in 4 transistors and the condition of forward current
flow through load (motor):
+ Signal 2 =
0 (closed transistor Q2)
+ Signal 3 =
0 (closed transistor Q3)
+ Signal 4 =
1 (opened transistor Q4)
The current flows
as in the figure 5.
Figure 5: Forward controlling mode
- Reverse controlling mode:
This mode, we
also connect 4 signals controlling in 4 transistors. And 4 signals controlling
should satisfy with the condition:
+ Signal 1 =
0 (Closed transistor Q1).
+ Signal 2 =
1 (Opened transistor Q2)
+ Signal 3 =
1 (Opened transistor Q3)
+ Signal 4 =
0 (Closed transistor Q4)
And
the current flows as in the figure 6.
Figure 6: Reverse controlling mode
Power Supply Block
We create the 5V source to supply to micro-controller. Using AC source
connects to diode bridge circuit to make the DC voltage, through the capacitor to
reduce noise. Using IC7805 stabilizes the output voltage.









No comments:
Post a Comment