Home

9 May 2008 9 May 2008 - Faculty Home

image

Contents

1. Denga est Figure 3 6 Protel SE 99 1 Design Window This is the main editing window It displays the contents of open documents and folders Each open design database will have its own design window To open a document or folder click on its name in the navigation tree To split the design window in order show multiple documents simultaneously right click on a document 26 tab and select one of the Split options from the popup menu To close a document right click on its document tab and select Close from the popup menu 2 Document tabs Each open document or folder is shown by a tab in the design window Click on a document s tab to make it active The active tab is indicated by a document or folder icon in the tab area To split the design window in order show multiple documents simultaneously right click on a document tab and select one of the Split options from the popup menu To close a document right click on its document tab and select Close from the popup menu 3 Design Manager Panel The Design Manager panel is used to display the Explorer navigation tree which provides a Windows Explorer like hierarchical tree view of the design desktop allowing you to navigate the various documents and folders contained in each design database The Design Manager panel is also used to display document editor specific browse panels Available panels are shown as tabs at the top of the Design Manager panel To sh
2. R ke R ke Change Password oko R ke ke ROF void change_password save 0 digit 0 save 1 digit 1 save 2 digit 2 save 3 digit 3 save 4 digit 4 save 5 digit 5 write_program_memory 0x1800 save 6 Identify The Pressed Button at Keypad void press 10 tmp 0x31 counter_1 check_counter void press_2 tmp 0x32 counter_1 check_counter 98 void press_3 tmp 0x33 counter_1 check_counter void press_4 tmp 0x34 counter_1 check_counter void press 50 tmp 0x35 counter_1 check_counter void press_6 tmp 0x36 counter_1 check_counter void press_7 tmp 0x37 counter_1 check_counter void press_8 tmp 0x38 counter_1 check_counter void press_9 tmp 0x39 counter_1 check_counter void press 00 tmp 0x30 counter 10 check_counter 99 void confirm_page_next page 2 pages void confirm_page_back page 1 pages void keytest int8 x for x 0 x lt 6 x if bit_test keytmp 0 0 keyNew keyCnt skip_2 1 KeyFlag 1 shift_right amp keytmp 1 1 keyCnt void identify key KeyFlag 0 keycnt 0 keytmp tmp00 keytest if KeyFlag 0 keytmp tm
3. 0x00 0000 0000 0011 1110 0 51 01010001 0x49 0100 1001 0 45 0100 0101 Ox3e 00111110 0x00 0000 0000 M binary Display 0 0 0x00 0x42 Ox7f 0x40 0x00 0 0x00 0000 0000 0x00 0000 0000 0x42 01000010 Ox7f 01111111 0x40 01000000 0x00 0000 0000 0x00 0000 0000 binary 0 0x42 0x61 0 51 0x49 0x00 0000 0000 0x42 0100 0010 0 6 01100001 0 51 01010001 0 49 01001001 0 46 01000110 0x00 0000 0000 Hex binary 0 0x21 0x41 0x45 0x4b 0 0x00 0000 0000 0 21 0010 0001 0x41 01000001 0 45 01001001 01001011 0x31 01100001 0 00 0000 0000 _ P Hex binary Display 1 46 0 Display 2 1 0 Display 3 61 Display Mark const int8 bmpc_2b 7 0 Ox7f Ox7f Ox7f Ox7f Ox7f 0 display all const int8 bmpc_2c 7 0 0x02 0x01 0x51 0x09 0x06 0 display const int8 bmpc_2d 7 0 0x00 0x60 0x60 0x00 0x00 0 display const int8 bmpc_2e 7 0 0x08 0x08 0x08 0x08 0x08 0 display const int8 bmpc_2f 7 10 0x00 0x41 0x22 0x14 0x08 0 display gt const int8 bmpc_30 7 0 0x08 0x14 0x22 0x41 0x00 0 display lt 0x49 0x2a Ox1c Ox7f Ox1c 2 0x49 display 0x18 0x18 0x18 0x18 0x18
4. 50 SEC_L display_char SEC_H delay_ms 1000 page 1 pages page_6 SEC_L display char SEC_H delay_ms 1000 page 4 pages return else page_6 SEC_L display char SEC H delay ms 1000 page 4 pages return if page 4 if counter 6 else if page 3 page 9 pages change 1 page_6 SEC_L display char SEC H delay ms 1000 page 40 check password if code 6 page 4 else pages page_6 SEC_L display_char SEC_H delay_ms 1000 pages if page 2 page 3 pages return counter 0 if keyNew 2 press down bUpdateLCD 1 counter 0 confirm_page_back motorl L motor2 H EN H delay ms 12 EN L if keyNew 5 press up bUpdateLCD 1 Phone_H delay_ms 1000 Phone_L if keyNew 15 bUpdateLCD 1 counter 0 confirm_page_back if keyNew 17 press next bUpdateLCD 1 counter 0 confirm_page_next PEER ok a kok Scan for key PEER ok a A void scan_key ScanO L delay us 10 tmp00 input OxCO Scan0 H Scanl L delay us 10 tmp01 input 501 OxCO 105 Scanl H Scan2 L delay us 10 tmp02 input OxCO Scan2 H Activate Alarm System J PR tE
5. 0 0x20 0x54 0x54 0x54 0x78 0 a m 0 Ox7f 0x48 0x44 0x44 0x38 0 0 0x38 0x44 0x44 0x44 0x20 0 0 0x38 0x44 0x44 0x48 Ox7f 0 0 0x38 0x54 0x54 0x54 0x18 01 0 0x08 7 0x09 0x01 0x02 0 0 0x52 0x52 0x52 0 0 Ox7e 0x08 0x04 0x04 0x78 0 0 0x00 0x44 0 74 0x40 0x00 0 0 0x20 0x40 0x44 0x3d 0x00 0 0 Ox7f 0x10 0x28 0x44 0x00 0 0 0x00 0x41 0 7 0x40 0x00 0 0 7 0x04 0x18 0x04 0x78 0 const int8 bmpc_nz 13 7 0 0x7c 0x08 0x04 0x04 0x78 0 0 0x38 0x44 0x44 0x44 0x38 0 0 Ox7c 0x14 0x14 0x14 0x08 0 0 0x08 0x14 0x14 0x18 7 0 0 7 0x08 0x04 0x04 0x08 0 0 0x48 0x54 0x54 0x54 0x20 0 78 79 0 0x04 Ox3f 0x44 0x40 0x20 0 0 0 3 0x40 0x40 0x20 7 0 0 Ox 1c 0x20 0x40 0x20 Ox1c 0 0 0x40 0x30 0x40 0 0 0x44 0x28 0x10 0x28 0x44 0 0 0x50 0x50 0x50 0 0 0x44 0x64 0x54 4 0x44 0 display UNIVERSITI const char con_sole1 12 U N T V 5 T T 0xa2 Oxa2 display TEKNOLOGI const char con_sole2 12 T E K N L O 5 T 0xa2 2 2 display MALAYSIA const char con_sole3 12 M L A Y 5 2 Oxa2 2 2 define rd RdFlIg bitO
6. 0 Ox1f 0x20 0x40 0x20 0x1f 0 0 Ox3f 0x40 0x38 0x40 Ox3f 0 0 0x63 0x14 0x08 0x14 0x63 0 0 0x07 0x08 0x70 0x08 0x07 0 0 0x61 0 51 0x49 0x45 0x43 0 Display Character from to 7 const int8 bmpc_am 13 7 110 0x20 0x54 0x54 0x54 0x78 0 a m 0 Ox7f 0x48 0x44 0x44 0x38 0 0 0x38 0x44 0x44 0x44 0x20 0 0 0x38 0x44 0x44 0x48 Ox7f 0 0 0x38 0x54 0x54 0x54 0x18 0 0 0x08 Ox7e 0x09 0x01 0x02 0 0 0x52 0x52 0x52 Ox3e 0 0 Ox7e 0x08 0x04 0x04 0x78 0 0 0x00 0x44 0x7d 0x40 0x00 0 0 0x20 0x40 0x44 0x00 0 0 Ox7f 0x10 0x28 0x44 0x00 0 0 0x00 0x41 Ox7f 0x40 0x00 0 0 7 0x04 0x18 0x04 0x78 0 Y 63 const int8 bmpc_nz 13 7 10 7 0x08 0x04 0x04 0x78 0 0 0x38 0x44 0x44 0x44 0x38 0 0 Ox7c 0x14 0x14 0x14 0x08 0 0 0x08 0x14 0x14 0x18 0x7c 0 0 Ox7c 0x08 0x04 0x04 0x08 0 0 0x48 0x54 0x54 0x54 0x20 0 0 0x04 Ox3f 0x44 0x40 0x20 0 0 Ox3c 0x40 0x40 0x20 Ox7c 0 0 1 0x20 0x40 0x20 1 0 0 Ox3c 0x40 0x30 0x40 Ox3c 0 0 0x44 0x28 0x10 0x28 0x44 0 0 OxOc 0x50 0x50 0x50 Ox3c 0 0 0x44 0x64 0x54 Ox4c 0x44 0 The programming has been used to develop the firmware for the microcontroller 16F876A C language has been chosen
7. 96 case 0 LCDROW3 3 0X2a break case 1 LCDROW3 4 0X2a break case 2 LCDROW3 5 0X2a break case 3 LCDROW3 6 0X2a break case 4 LCDROW3 7 0X2a break case 5 LCDROW3 8 0X2a break Make Sure Only 6 Digits for Password void check_counter if counter gt 7 page_6 SEC_L display char SEC H delay ms 1000 if page 10 if page 3 page_3 if page 4 page 9 page_4 counter 0 RR k oE Hs ke ok ke kokok Save Digits For Password J PR tE 2k sk k oE ske ke void save_digit save 0 0x32 save 1 0x33 save 2 0x34 save 3 0x35 save 4 0x36 save 5 0x37 Check Password void check_password code 0 97 read_program_memory 0x1800 save 6 if save 0 Oxff save digit if digit 0 save 0 code if digit 1 save 1 code if digit 2 save 2 if digit 3 save 3 code if digit 4 save 4 if digit 5 save 5 digit 0 88 void check_new_password confirm 0 if digit 0 second 0 confirm if digit 1 second 1 confirm if digit 2 second 2 confirm if digit 3 second 3 confirm if digit 4 second 4 confirm if digit 5 second 5 confirm
8. LCDRowl 6 r LCDRowl 7 d LCDRow1 8 0xa2 LCDRow1 9 0x3f LCDRow1 10 0xa2 LCDRow1 11 0xa2 LCDRow2 0 0xa2 LCDRow2 1 0x12 for i 2 1 lt 10 i LCDRow 2 i 0x15 LCDRow2 10 0x11 91 LCDRow2 11 0xa2 LCDRow3 0 0xa2 LCDRow3 1 0x16 for i 2 1 lt 10 i LCDRow3 i 0xa2 LCDRow3 10 0x16 LCDRow3 11 2 LCDRow4 0 0xa2 LCDRow4 1 0x13 for i 2 1 lt 10 i LCDRow4 i 0x15 LCDRow4 10 0x14 LCDRow4 11 0xa2 1 0 1 lt 12 1 LCDRow5S i 0xa2 void page_3 Password 7 LCDRow0 0 O LCDRow0 1 LCDRow0 2 4 for i 3 1 lt 12 i LCDRow0 i 0xa2 password void page 4 New Password 7 try 0 LCDRow0 0 N LCDRow0 1 LCDRow0 2 w for i 3 1 lt 12 i LCDRow0 i 0xa2 password void page 9 Confirm 7 92 LCDRow0 0 LCDRow0 1 o LCDRow0 2 LCDRow0 3 f LCDRow0 4 1 LCDRow0 5 LCDRow0 6 LCDRow0 7 0xa2 LCDRow0 8 0x3f LCDRow0 9 0xa2 LCDRow0 10 0xa2 LCDRow0 11 0xa2 upper box void page 5 Password Changed try 0 code 0 LCDRowO0 0 LCDRow0 1 LCDRow0 2 3 LCDRowO0 3 s LCDRow0 4 w LCDRow0 5 LCDRow0 6 LCDRow0 7 d LCDRow0 8 0xa2 LCDR
9. void security if try 3 page 70 SEC_L display char SEC H Phone H delay ms 1000 Phone L Buzer H try 0 Initiation System void port_b_pullups TRUE output Ai output b PORT Bi output c PORT Ci set_tris_a TRISA set_tris_b TRISB set_tris_c TRISC Init_LCDQ SEC_L page 00 SEC L display char SEC H Phone L Buzer L EN L BL H delay ms 3000 page 10 SEC L display char SEC H Scan0_H Scanl H 106 Scan2_H save digit page 1 counter 0 code 0 change 0 try 0 setup timer 1 T1 INTERNAL TI DIV BY 8 set_timer1 0xe796 10ms enable interrupts INT RDA enable interrupts GLOBAL enable interrupts INT void main Init mainloop do while 10ms flg 10ms 0 if skip_3 0 scan identify if loop 0 keyNew 1 keyNew if loop 1 keyNew_2 keyNew reset 1 loop if reset 1 loop 0 reset 0 if skip_2 1 skip_2 0 if keyNew_1 keyNew_2 skip 1 if skip 1 confirm_key confirm key20 keyNew 1 21 keyNew_2 22 skip 0 skip_3 1 tmr10ms if tmr10ms lt 9 goto mainloop security tmr10ms 0 skip 0 skip_3 0 loop 0 keyCnt 0 107 108 keyNew 20 1 21 keyNew_2 22 if
10. No AE040061 Course 45 Department INSEED FKE Supervisor EN Ismail Bin Ariffin include lt 16F876A h gt device 16 ADC 8 16bit pointer 8 bit ADC use delay clock 20000000 20M Hertz Anitial Configuration Bits fuses HS NOWDT PROTECT PUT NOWRT BROWNOUT NOLVP typedef struct intl bitO intl bitl intl bit2 intl bit3 intl bit4 intl bit5 intl bit6 intl bit7 flags JE bk s Initial value for Port A value for Port B Initial value for Port C J Fk sk define TRISA 0b00000000 define TRISB 0611111111 define TRISC Ob 10000000 define Port_Ai 0500001000 define Port_Bi 0b00000000 define Port_Ci 0b00000000 si oF kekok kokok Label for Port A Port and Port J Fk AR gH ee PortA define SCLK_H output_high PIN_ 0 define SCLK_L output_low PIN_AO define SDIN_H output_high PIN_A1 define SDIN_L output_low PIN_A1 define DC_H define DC_L define SEC_H define SEC_L define RES_H define RES_L define BL_H define BL_L Port B define 0 define define KeyIn2 define KeyIn3 define KeyIn4 define KeyIn5 output_high PIN_A2 output_low PIN_A2 output_high PIN_A3 output_low PIN_A3 output_high PIN_A4 output_low PIN_A4 ou
11. The pin 14 Enable DC Motor 17 motorl and pin 18 motor2 are connected to L293D driver for DC motor for authorizing the lock Pin 15 Buzzer and Pin 16 Phone are used to activate the alarm system Then 21 0 22 1 23 KeyIn2 pin 24 KeyIn3 25 KeyIn4 and 26 5 are used to pull up the voltage to 5 volt for keypad scanning 44 3 4 2 Step down 5 volt to 2 8 volt for LCD 541 04 amp 51117 2 85V Figure 3 18 Step down 5 volt to 2 8 volt for LCD The operating voltage for LCD is 2 7 volt to 3 3 volt So the AS1117 2 85V is used to step down 5 volt input voltage to 2 8 volt The ALPHA Semiconductor 51117 is a low power positive voltage regulator designed to meet 800mA output current and comply with SCSI II specifications with a fixed output voltage of 2 85V 45 3 4 3 Interfacing between 74LCX245 and LCD LCD 3310 Figure 3 19 Interfacing between 74LCX245 and LCD 741 245 is the driver for the LCD 3310 and operating at 2 8 volt The pin 2 SCLK pin 3 SDIN pin 4 D C pin 5 SEC and pin 6 RES are connected to microcontroller PIC 16F876A 46 3 4 4 LED for Keypad 5 1 Figure 3 20 LED for Keypad The base of the NPN 1 is connected to microcontroller When the pin BL is high the will become zero and the LED2 LED3 LEDS LED6 LED7 and LED8 will be on It will make the keypad h
12. 0 i lt 7 i W REG bmpc_2f i 85 shfdata void display_lower for 1 0 i lt 7 i W_REG bmpc_30 i shfdata void display line for 1 0 i lt 7 i W REG bmpc_32 i shfdata void display_vertical for 1 0 i lt 7 i W_REG bmpc 37 i shfdata void display_box45 for 1 0 i lt 7 i W_REG bmpc 33 i shfdata void display box135 for 120 i lt 7 i W_REG bmpc 34 i shfdata void display_box225 for 1 0 i lt 7 i W_REG bmpc_35 i shfdata 86 void display_box315 for 1 0 i lt 7 i W_REG bmpc 36 i shfdata void display star for 1 0 i lt 7 i W_REG bmpc_31 i shfdata void show_char if W_REG 0 2 display blank return if REG gt 0x41 amp amp REG lt Ox4D W REG 0x41 display AAMM W REG return if REG gt Ox4E amp amp lt 0x5A W REG Ox4E display NNZZ W REG return if REG gt 0x61 amp amp lt 0x6d W_REG 0x61 display am W REG return if W_REG gt 0 amp amp W_REG lt 0x7a W_REG display nz W REG return if REG gt 0x30 amp amp W_REG lt 0 39 W_REG 0x30 TA M HIN Z a m In z 10 9 87
13. 1 1 lt 10 1 printf u r n i switch expr case cexpr stmt one or more case default stmt 204 switch cmd case 0 0 break case 1 1 break default printf bad cmd break return expr return 5 goto label goto loop label stmt loop I 51 break break continue continue 1 1 stmt a 1 b 1 Zero or more Table 4 1 Statements 4 3 Operators Rates pra 7 Bitwise and operator Bitwise exclusive or assignment operator is the same as Bitwise exclusive or operator Bitwise inclusive or assignment operator xl y is the same as 52 A Division assignment operator x y is the same as x xy Division assignment operator x y is the same as x x y uu WW Greater than Greater than operator O Lr LE 0 Modules assignment operator x y is the same as m Multiplication assignment operator x y is the same x x y Multiplication assignment operator x y is the same as Table 4 2 Operators 53 54 4 4 Data Definitions This section describes what the basic data types and specifiers are and how variables can be declared using those types In CCS C all the variables should be declared before it is used They ca
14. 5 2 Project Overview 66 5 2 1 User Manual Es Locking 323 t Enter 2 igits s 9 Next Page Enter Password Change Password Figure 5 3 Keypad w main page next page Figure 5 4 LCD Pages When the power supply is on the LCD will display UNEVERSITI TEKNOLOGI MALAYSIA for 3 seconds It aims to promote the company name and identify the model of the products After the 3 seconds the LCD will display the main page and ask for password If you need to activate the cabinet lock you need to enter the correct password and press Enter button by using the keypad The combination length is 6 digits long When the correct password is entered the LCD will display unlock that means the lock already activated and you can access the cabinet now 67 If the password is wrong the LCD will display INVALID CODE for 1 second and then you need to enter the password again to activate the cabinet lock If the invalid code is entered for 3 times the LCD will display WARNING the alarm system will be on The alarm siren will be on and at the same time a message will be sending out to inform the authorized person through the mobile phone In order to switch off the alarm system button 4 must be pressed and the LCD will display will main page again At this time you need to enter correct password to switch off the alarm system F
15. Overall Structure A program is made up of the following four elements in a file Comment Pre Processor Directive Data Definition and Function Definition Every C program must contain a main function which is the starting point of the program execution The program can be split into multiple functions according to their purpose and the functions could be called from main or the sub functions In a large project functions can also be placed in different C files or header files that can be included in the main C file to group the related functions by their category CCS C also requires to include the appropriate device file using include directive to include the device specific functionality There are also some preprocessor directives like fuses to specify the fuses for the chip and use delay to specify the clock speed The functions contain the data declarations definitions statements and expressions The compiler also provides a large number of standard C libraries as well as other device drivers that can be included and used in the programs CCS also provides a large number of built in functions to access the various peripherals included in the PIC microcontroller 4 2 Statements STATEMENT EXAMPLE if expr stmt else if x 25 stmt else 1 while expr stmt while get_rtcc 0 putc n do stmt while expr for exprl expr2 expr3 stmt do putc c getc while c 0 for 1
16. Tech C and add a little feature to it Both codes use bit banging SPI Figure 2 7 LCD Nokia 3310 There the picture to the left is another snapshot of it Here a function to plot a smooth continuous line and its plot time is surprisingly rather fast There s also the typical bar plot as shown below The firmware provided here runs a demo program at main to generate random numbers and plotting them on the LCD using both bar and continuously line plot Simply adjust the delay in the program to control the speed of the plot It s cool to see animation rather than a still picture 17 CHAPTER 3 THEORY AND PROPOSED SYSTEM This chapter presents the application tools and components of the project The schematic diagrams and software are used to describe the methodology to complete this project 3 1 Flow Diagram The flow diagram as shown in Figure 3 1 shows the process flow of the project All the process mentioned are important in completing the project First of all the project requires study of basic principles of safety cabinet and LCD display Next Additional system consists of hardware and software is designed Install the safety alarm system to the cabinet Safety cabinet alarm system will play the important role to ensure total security of cabinet or valuable things for various sectors The project is considered done when all the requirements is fulfilled START Literature review on safety cabinet controll
17. bUpdateLCD SEC_L display char SEC H bUpdateLCD 0 check_key scan_key if tmp00 Oxff if tmp01 Oxff if tmp02 Oxff goto mainloop goto check_key
18. because it is the high level language and can be compiled to any type of assembly languages which is suitable to the microcontroller that been used CHAPTER 5 RESULTS AND DISCUSSION Chapter 5 will show the results from the proposed system Instructions on how to use the safety cabinet alarm system are introduced in this chapter 51 System Overview 9 0 Alarm System on v Alarm siren Keypad Ne V inform authorized personnel SMS Setting code Microcontroller LCD Change code mE Identify code DS Motor unlock cabinet Figure 5 1 System Overview 65 I used PIC microcontroller be main controller in my control system First PIC used to identify what button that is press on the keypad The keypad is the Nokia phone keypad and used to enter the safety code There are 2 parts in the alarm system If someone tries to break in the cabinet the alarm siren will be on and at the same time a message SMS will be send out to inform the authorized personnel through the internal cell phone at the safety cabinet PIC also programmed to identify change set the code With the display of LCD the owner will be more easy or convenient to operate the control system When the code is right the motor will be trigger to unlock the cabinet 52 Project Overview DC Motor Demo Door Power Supply Controller Connectors Board puzzer Mobile Phone Figure
19. reside within the microcontroller in the absence of electric power This memory is accessible through microcontroller s 3 EEPROM registers EEPROM will be used to store the passwords Floating Pin an input pin is said to be floating if it is not connected to anything Floating pins may report random bit states that float between 1 and 0 Keypad this is our input device The keypad comprises 16 or 12 membrane buttons on a 4x4 or 4x3 matrix Key activity is detected by monitoring the keypad s output pins and waiting for a closed circuit to appear between a row pin and a column pin The keypad is a passive device Queue an array of integers in which data is shifted in on one side and deleted on the other end Queues follow FIFO First In First Out behavior whereas a stack will use a FILO First In Last Out scheme This project will use the Queue to hold key codes SRAM SRAM is the volatile data storage medium Static Random Access Memory is destroyed during power off and reset conditions This memory is accessible 11 through the microcontroller s X and Y pointer registers and by the Ids and sts commands SRAM will contain the key press queue Volatility this term will be associated with the system s memory types The term indicates whether the memory will retain its state after power has been removed A volatile system will be reset if power is removed A non volatile system will retain its lat
20. suitable for solenoid or motor applications 3 3 5 3 Block Diagram Vcc2 Figure 3 14 Block Diagram FUNCTION TABLE each driver INPUTST high level L low level X irrelevant high impedance off T In the thermal shutdown mode the output is in the high impedance state regardless of the input levels Table 3 5 Functional Table 42 3 3 5 4 Recommended Operating Conditions _ 5 ET 27 VH High level input voltage Operating free ar temperature algebraic convention in which the least positive most negative designated minimum is used in this data sheet for logic voltage levels Table 3 6 Recommended Operating Conditions 43 3 4 Schematic Diagram for Control System 341 Microcontroller PIC16F876A RAY Vss 0801 0562 RCO RC2 RC3 SCL PIC16F976A Figure 3 17 Microcontroller PIC16F876A The microcontroller PIC 16F876A is used to scan the keypad change identify set password authorizes the lock and control the alarm system In order to burn the firmware to PIC processor the pin 1 MCLK pin 8 Vss pin 20 5V pin 27 RB6 and pin 28 RB7 must connected to the Microchip ICD 2 Pin 2 SCLK pin 3 SDIN pin 4 D C pin 5 SEC and pin 6 RES is connected to IC 74LCX245 This IC is intended for two way asynchronous communication between data buses Pin 11 Scan 0 Pin 12 Scan 1 and Pin 13 Scan 3 is used to scan the keypad for pressed by somebody
21. system and alarm system mechanism power supply application and software safety cabinet alarm system design Satisfied or not Redesign and improvement decide component electronics and software tool for my project 18 develop the software fort microcontroller MPLAB or CCSC COMPILER Debugging and Testing Satisfied or not Hardware circuit design Protel SE 99 making layout for PCB Redesign or improvement Disired output Set up a front of cabinet for demo Install the safety alarm system to the cabinet Disired output YES Thesis writing Figure 3 1 Flow diagram of the project 19 Created by Paraben s Flow Charter Unlicensed Software Visit www paraben com html flow html to register 20 3 2 Application Tools Application tools are the equipments that used to design and develop the safety cabinet alarm system There are including Microchip MPLAB ICD 2 Protel SE 99 and C compiler CCSC compiler 3 21 Microchip MPLAB ICD 2 The MPLAB ICD 2 is a low cost in circuit debugger ICD and in circuit serial programmer MPLAB ICD 2 is intended to be used as an evaluation debugging and programming aid in a laboratory environment The MPLAB ICD 2 offers these features i Real time and single step code execution ii Breakpoints Register and Variable Watch Modify Hi In circuit debugging iv Target VDD monitor v Diagnostic LEDs vi MPLAB IDE u
22. 01000000 SEC 1 enable clk ShfCmdQ W_REG 0510000000 ShfCmd 5 disable clk SEC 1 disable clk W_REG 0610101100 initial data W_REG 0 initial data d_row 5 disable clk Mnit LCD void Init LCD0 81 Init LCD starts here dly2 5 disable clk DC_H sdlylQ RES release reset dly30 go00 SEC 1 enable clk W_REG 0b00100100 ShfCmd for i 0 i lt 6 i W_REG 1 Init LCD 9 _ 1 enable clk W_REG 0b00100000 ShfCmdQ 5 disable clk dly10 dly10 SEC_L enable clk W_REG 0b00100000 ShfCmdQ W_REG 0b00001 100 ShfCmd _ disable clk dly10 dly10 Update 1 digit LCD Data void LCD Nxt CHAR B bmp_org if bmp_Bcent 0 goto Nxt CHAR B return LCD dgt num W REG 0x08 PCLATH W REG bmp Bent 0x07 Nxt num B W_REG bmp org W_REG W_REG CsrMarker ShfData bmp_org if bmp Bent 0 82 return goto Nxt_num_B Chk_cursor_pos return Update 1 row void Udp_row W_REG W_REG 0x40 SEC L enable clk ShfCmd W_REG 0x80 ShfCmdQ SEC disable clk W_REG 0x0c dgt count Dgt cnt W REG SEC L enable clk Nxt_dgt CsrMarker 0 if DispPg 0 goto Nxt_dgt0 if cursor FSR Nxt_dgt0 asm CsrMarker 0x80 movf INDF W endasm LCD_dgt asm incf FSR F end
23. 0x18 0x18 display const int8 bmpc_31 7 0x18 0x18 Oxf8 Oxf8 0 0 0 display const int8 bmpc_32 7 const int8 bmpc_33 7 const int8 bmpc_34 7 0 0 Oxf8 Oxf8 0x18 0x18 0x18 display I const int8 bmpc_35 7 0 0 Ox1f Ox1f 0x18 0x18 0x18 display 1 const int8 bmpc_36 7 0x18 0x18 Ox1f Ox1f 0 0 0 display const int8 bmpc_37 7 0 0 Oxff Oxff 0 0 0 display const int8 bmpc_40h 7 10 0 0 0 0 0 0 display blank Display Character from to 7 const int8 bmpc_AAMM 13 7 10 Ox7e Ox11 0x11 0x11 Ox7e 0 A M 0 Ox7f 0x49 0x49 0x49 0x36 0 0 Ox3e 0x41 0x41 0x41 0x22 0 0 Ox7f 0x41 0x41 0x22 0x1c 0 0 Ox7f 0x49 0x49 0x49 0x41 0 0 Ox7f 0x09 0x09 0x09 0 01 0 0 Ox3e 0x41 0x49 0x49 Ox7a O 0 Ox7f 0x08 0x08 0x08 Ox7f 0 0 0x00 0x41 Ox7f 0x41 0x00 0 0 0x20 0x40 0x41 Ox3f 0x01 0 0 Ox7f 0x08 0x14 0x22 0x41 0 0 Ox7f 0x40 0x40 0x40 0x40 0 10 Ox7f 0x02 0x02 Ox7f 0 const int8 bmpc_NNZZ 13 7 0 Ox7f 0x04 0x08 0x10 Ox7f 0 N Z 0 Ox3e 0x41 0x41 0x41 Ox3e 0 0 Ox7f 0x09 0x09 0x09 0x06 O 0 Ox3e 0x41 0x51 0x21 0 0 Ox7f 0x09 0x19 0x29 0x46 0 0 0x46 0x49 0x49 0x49 0x31 0 0 0x01 0x01 Ox7f 0x01 0x01 O 0 Ox3f 0x40 0x40 0x40 Ox3f 0
24. 4 page 9 if page 4 set 20 if page 9 set star 10 press_6 if keyNew 12 bUpdateLCD 1 if page 1 set_star_1 press_7 if page 3 set star 2 press_7 if page 4 page 9 if page 4 set 20 if page 9 set_star_1 press 70 if keyNew 13 bUpdateLCD 1 if page 1 set star 1 press_8 if page 3 set star 20 press 80 if page 4 page 9 if page 4 set 20 if page 9 set_star_1 press 80 if keyNew 14 bUpdateLCD 1 if page 1 set_star_1 103 press 90 if page 3 set star 2 press_9 if page 4 page 9 if page 4 set 20 if page 9 set star 10 press 90 if keyNew 16 bUpdateLCD 1 if page 1 set star 10 press_0Q if page 3 set star 20 press 00 if page 4 page 9 if page 4 set 20 if page 9 set star 10 press_0Q void confirm_key2 if keyNew 1 bUpdateLCD 1 enter if page 1 check_password if code 6 page 80 Buzer_L motorl H motor2 L EN H delay ms 12 EN L else page 60 SEC L display SEC H delay ms 1000 pages if page 9 change 0 if counter 6 counter 0 check new password if confirm 6 change_password else 104
25. 5 3 6 3 7 3 8 3 9 3 10 3 11 3 12 3 13 3 14 3 15 3 16 LIST OF FIGURES TITLE Digital Code Lock System E 5 Security Concept Simple Low Cost Digital Code Lock Nokia 3310 LCD Driver using a PIC Nokia 3310 PCD8544 Based Graphical LCD Demo Nokia 3310 Pin Connector LCD Nokia 3310 Flow diagram of the project Pin Numbering for Modular Connector MPLAB ICD 2 Connection To Target Board Proper Connections For Programming Illustrates the MPLAB ICD 2 ready for debugging Protel SE 99 Special Microcontroller Features Pin Diagrams Program Memory Map and Stack Timer 1 Block Diagram Electrical Interface specification Application Notes External Capacitor Pin Connection and IEC Logic Symbols Block Diagram Microcontroller PIC16F876A Step down 5 volt to 2 8 volt for LCD XIV PAGE 11 12 14 15 15 16 18 21 22 23 24 25 30 31 32 33 34 36 38 41 44 45 3 17 3 18 3 19 3 20 5 1 5 2 5 3 5 4 5 5 5 6 5 7 5 6 5 9 Interfacing between 74LCX245 and LCD LED for Keypad Keypad L293D System Overview Project Overview Keypad LCD Pages Controller Layout Top Layer Controller Circuit Top Layer Controller Layout Bottom Layer Controller Circuit Bottom Layer Connector s Board 46 47 48 49 64 65 66 66 68 69 70 70 71 LED amp Sdn Bhd LCD PCB ROM RAM EPROM EEPROM FIFO FILO IC VDD SCK SDI D C SCE GND RES MCLR ALU DC WDT ICD ESR AC x
26. CDRow2 i 0xa2 LCDRow2 10 0x16 LCDRow2 11 0xa2 LCDRow3 0 0xa2 LCDRow3 1 0x13 for i 2 1 lt 10 i LCDRow3 i 0x15 LCDRow3 10 0x14 LCDRow3 11 2 1 0 1 lt 12 i LCDRowA i 0xa2 LCDRowsS5 i 0xa2 Pages In LCD display void 00 1 0 1 lt 12 1 LCDRow0 i con solel i LCDRowl i con_sole2 i LCDRow 2 i con sole3 i 1 0 1 lt 12 i LCDRow3 i 0xa2 LCDRow4 i 0xa2 LCDRowS5 i 0xa2 void page_1 Password 7 LCDRow0 0 LCDRow0 1 LCDRow0 2 s LCDRow0 3 s LCDRow0 4 w LCDRow0 5 LCDRow0 6 LCDRow0 7 4 LCDRow0 8 0xa2 90 LCDRow0 9 0x3f 7 LCDRow0 10 0 2 LCDRow0 11 0xa2 upper_box void page 2 Change password 7 LCDRow0 0 LCDRow0 1 1 LCDRow0 2 a LCDRow0 3 n LCDRowO0 4 g LCDRow0 5 for i 6 1 lt 12 i 0xa2 LCDRow1 0 LCDRow1 1 void password LCDRow1 2 5 LCDRow1 3 5 LCDRowl 4 LCDRowl 5 o LCDRowl 6 LCDRowl 7 d LCDRow1 8 0xa2 LCDRow1 9 0x3f LCDRow1 10 0xa2 LCDRow1 11 0xa2 clear LCDRow1 0 LCDRowl 1 LCDRow1 2 5 LCDRow1 3 s LCDRow 1 4 w LCDRowl 5
27. CIO 2 PICIA4 6 and 1 18 microcontrollers has over 180 Built in Functions to access PIC MCU hardware is easy and produces efficient and highly optimized code Functions such as timers A D EEPROM SSP PSP USB 28 The compiler can handle inline or separate functions as well as parameter passing in re usable registers Transparent to the user the compiler handles calls across pages automatically and analyzes program structure and call tree processes to optimize RAM and ROM Usage The compiler runs under Windows 95 98 ME NT4 2000 XP Vista or Linux It outputs hex and debug files that are selectable and compatible with popular emulators and programmers including the MPLAB IDE for source level debugging 3 3 Components and Materials Please refer Table 3 1 for the list of components and materials used in traffic light driver No List of Components or Materials Quantity 1 PIC 16F876A 1 2 capacitor 3 3 10uF capacitor 3 4 capacitor 2 5 470 nF capacitor 1 6 330 nF capacitor 1 7 22 pF capacitor 2 8 1 8k Q resistor 1 9 510Q resistor 2 10 470Q resistor 8 11 47kQ resistor 1 12 1N4148 diode 3 13 20 2 crystal 1 14 74LCX245 1 15 AS1117 2 85V 1 16 Connector 4 pin 1 17 Connector 6 pin 1 18 LCD_3310 1 19 LED 8 20 NP
28. INDF int8 PCLATH int8 Temp ke 3e ke Constant Data be plced in ROM Display Number 1 2 3 4 5 6 7 8 9 0 const int8 bmpc 10 7 110 0x51 0x49 0x45 0 3 0 0 0x00 0x42 0x7f 0x40 0x00 0 0 0x42 0x61 0x51 0x49 0x46 0 0 0x21 0x41 0x45 0x4b 0x31 0 0 0x18 0x14 0x12 Ox7f 0x10 0 0 0x27 0x45 0x45 0x45 0x39 O 0 0 3 4 0x49 0x49 0x30 0 0 0x01 0x71 0x09 0x05 0x03 0 0 0x36 0x49 0x49 0x49 0x36 0 0 0x06 0x49 0x49 0x29 Oxle 011 Display Mark const int8 bmpc_2b 7 const int8 bmpc_2c 7 const int8 bmpc_2d 7 0 Ox7f Ox7f Ox7f Ox7f Ox7f 0 display 0 0x02 0x01 0x51 0x09 0x06 0 display 0 0x00 0x60 0x60 0x00 0x00 0 display const int8 bmpc_2e 0 0x08 0x08 0x08 0x08 0x08 0 display const int8 bmpc_2f 7 0 0x00 0x41 0x22 0x14 0x08 0 display gt const int8 bmpc_ 0 0x08 0x14 0x22 0x41 0x00 0 display lt const int8 bmpc_31 7 0x49 0x2a 1 Ox7f Ox1c 2 0x49 display const int8 bmpc_32 7 0x18 0x18 0x18 0x18 0x18 0x18 0x18 const int8 bmpc_33 7 0x18 0x18 Oxf8 Oxf8 0 0 0 display const int8 bmpc_34 7 0 0 Oxf8 Oxf8 0x18 0x18 0x18 display l const int8 bmpc_35 7 0 0 Ox1f Ox1f 0
29. N transistor 4 21 Casing Nokia Phone 3310 1 22 Hand Phone 1 23 L293D 1 24 PCB board 1 25 Header 2 pin 7 26 Header 3 pin 1 27 Stripe Board 1 Table 3 1 List of components and materials 3 3 1 16F876A Microcontroller 29 A microcontroller or MCU is a computer on a chip It is a type of microprocessor emphasizing self sufficiency and cost effectiveness in contrast to a general purpose microprocessor the kind used in a PC The only difference between a microcontroller and a microprocessor is that a microprocessor has three parts ALU Control Unit and registers like memory while the microcontroller has additional elements like ROM RAM etc 30 3 3 1 1 High Performance RISC CPU i Only 35 single word instructions to learn ii single cycle instructions except for program branches which are two cycle iii Operating speed DC 20 MHz clock input DC 200 ns instruction cycle iv Upto 8K x 14 words of Flash Program Memory Up to 368 x 8 bytes of Data Memory RAM Up to 256 x 8 bytes of EEPROM Data Memory 3 3 1 2 Special Microcontroller Features i 100 000 erase write cycle Enhanced Flash program memory typical 1 000 000 erase write cycle Data EEPROM memory typical Data EEPROM Retention gt 40 years iv Self reprogrammable under software control v In Circuit Serial Programming ICSP via two pins vi Single supply 5V In Circuit Serial Programmin
30. PSZ 19 16 Pind 1 97 UNIVERSITI TEKNOLOGI MALAYSIA BORANG PENGESAHAN STATUS TESIS Safety Cabinet Alarm System SESI PENGAJIAN 2007 08 _ FOO KON SIAN HURUF BESAR Saya mengaku membenarkan tesis PSM Sarjana Doktor Falsafah disimpan di Perpustakaan Universiti Teknologi Malaysia dengan syarat syarat kegunaan seperti berikut Tesis adalah hakmilik Universiti Teknologi Malaysia Perpustakaan Universit Teknologi Malaysia dibenarkan membuat salinan untuk tujuan pengajian sahaja Perpustakaan dibenarkan membuat salinan tesis sebagai bahan pertukaran antara institusi pengajian tinggi Sila tandakan 4 Mengandungi maklumat vang berdarjah keselamatan atau SULIT 2 kepentingan Malaysia sepertt vang termaktub di dalam AKTA RAHSIA RASMI 1972 TERHAD Mengandungi maklumat TERHAD vang telah ditentukan oleh organisasi badan di mana penyelidikan dijalankan TIDAK TERHAD Disahkan oleh TANDATANGAN PENULIS TANDATANGAN PENYELIA Alamat Tetap 85 Jalan Sintok Pekan Baru 06010 Changlun Kedah EN ISMAIL BIN ARIFFIN Nama Penyelia 9 May 2008 9 May 2008 Tankh ch Potong yang tidak berkenaan Jika tesis SULIT atau TERHAD sila lampirkan surat daripada pihak berkuasa organisasi berkenaan dengan menyatakan sekali sebab dan tempoh tesis ini perlu dikelaskan sebagai SULIT atau TERHAD v Tess dimaksudkan sebaga
31. ST OF TABLES LIST OF FIGURES LIST OF ABBREVIATIONS LIST OF NOTATIONS INTRODUCTION 1 1 Background of Study 1 2 Objectives 1 3 Problem Statement 1 4 Scope of Work 141 Hardware Development 1 4 2 Software Development 1 6 Thesis Outline xiii XIV A A N LITERATURE REVIEW 2 1 Digital Code Lock with LCD and Keypad 2 1 1 A Brief Description 2 1 2 User Side working 2 1 3 Using the Keypad 2 2 Security Keypad Lock 2 3 Simple Low Cost Digital Code Lock 24 Nokia 3310 LCD Driver using a PIC 2 5 Nokia 3310 Graphical LCD Demo THEORY AND PROPOSED SYSTEM 3 1 Flow Diagram 3 2 Application Tools 3 2 1 Microchip MPLAB ICD 2 3 2 1 1 Modular Interface Connections 3 2 1 2 Debug Mode 3 2 1 3 Programmer Mode 3 2 2 Protel SE 99 3 2 3 C compiler CCSC compiler 3 3 Components and Materials 3 3 1 16F876A Microcontroller 3 3 1 1 High Performance RISC CPU 3 3 1 2 Special Microcontroller Features 3 3 1 3 Pin Diagrams 3 3 1 4 Memory Organization 3 3 1 5 Timerl Operation 3 32 LCD 3 3 2 1 Electrical Interface specification 333 AS1117 3 3 3 1 Features 3 3 3 2 Product Description 3 3 3 2 Application External Capacitor 3 3 4 7ALCX245 3 3 4 1 Features 17 17 20 20 21 22 24 25 27 28 29 29 30 31 31 32 33 34 34 34 35 35 37 37 3 4 3 3 5 3 3 4 2 Description 3 3 4 3 Pin Description 3 3 4 4 Absolute Maximum Ratings 3 3 4 5 Recommended Conditions L293D 3 3 5 1 F
32. as been seen more clearly 47 3 4 5 Keypad Key 3 Keynl EeyIn 4 500 1 501 1 802 1 505 Scand im swi sun sw 1N4148 1 510 1 511 1 512 1 513 1 584 1 815 Dll sw sw sun sw1 sw sw 1N4148 1 520 1 521 1 522 1 523 4224 1 525 22 pn pn du du 1N4148 Figure 3 21 Keypad This is the schematic diagram of the keypad The pin 1 2 3 4 5 and 0 is always be HIGH The control system will scan the keypad every 10 ms During the scanning period the scanO will be LOW and follow by 1 and scan 2 So if the SW is pressed when the 5 is LOW the 0 will become LOW and the others is HIGH From here the microcontroller can detect what the switch is pressed by user 3 4 6 L293D JP6 L293D RC3 RC4 863 1 16 876 L293D Figure 3 22 L293D 48 25 RC6 RC 16 876 The JP4 JP5 and JP6 are the connector for microcontroller and motor for the lock When the pin 1 EN is H pin 2 1A is L and pin 7 is H the DC motor will turn clockwise and the door will unlocked For locking the door pin 1 EN is H pin 2 is H and pin 7 is L the DC motor will turn anti clockwise However 1 and Vcc2 must connect to power supply 50 CHAPTER 4 SOFTWARE DEVELOPMENT 4 1
33. asm LCD Display Program void Udp_LCD Udp_row void Udp_LCD0 Udp 83 RR To Interupt Every 10 ms INT_TIMERI void 1 set timer1 0xe796 10ms 0xe796 enable interrupts INT flg_10ms 1 Functions for LCD Display void display_blank for 1 0 i lt 7 i W_REG bmpc_40hfi shfdata void display_AAMM int8 x for 1 0 i lt 7 i W REG bmpc_AAMM x i shfdata void display_NNZZ int8 x for 1 0 i lt 7 i W REG bmpc_NNZZ x 1 shfdata void display_am int8 x for 1 0 i lt 7 i W REG bmpc_am x i shfdata void display_nz int8 x for 1 0 i lt 7 i W_REG bmpc_nz x i shfdata 84 void display int8 x for 1 0 i lt 7 i W REG bmpelx i shfdata void display_cursor for 1 0 i lt 7 i W REG bmpc_40h i 0x80 shfdata void display_all for 1 0 i lt 7 i W REG bmpc 2b i shfdata void display_question for 1 0 i lt 7 i W_REG bmpc 2e i shfdata void display dot for 1 0 i lt 7 i W_REG bmpc 2d i shfdata void display_minus for 1 0 i lt 7 i W REG bmpc 2e i shfdata void display_greater for 1
34. asy to interface using standard SPI communication A 1 10 uF electrolytic capacitor from VOUT to GND is the only external component needed i Logic supply voltage range VDD to VSS 2 7 to 3 3 V H Low power consumption suitable for battery operated systems ii Temperature range 25 to 70 C 34 3 3 2 1 Electrical Interface specification Pin Signal Description Port 1 VDD Power Input Logic supply voltage range VDD to GND 2 7 to 3 3 V Power 2 SCLE Serial clock Input for the clock signal 0 0 to 4 0 Mbits s Input 3 SDIN Serial data Input for the data line Input 4 D C Select To select either command address or data input Input 5 SCE Chip enable input The enable pin allows data to be clocked in The signal is active LOW Input 6 GND Ground Power 7 VOUT Ouptut voltage Add external 1 10 uF electrolytic capacitor from VOUT to GND Power i 8 will reset the device and must be applied to properly initialize the chip Figure 3 11 Electrical Interface specification 3 3 3 AS1117 3 3 3 1 Features i Guaranteed 800mA Output ii Terminal Adjustable Or Fixed 1 5V 2 5 2 85V 3 3V amp 5V ii Very Low Quiescent Current iv Low Dropout Voltage Of 1 2 Volts At Full Load v Extremely Tight Load And Line Regulation vi Very Low Temperature Coefficient Fixed 2 85V Device For SCSI II Active Terminator vii Logic Contro
35. cted of breaking into four houses between June 11 and 14 were arrested in a raid on Kampung Melayu Pandan on Friday Because of these problems administrator professional resident from various sectors really need the alarm system to ensure safety of their cash money or valuable things For lawyer they need the alarm system to keep the confidential contract or any agreement of their client If in the banking field the banker will install alarm system to the safety locker The safety locker is set up as a place for keeping valuable things of their customer The system also can be very useful for the businessmen who want to keep cash money jewelry and financial reports Finally with the safety cabinet alarm system whole society will fell secure for their valuable things 1 4 Scope of Work This project involves hardware and software development as explained below 141 Hardware Development This project consists of three parts a Input keypad b PIC microcontroller PIC 16F876A c Output LCD display alarm system activation of cabinet PIC16F876A is choose to be the microcontroller to control the display of universal LCD setting identify change code keypad motor unlock lock cabinet and alarm system In the alarm system include a internal cell phone which used to inform the authorized personnel and a siren alarm Alarm System Setting code i Motor Change code LCD display Identifv code 1 4 2 Software Develop
36. define sentRd RdFlg bit4 2k 2k oR ke ke variables Array int8 LCDRow0 12 int8 LCDRow1 12 int8 LCDRow2 12 18 LCDRow3 12 int8 LCDRow4 12 int8 LCDRow5S 12 int8 digit 6 int8 second 6 int8 save 6 Jb tE GH oF ke LCD Display Program void dlyO cnt01 W_REG 4 01 cnt02 dly02 cnt03 Oxff dly03 cnt03 if cnt03 0 goto dly03 dly04 cnt02 if cnt02 0 goto dly02 dly05 cntOT if cntO1 0 goto dly01 void dlyl W_REG 8 91 00 void dly2 W_REG 2 dly0 void dly3 W_REG 1 91 00 void shf8 W_REG 8 shfct W_REG Shf8a SCLK_L Temp shf rotate left amp shf 1 if Temp 0x80 goto shfb0 SDIN H bit 1 goto shfclk shfb0 SDIN_L bit 0 shfclk SCLK_H ckshfct shfct if shfct 0 SCLK_L SDIN_L goto shf8a shf8b void ShfCmd shf W_REG DC_L 80 8280 shift void shfdata shf W_REG DC_H shf8 void sdlyl return data void d_row shftmp W_REG row data cnt03 0x54 d_row W_REG shftmp row data ShfData cnt03 if cnt03 0 goto 4 2 void Init_LCD_row cmd W_REG W_REG 05
37. display W_REG return if W_REG 0x3f display question return if W REG 0x2e display dot return if W REG 0x24 display minus return if W REG 0x3e display_greater return if W_REG 0x3c display_lower return if W_REG 0x2a display_star return if W_REG 0 11 display_box45 return if W_REG 0x12 display_box135 return if W_REG 0x13 display_box225 return if W_REG 0x14 display_box315 return if W_REG 0x15 display_line return if W_REG 0x16 display_vertical return 88 void display_char for k 0 k lt 12 k W_REG LCDRow0 k show_char for k 0 k lt 12 k W REG LCDRowl kl show_char for k 0 k lt 12 k W_REG LCDRow2 k show_char for k 0 k lt 12 k W_REG LCDRow3 k show_char for k 0 k lt 12 k W_REG LCDRow4 k show_char for k 0 k lt 12 k W_REG LCDRowS5 k show_char void clear 0 1 lt 12 1 LCDRow 2 i 0xa2 LCDRow3 i 0xa2 LCDRow4 i 0xa2 LCDRow5S i 0xa2 void upper_box LCDRow1 0 0xa2 LCDRowl 1 0x12 for i 2 1 lt 10 i LCDRowl i 0x15 LCDRow1 10 0x11 LCDRow1 11 0xa2 clear LCDRow2 0 0xa2 89 LCDRov2 1 0x16 for i 2 1 lt 10 i L
38. e identifier is treated as a constant Constants should be initialized and may not be changed at run time This is an easy way to create lookup tables For e g const int table 16 0 1 2 15 For placing a string into ROM const char cstaring 6 hello You can also create pointers to constants const char cptr cptr string The org preprocessor can be used to place the constant to specified address blocks For eg ORG 0x1C00 Ox1COF CONST CHAR ID 10 123456789 This ID will be at 1 00 Note some extra code will proceed the 123456789 A new method allows the use of pointers to ROM The new keyword for compilation modes CCS4 and ANSI is ROM and for other modes it is ROM This method does not contain extra code at the start of the structure For e g char rom commands putlgetlstatuslshutdown 57 The function label address be used to get the address of the constant The constant variable can be accessed in the code This is a great way of storing constant data in large programs Variable length constant strings can be stored into program memory For PIC18 parts the compiler allows a non standard c feature to implement a constant array of variable length strings The syntax is n const char id n strint string Where n is optional and id is the table identifier For example const char colors Red Green Blue ROM directive Another meth
39. e of clarity the VDD and VSS lines from MPLAB ICD 2 are not shown Programming Voltage MPLAB ICD 2 Internal Circuits Figure 3 4 Proper Connections For Programming A simplified diagram of some of the internal interface circuitry of the MPLAB ICD 2 is shown For programming no clock is needed on the target PIC MCU but power must be supplied When programming MPLAB ICD 2 puts programming levels on VPP sends clock pulses on PGC and serial data via PGD To verify that the part has been programmed correctly clocks are sent to PGC and data is read back from PGD This conforms to the ICSP protocol of the PIC MCU under development 24 Interna Target Debug Registers for Debug V Executive MPLAB ICD 2 to Function Internal Circuits Rises Area Reserved for Debug Program Executive Hardware Stack Shared by Debug Exec About 0x50 Bytes Used by Debug Exec Regi Figure 3 5 Illustrates the MPLAB ICD 2 ready for debugging 3 2 1 3 Programmer Mode When using the Programmer gt Program selection to program a device the in circuit debug registers should be disabled in the MPLAB IDE so the MPLAB ICD 2 will program only the target application code and the Configuration bits and EEPROM data if available and selected into the target PIC MCU The debug executive will not be loaded In this mode the MPLAB ICD 2 can only toggle the MCLR line to reset and start the target A breakpoint cannot be set and regi
40. eatures 3 3 5 2 Description 3 3 5 3 Block Diagram 3 3 5 4 Recommended Conditions Schematic Diagram for Control System 3 4 1 3 4 2 3 4 3 3 4 4 3 4 5 3 4 6 Microcontroller PIC16F876A Step down 5 volt to 2 8 volt for LCD Interfacing between 741 245 and LCD LED for Keypad Keypad L293D SOFTWARE DEVELOPMENT 4 1 42 4 3 4 4 4 5 4 6 Overall Structure Statements Operators Data Definitions 4 4 1 Basic Types Firmware Microcontroller 4 5 1 Pseudo Code Parts of My Software RESULTS AND DISCUSSION 5 1 5 2 5 3 System Overview Project Overview 5 2 1 User Manual PCB Layout 5 3 1 Controller Layout Top Layer 50 50 51 52 54 54 58 58 59 64 64 65 66 68 68 xli 5 3 2 Controller Circuit Top Layer 69 533 Controller Layout Bottom Layer 70 5 3 4 Controller Circuit Bottom Layer 70 5 4 Connector s Board 71 6 CONCLUSION AND FUTURE SUGGESTIONS 72 REFERENCES 74 Appendices 75 108 TABLE NO 1 1 3 1 3 2 3 3 3 4 3 5 3 6 4 1 42 43 LIST OF TABLES TITLE Specification of safety cabinet alarm system List of components and materials Pin Description Absolute Maximum Ratings Recommended Operating Conditions Functional Table Recommended Operating Conditions Statements Operators Basic Types xiii PAGE 17 29 38 39 39 41 42 52 53 54 FIGURE NO 2 1 2 2 2 3 24 2 5 2 6 227 34 3 2 3 3 3 4 3
41. ess useful Figure 2 4 Nokia 3310 LCD Driver using a PIC Showing the LCD connected to an 16F877 PIC On the right is my DIY Wisp628 The interface board between the LCD and the PIC consists of two caps required for the LCD controller a few 1K resistors in series with the data lines and a LM317 to regulate the 5V down to 3V which the LCD requires 15 2 5 Nokia 3310 Graphical LCD Demo Figure 2 5 Nokia 3310 PCD8544 Based Graphical LCD Demo Ah Happy New Year This is one cool graphical LCD Not only it is easy to programmed the Nokia 3310 LCD also consumes low power The Nokia 3310 is based on a PCD8544 Controller which is manufactured by Philips With this controller you can easily interface any PICs to it via SPI T 5 4 S 2 19 LIB I I II Power supply to LCD Figure 2 6 Nokia 3310 Pin Connector Its pin out is as follows VDD gt Input voltage 2 SCK gt Serial Clock 3 SDI gt Serial Data Input 4 D C gt Data Command Input 5 5 gt Chip Select 6 GND gt Ground 7 VOUT gt VLCD 8 RES gt Reset 16 There are quite a few source codes available out there on how to control the LCD with a PIC One good instance can be found in Michel Bavin s website His firmware was coded in CCS C He has done a great job by providing good explanations on the functions of his Nokia 3310 LCD codes I do not have CCS C therefore I decided to translate some of his codes to Hi
42. est state Design Concept This console project is intended to be a low end and low cost system that will focus mainly on affordability and simplicity rather than connectivity or even ease of use Hence this will be a stand alone system that will not need a special communications interface This limits the designing phase to four sub systems keypad encoder controller and visual mechanical interface E 5 Security Console Concept Figure 2 2 E 5 Security Concept 12 23 Simple Low Cost Digital Code Lock x 230V AC PRIMARY 300mA SECONDARY TRANSFORMER NOTE ALL SWITCHES ARE PRESS TO ON TYPE Figure 2 3 Simple Low Cost Digital Code Lock In those circuits a set of switches conforming to code are pressed one by one within the specified time to open the lock In some other circuits custom built ICs are used and positive and negative logic pulses are keyed in sequence as per the code by two switches to open the lock A low cost digital code lock circuit is presented in this article Here the keying in code is rather unique Six switches are to be pressed to open the lock but only two switches at a time Thus a total of three sets of switches have to be pressed in a particular sequence Of these three sets one set is repeated The salient features of this circuit are 1 Use of 16 switches which suggests that there is a microprocessor inside 2 Elimination of power amplifier transistor to ener
43. g vii Watchdog Timer WDT with its own on chip RC oscillator for reliable operation viii Programmable code protection ix Power saving Sleep mode x Selectable oscillator options xi In Circuit Debug ICD via two pins Program Memory mssp 10 bit CCP Timers Device 8 Single Word SRAM Bytes AID ch PWM Master USART 8 46 bit Comparators y Instructions BYtes Pera 3e me m s 2 ves vee Figure 3 7 Special Microcontroller Features 3 3 1 3 Pin Diagrams 28 Pin PDIP SOIC SSOP MCLRIvep _ 1 RAO ANO L RA1 AN1 L RA2 AN2 VREF ICVREF RA3 AN3 VREF LJ RA4 ITOCKIICIOUT RAS ANA SSIC20UT L vss OSC1 ICLKI LI OSC2 CLKO 10 RCO T1OSO T1CKI 11 RC1IT1OSIICCP2 12 2 1 13 RC3 SCKISCL 14 PIC16F873A 876A Figure 3 8 Pin Diagrams 3 3 1 4 Memory Organization 31 RB7 PGD RB6 PGC RBS RB4 RB3 PGM RB2 RB1 RBO INT VDO VSS RCTIRX DT RCG TX CK RCS SDO RC4 SDI SDA There are three memory blocks in each of the PIC16F87XA devices The program memory and data memory have separate buses so that concurrent access can occur and is detailed in this section The EEPROM data memory block is detailed in Section 3 0 Data EEPROM and Flash Program Memory 32 CALL RETURN RETFIE RETLW V Stack Level 1 2 Rese
44. gh for five seconds i e the charging time of the capacitor to the threshold voltage which is calculated by the relation T 1 1 R1 x seconds Within these five seconds switches SA and SC are to be pressed momentarily once again followed by the depression of last code switch pair S3 S4 These switches connect the relay to output pin 3 and the relay is energized The contacts of the relay close and the solenoid pulls in the latch forming part of a lock and the lock opens The remaining switches are connected between reset pin 4 and ground If any one of these switches is pressed the IC is reset and the output goes to its quiescent low state Possibilities of pressing these reset switches are more when a code breaker tries to open the lock LED 05 indicates the presence of power supply while resistor R5 is a current limiting resistor The given circuit can be recoded easily by rearranging connections to the switches as desired by the user 14 2 4 Nokia 3310 LCD Driver using a PIC This library includes functions for controlling the Nokia 3310 LCD PCD8544 controller and also a 5x7 font Currently the table used only works on 16F but should not take much to modify it to work with 18F PICs It only uses 5 IO pins so a smaller PIC could be used The font however takes up a lot of ROM the example program s code size is 1305 If the text print functions and the font is not used it is of course much smaller but also much l
45. gize the relay 3 Low cost and small PCB size An essential property of this electronic code lock is that it works in mono stable mode 1 6 once triggered the output becomes high and remains so for a period of time governed by the timing components before returning to the quiescent low state In this circuit timer IC 555 with 8 pins is used The IC is inexpensive and easily available Its pin 2 is the triggering input pin which when held below 1 3 of the supply voltage drives the output to high state The threshold pin 6 when held higher than 2 3 of the supply voltage drives the output to low state By applying a 13 low going pulse to the reset pin 4 the output at pin 3 can be brought to the quiescent low level Thus the reset pin 4 should be held high for normal operation of the IC Three sets of switches SA SC S1 S8 and S3 S4 are pressed in that order to open the lock On pressing the switches SA and SC simultaneously capacitor C3 charges through the potential divider comprising resistors R3 and R4 and on releasing these two switches capacitor C3 starts discharging through resistor R4 Capacitor C3 and resistor R4 are so selected that it takes about five seconds to fully discharge C3 Depressing switches 51 and 58 in unison within five seconds of releasing the switches SA and SC pulls pin 2 to ground and IC 555 is triggered The capacitor C1 starts charging through resistor As a result the output pin 3 goes hi
46. i tesis bagi Ijazah Doktor Falsafah dan Sarjana secara penyelidikan atau disertasi bagi pengajian secara kena kursus dan penyelidikan atau Laporan Projek Sarjana Muda PSM hereby declare that I have read this thesis and my opinion this thesis is sufficient in terms of scope and quality for the award of the degree of Bachelor of Electrical Engineering Signature Jm sa Name of Supervisor EN ISMAIL BIN ARIFFIN Date 25 APRIL 2008 Hi SAFETY CABINET ALARM SYSTEM FOO KON SIAN A thesis submitted in fulfillment of the requirements for the award of the degree of Bachelor of Electrical Engineering Faculty of Electrical Engineering Universiti Teknologi Malaysia MAY 2008 I declare that this thesis entitled Safety Cabinet Alarmed System is the result of my own research except as cited in the references The thesis has not been accepted for any degree and is not concurrently submitted in candidature of any other degree Signature S may ITI FOO KON SIAN Date 16 May 2008 Specially dedicated to my beloved family and friends vi ACKNOWLEDGEMENT First of all I would like to express my sincere appreciation to my supervisor Encik Ismail Bin Ariffin for his guidance advice and assistance throughout the process of fulfillment of this final year project I am very grateful to get the guidance and advice from other lecturers in INSEED and the sources given by the
47. inually Rechargeable battery as the backup power supply to make sure the system is working in 24 hour per day The knowledge I acquired from this project from this project will be essential for me to equip myself for the future electronic industry which is changing rapidly 1 2 3 4 5 6 7 8 9 10 74 REFERENCES Huang Han Way PIC microcontroller an introduction to software and hardware interfacing Clifton Park NY Thomson Delmar Learning 2004 Iovine John PIC microcontroller project book New York McGraw Hill 2000 Smith Jack Programming the PIC microcontroller with Amsterdam Elsevier Newnes 2005 Sanchez Julio Microcontroller programming the microchip PIC Boca Raton FL CRC Press 2007 Burkhard Walter A C for programmers Belmont Calif Wadsworth Pub 1988 Weber Thad L Alarm systems and theft prevention Boston Bitterworths Pub 1985 Rakes Charles D Alarms 55 electronic projects and circuits Blue Ridge Summit PA TAB Bks 1988 http us geocities com http www patentstorm us http www codelock us 75 APPENDIX Source Code Source Code for Safety Cabinet Control System Firmware for Microcontroller PIC 16F876A Name FOO KON SIAN Number 840905025205
48. ious kinds Such locks may generally be viewed as being made up of three parts an authorization module for selectively allowing activation of the lock by certain keys or personnel an electromechanical actuation system for generating the required mechanical movement of the lock mechanism and a control system for controlling the functions performed by the actuation system in response to authorized activation of the lock Perhaps the most prevalent form of safety cabinet alarm system is that using a numerical code for authentication the correct code must be entered in order for the lock to deactivate Such locks typically provide a keypad and some feature an audible response to each press Combination lengths are usually between 4 and 6 digits long This alarm system is an easy and quick retrofit for cam locks supplied as standard on a wide range of lockers cabinets and cupboards It can easily be fitted to lockers or cabinets which don t have a locking device already installed giving the user immediate and simple keypad access without the need for keys 1 2 Objectives The objective of this project is to develop a safety cabinet alarm system with below specification i Universal LCD The users will be more easy and convenient to operate the alarm system H Alarm System If someone tries to break in the cabinet the alarm sire will on and at the same time a message will be sending out t
49. lled Electronic Shutdown ix Internal Over current Limiting amp Thermal Overload Protection x Surface Mount Package SOT 223 252 220 SOT 89 TO 263 amp SO 8 35 3 3 3 2 Product Description The ALPHA Semiconductor 51117 is a low power positive voltage regulator designed to meet 800mA output current and comply with SCSI II specifications with a fixed output voltage of 2 85V This device is an excellent choice for use in battery powered applications as active terminators for the SCSI bus and portable computers The AS1117 features very low quiescent current and very low dropout voltage of 1 2V at a full load and lower as output current decreases AS1117 is available as an adjustable or fixed 2 85V 3V 3 3V and 5V output voltages The AS1117 is offered in a 3 pin surface mount package SOT 223 TO 252 TO 220 SOT 89 amp TO 263 The output capacitor of 10mF or larger is needed for output stability of AS1117 as required by most of the other regulator circuits Use of ALPHA Semiconductor s design processing and testing techniques make our AS1117 superior over similar products 3 3 3 2 Application Notes External Capacitor To ensure the stability of the AS1117 an output capacitor of at least 10mF tantalum or 50mF aluminum is required The value may change based on the application requirements on the output load or temperature range The capacitor equivalent series resistance ESR will effect the AS1117 stability The va
50. lue of ESR can vary from the type of capacitor used in the applications The recommended value for ESR is 0 5W The output capacitance could increase in size to above the minimum value The larger value of output capacitance as high as 100mF can improve the load transient response 36 AS1117 2 85 Po 10V 2 85 105mA 7 15 105mA 750mW ALPHA Vour Vrzr 1 RyRj Typical Adjustable Regulator Figure 3 12 Application Notes External Capacitor 37 3 3 4 7ALCX245 3 3 4 1 Features xi 5 Tolerant Inputs and Outputs xi High Speed 7 0 ns MAX at VCC xii Power Down Protection On Inputs And Outputs xiv Symmetrical Output Impedance 24mA MIN at VCC xv PCI Bus Levels Guaranteed At 24 mA xvi Balance Propagation Delay ten xvii Operating Voltage Range Vcc OPR 2 0V to 3 6V xviii Pin and Function Compatible With 74 SERIES 245 xix Latch Up Performance Exceeds 500mA xx ECD Performance HBM gt 2000V MM gt 200V 3 3 4 2 Description The 74LCX245 is a low voltage CMOS OCTAL BUS TRANSCEIVER 3 STATE fabricated with sub micron silicon gate and double layer metal wiring C2MOS technology It is ideal for low power and high speed 3 3V applications it can be interfaced to 5 signal environment for both inputs and outputs It has same speed performance at 3 3V than 5V AC ACT family combined with lower power consumption This IC is in
51. m are useful indeed I would also like to take this opportunity to thank my beloved parents and siblings for always mentally and financially supporting me while completing this project My fellow course mates should also be recognized for their support My sincere appreciation also extends to all my friends and others who have provided assistance at various occasions Their views and tips are useful indeed Unfortunately it is not possible to list all of them in this limited space vil ABSTRACT In our country Malaysia there are many house breaking cases happen among the citizen especially at Johor Bharu Because of these problems administrator professional resident from various sectors really needs the alarmed system to ensure safety of their cash money or valuable things As for this project a safety cabinet alarm system Anti thief System will be set up to ensure total security of cabinet or valuable things in various sectors For lawyer they need the alarm system to keep the confidential contract or any agreement of their client If in the banking field the banker will install alarm system to the safety locker The safety locker is set up as a place for keeping valuable things of their customer Software programming is implemented to build the controller system and make the system can be function perfectly Manufacturers can apply this alarm system to any sizes of cabinets depend to requirement of customers Hence everyone in ou
52. ment Microcontroller is a lump of plastic metal and purified sand which without any software does nothing When software controls a microcontroller it has almost unlimited applications C Programming will be used to develop the firmware to PIC microcontroller CCS C Compiler also used to compile the C programming before burn it into the PIC microcontroller Another software tool that I will used is Protel 99 SE to design the circuit and create the layout for PCB 1 5 Thesis Outline The thesis consists of six chapters Each chapter is described next Introduction Chapter 1 serves as an introduction to the report This chapter is the brief overview of the project where it includes the project background objectives scope of work research methodology and project plan Literature Review Chapter 2 discusses the literature review which is relevant for focusing on the basic concept of safety cabinet alarm system There are some designed circuits and method will be discussed in this chapter Theory and Proposed System Chapter 3 will describe the methodology taken to complete the entire project Theory used in the safety cabinet alarm system is further explained in this chapter The proposed system with the components and materials used is discussed here Circuit diagram and the source code of the safety cabinet alarm system are shown in this chapter Software Development Chapter 4 guides to the system designed imple
53. mentation and software approach used to produce this project Results and Discussion Chapter 5 will show the results from the proposed system Instructions on how to use the safety cabinet alarm system are introduced in this chapter Conclusion and Future Suggestions Chapter 6 described the shortcomings experienced and suggestions solution and the conclusion The recommendation of the project also will be discussed CHAPTER 2 LITERATURE REVIEW Security is a prime concern in our day today life Everyone wants to be as much secure as possible An access control for cabinet forms a vital link in a security chain The microcontroller based digital lock for cabinet is an access control system that allows only authorized persons to access certain cabinet The system is fully controlled by the 8 bit microcontroller AT89C2051 which has a 2Kbytes of ROM for the program memory The password is stored in the EPROM so that we can change it at any time The system has a Keypad by which the password can be entered through it When the entered password equals with the password stored in the memory then the relay gets on and so that the door is opened If we entered a wrong password for more than three times then the Alarm is switched on 2 1 Digital Code Lock with LCD and Keypad using AT89C2051 211 A Brief Description This project is written in C language Its a simple project with efficient hacking prevention from Brute Force etc The basic use
54. n be defined inside a function local or outside all functions global This would affect the visibility and life of the variables 441 Basic Types Indicates no specific type Table 4 3 Basic Types Note All types except float by default are unsigned however maybe preceded by unsigned or signed Short and long may have the keyword INT following them with no effect Also see to change the default size 55 SHORT is a special type used to generate very efficient code for bit operations and Arrays of bits or SHORT in RAM are now supported Pointers to bits are not permitted 4 4 2 Declarations A declaration specifies a type qualifier and a type specifier and is followed by a list of one or more variables of that type For e g int a b c d e f mybyte g 3 2 char h colors j struct data record data 10 static int 1 extern long J Variables can also be declared along with the definitions of the special types For eg enum colors red green 2 blue i j k colors is the enum type and i j k are variables of that type 56 4 4 3 Using Program Memory for Data CCS C Compiler provides a few different ways to use program memory for data The different ways are discussed below Constant Data The const qualifier will place the variables into program memory The syntax is const type specifier id cexpr value If the keyword CONST is used before the identifier th
55. o inform the owner H Keyless Using a numerical code for authentication the correct code must be entering in order for the lock to deactivate iv Flexible The alarm system is suitable for any size or material of cabinet Low Cost The components electronic and accessories in the alarm system is cheap and quality vi Repairable All the components in the alarm system are common and easy to find in the market vii Reprogrammable If the users forget the deactivate code the system be re program to unlock the cabinet viii Auto Reset If any interruption from power supply the alarm system will activate the auto reset function and still can operate normally Table 1 1 Specification of safety cabinet alarm system 13 Problem Statement In our country Malaysia there are many thieving and house breaking cases happen among the citizen especially at Johor Bharu For example 2 month ago two men believed to be Indonesians tried to break into the house of former Inspector General of Police Tan Sri Norian Mai in Section 8 Shah Alam And they tried twice In February burglars broke into the house of former Federal CID director Datuk Fauzi Saari and escaped with RM5 000 in cash and valuables That same month former Penang police chief Datuk Albert Mah 82 died from injuries he suffered while single handedly fighting off five men who broke into his home in Section 5 Petaling Jaya In Johor Bharu two men suspe
56. ocontroller 4 5 1 Pseudo Code Setup initialize LCD and alarm system Hold for keystroke match keystroke to EEPROM password Check the length password if 6 digits entered begin validation else goto step 3 6 if correct code disengage lock else check number failures 7 if 3 failures defensive lockout and activate alarm system 8 goto setup step 1 59 4 6 Parts of My Software Source Code for Safety Cabinet alarm System Firmware for Microcontroller PIC 16F876A include lt 16F876A h gt device 16 ADC 8 16bit pointer 8 bit ADC use delay clock 20000000 20M Hertz Initial Configuration Bits fuses HS NOWDT PROTECT PUT NOWRT BROWNOUT NOLVP oe k o k k k k k kk k k K k k K Constant Data be plced in ROM o k k k k kk K ke k K Display Number 1 2 3 4 5 6 7 8 9 0 const int8 bmpc 10 7 110 0x51 0x49 0x45 0 0 0x00 0x42 Ox7f 0x40 0x00 0 0 0x42 0x61 0x51 0x49 0x46 0 0 0x21 0x41 0x45 0x4b 0x31 0 0 0x18 0x14 0x12 Ox7f 0x10 0 0 0x27 0x45 0x45 0x45 0x39 0 0 Ox3c Ox4a 0x49 0x49 0x30 0 0 0x01 0x71 0x09 0x05 0x03 0 0 0x36 0x49 0x49 0x49 0x36 0 0 0x06 0x49 0x49 0x29 Oxle 0 60 Examples 0 Ox3e 0x51 0x49 0x45 Ox3e 0
57. od is to use rom to assign data to program memory the usage is rom address data data data For eg strom 0 1000 1 2 3 4 5 will place 1 2 3 4 5 to rom addresses starting at 0x1000 This can be used for strings rom address hello the string will be null terminated This method can only be used to initialize the program memory Built in Functions The compiler also provides built in functions to place data in program memory they are i write program eeprom address data writes 16 bit data to program memory ii write program memory address dataptr count writes count bytes of data from dataptr to address in program memory 58 Please refer to the help of these functions to get more details on their usage and limitations regarding erase procedures These functions can be used only on chips that allow writes to program memory The compiler uses the flash memory erase and write routines to implement the functionality The data placed in program memory using all the three methods above can be read form user code using read_program_eeprom address reads 16 bits data from the address in program memory read program memory address dataptr count Reads count bytes from program memory at address to RAM at dataptr These functions can be used only on chips that allow reads from program memory The compiler uses the flash memory read routines to implement the functionality 4 5 Firmware Micr
58. ons only three lines are active and relevant to core MPLAB ICD 2 operation VPP MCLR PGC and PGD Not all PIC MCUs have the AVDD and AVSS lines but if they are present on the target PIC MCU all must be connected in order for MPLAB ICD 2 to operate 22 Note In the following discussions VDD is ignored But be aware that the target VDD is also used to power the output drivers in MPLAB ICD 2 This allows level translation for target low voltage operation If MPLAB ICD 2 does not have voltage on its VDD line pin 2 of the ICD connector either from power being supplied to the target by MPLAB ICD 2 or from a separate target power supply it will not operate User Reset Application PC Board MPLAB ICD 2 Interface Connector Figure 3 3 MPLAB ICD 2 Connection to Target Board 3 2 1 2 Debug Mode There are two steps to using MPLAB ICD 2 as a debugger The first requires that an application be programmed into the target PIC MCU The second uses the internal in circuit debug hardware of the target Flash PIC MCU to run and test the application program These two steps are directly related to the MPLAB IDE operations 1 Programming the code into the target 2 Using the debugger to set breakpoints and run 23 If the target PIC MCU cannot be programmed correctly MPLAB ICD 2 will not be able to debug Figure 3 3 shows the basic interconnections required for programming Note that this is the same as Figure 1 2 but for the sak
59. or the password changing the button must be pressed The LCD will display next page Change Password If you want to change password the button Enter must be pressed The system will ask for old password When the password is right you need to enter the new password for 2 times to confirm the new password After the password changed successfully the LCD will display Password Changed for 1 second the main page will display again 5 3 PCB Layout 5 31 Controller Layout Top Layer Figure 5 5 Controller Layout Top Layer 68 69 5 3 2 Controller Circuit Top Layer Programming Port Voltage Regulator Microcontroller PIC 16F8764 LCD Driver Figure 5 6 Controller Circuit Top Layer 5 33 Controller Layout Bottom Layer Figure 5 7 Controller Layout Bottom Layer 5 3 4 Controller Circuit Bottom Layer LCD Connector Sc Keypad Connector Figure 5 8 Controller Circuit Bottom Layer 71 5 4 Connector s Board This connector s board has 7 pieces 2 pin header 3 controller header 2 DC power supply header mobile phone header buzzer header and motor header Power Controller Buzzer se Motor amp Buzzer hone Power Supply 6 Figure 5 9 Connector s Board From this chapter the safety cabinet alarm system has been fully explained Hence the users can
60. ow or hide the Design Manager panel select View Design Manager from the menus 4 Navigation Tree The Explorer navigation tree provides a Windows Explorer like hierarchical tree view of the design desktop allowing you to navigate the various documents and folders contained in each design database Click on a document or folder in the navigation tree to open it in the design window 27 5 Help Advisor Click the Help Advisor icon at the right hand side of the status bar to open the natural language help search facility 3 2 3 compiler compiler The CCS C Compiler features provide ample function for your development needs including standard C pre processor directives operators amp statements built in libraries supporting all chips MPLAB IDE integration source code drivers automatic linking for multiple code pages and much more Features include 1 8 16 and 32 bit integer types and 32 bit floating point Standard one bit type Short Int permits the compiler to generate very efficient Bit oriented code BIT and BYTE will allow C variables to be placed at absolute addresses to map registers to C variables Bit Arrays Fixed Point Decimal Constants including strings and arrays are saved in program memory Flexible Handling of Constant Data Variable Length Constant Strings Address mod Capability To Create User Defined Address Spaces In Memory Device The CCS C Compiler for PI
61. ow0 9 0xa2 LCDRow0 10 0xa2 LCDRow0 11 0 2 LCDRow1 0 LCDRow1 1 LCDRow1 2 LCDRow 131 ES LCDRowl 4 LCDRowl 5 e LCDRowl 6 for i 7 i lt 12 i LCDRowl i 0xa2 clear void page_6 Invalid Code counter 0 1 0 1 lt 12 1 LCDRow0 i 0xa2 93 LCDRowl i 0xa2 LCDRow3 i 0xa2 LCDRow4 i 0xa2 LCDRow5S i 0xa2 LCDRow2 0 T LCDRow2 1 LCDRow2 2 gt LCDRow2 3 LCDRow2 4 T LCDRow2 5 i LCDRow2 6 d LCDRow2 7 0xa2 LCDRow2 8 LCDRow2 9 LCDRow2 10 4 LCDRow2 11 void page 7 Warning 1 0 1 lt 12 1 LCDRow0 i 2 LCDRowl i 0xa2 LCDRow3 i 0xa2 LCDRow4 i 0xa2 LCDRow5S i 0xa2 LCDRow2 0 0xa2 LCDRow2 1 0xa2 LCDRow2 2 W LCDRow2 3 LCDRow2 4 LCDRow2 5 LCDRow2 6 LCDRow2 7 LCDRow2 8 LCDRow2 9 0xa2 LCDRow2 10 0xa2 LCDRow2 11 0xa2 void page 8 try 0 code 0 1 0 1 lt 12 1 LCDRow0O i 0xa2 94 LCDRowl i 0xa2 LCDRow3 i 0xa2 LCDRow4 i 0xa2 LCDRow5S i 0xa2 LCDRow2 0 0xa2 LCDRow2 1 0xa2 LCDRow2 2 LCDRow2 3 LCDRow 2 4 1 LCDRow2 5 LCDRow2 6 LCDRow2 7 LCDRow2 8 0xa2 LCDRow2 9 0xa2 LCDRow2 10 0xa2 LCDR
62. ow2 11 0xa2 void pages if page 1 page_1 if page 2 page_2 if page 3 page 30 if page 4 page 40 if page 9 page_9 ke Count Numbers of Entered Digit J PRR 2k he void counter_1 if change 0 switch counter case 0 41010 tmp counter break case 1 digit 1 tmp counter break case 2 digit 2 tmp counter break case 3 digit 3 tmp counter break case 4 digit 4 tmp counter break case 5 digit 5 tmp 95 counter break case 6 counter if change 1 switch counter case 0 second 0 tmp counter break case 1 second 1 tmp counter break case 2 second 2 tmp counter break case 3 second 3 tmp counter break case 4 second 4 tmp counter break case 5 second 5 tmp counter break case 6 counter change 0 RR kokok Display Star for each entered code fe R RER void set_star_1 1 switch counter case 0 LCDROW2 3 0X2a break case 1 LCDROW2 4 0X2a break case 2 LCDROW2 5 0X2a break case 3 LCDROW 2 6 0X2a break case 4 LCDROW2 7 0X2a break case 5 LCDROW2 8 0X2a break void set_star_2 In page_3 switch counter
63. p01 keytest if KeyFlag 0 keytmp tmp02 keytest void confirm_key if keyNew 6 bUpdateLCD 1 if page 1 set star 10 press 10 if page 3 set star 20 press 10 if page 4 page 9 100 101 if page 4 set 20 if page 9 set star 10 press 10 if keyNew 7 bUpdateLCD 1 if page 1 set star 1 press_2 if page 3 set star 20 press 20 if page 4 page 9 if page 4 set 20 if page 9 set star 10 press 20 if keyNew 8 bUpdateLCD 1 if page 1 set_star_1 press_3 if page 3 set star 2 press_3 if page 4 page 9 if page 4 set 20 9 set_star_1 press_3 if keyNew 9 bUpdateLCD 1 if page 1 set_star_1 press_4 if page 3 set_star_2 press_4 if page 4 page 9 if page 4 set 20 if page 9 set_star_1 press 40 if keyNew 10 bUpdateLCD 1 if page 1 set 10 press 50 if page 3 set star 2 press 50 if page 4 page 9 102 if page 4 set 20 if page 9 set_star_1 50 if keyNew 11 bUpdateLCD 1 if page 1 set_star_1 press 60 if page 3 set star 20 press 60 if page
64. r country can install the alarm system in their house or office and keep their things safe ABSTRAK Dalam negara kita Malaysia terdapat banyak kes pencerobohan rumah dan kes pencurian berlaku di kalangan rakyat terutamanya dalan daerah Johor Bharu Oleh kerana kes tersebut sering berlaku golongan profesional pentadbir and penduduk tempatan dari bidang yang berlainan amat memerlukan sistem kawalan untuk memastikan wang tunai dan barang barang berharga mereka dalam keadaan yang selamat Dalam projek sarjana muda saya Sistem Kawalan Keselamatan Kabinet Sistem Anti Pencuri akan didirikan untuk memastikan keselamatan sepenuhnya bagi barangan berharga yang disimpankan dalam kabinet tertentu Peguam akan menggunakan sistem ini untuk menyimpan fail fail pelanggan penting Dalam sektor kewangan pula mereka memerlukan sistem ini untuk melindungi barang yang disimpankan dalam kotak keselamatan Perisian atau pengaturcaraan juga memainkan peranan penting dalam Sistem Kawalan saya and membolehkan sistem dapat beroperasi dengan sempurna Usahawan boleh menggunakan sistem keselamatan tersebut terhadap pelbagai size kabinet bergantung kepada keperluan pengguna Dengan adanya sistem ini setiap rakyat boleh memilikinya di rumah atau pejabat masing masing dan tidak perlu membimbangkan kehilangan barang barang berharga lagi CHAPTER TABLE OF CONTENTS TITLE DECLARATION DEDICATION ACKNOWLEDGEMENT ABSTRACT ABSTRAK TABLE OF CONTENTS LI
65. r lock is of 5 Digits and Master Lock is of 10 digits so it s not easy for an intruder to break the lock unless you keep the code simple The input is taken from a 4x3 Keypad please see the schematic for more information and Display the user input on a 2x16 LCD A pin is assigned as output for activating and deactivating the lock For demonstration i have connected an LED to that pin 2 1 2 User Side working The user has two options either he she can use its own 5 digit code or use the default 5 digit code If user has to do setup his own code then he has to enter 12345 and press After this controller will ask for 10 Digit master password which is preprogrammed in the controller Entering master lock user can enter the new 5 digit code for the lock and press to save it 2 1 3 Using the Keypad Keypad has 12 keys 4x3 starting from 1 2 3 4 5 6 7 8 9 0 please see the schematic for layout Numeric keys are used for entering numbers is used as Cancel key and is used as the Enter key Leck Pin can be connected to any lock activator Logic Levels High Locked Low Unlocked Figure 2 1 Digital Code Lock System 2 2 Security Keypad Lock The Security Keypad Lock Project is a basic access control system The Code Lock ability will allow the rightful user to deploy the platform to any property that requires simple password protection The AVR RISC microcont
66. roller used ensures low costs Possible applications may include vehicle protection electronic safes powered door locks The following short treatise will explain how the early version was engineered and how to use the controller to accept valid passwords With a little external hardware the featured systems may easily be used to disengage an electric door strike or similar system 10 Access Control s this is any system designed to restrict access to some type of property Some access controls like tire spikes and boarded doors are indiscriminant in that they bar access for everyone More useful access controls are selective which is to say they operate on a pass or halt basis This project is a selective access control Bypass Capacitor any capacitor meant to absorb energy spikes by providing a low impedance path to ground A bypass usually has one pin tied to ground and the other pin attached to some supply lead In this non precision application any capacitor type can be used including basic ceramics Debouncing a noise canceling method used to eliminate keypad noise This noise is inherent to most pushbuttons and switches and occurs as the contacts break complete the circuit Debouncing methods will either filter the noise or mute ignore it This project uses software to wait for the key signals to stabilize EEPROM EEPROM is a non volatile data storage medium Electronically Erasable Programmable Read Only Memory can
67. ser interface vii RS 232 serial or USB interface to a host PC The MPLAB ICD 2 allows you to i Debug your source code in your own application ii Debug your hardware in real time ii supported device using Microchip s ICSP Protocol 21 3 2 1 1 Modular Interface Connections MPLAB ICD 2 is connected to the target PIC MCU with the modular interface cable which is a six conductor cable The pin numbering for the MPLAB ICD 2 connector is shown from the bottom of the target PC board in Figure 3 1 Note The ICD cable has mirror imaged connections on each end and connections on the MPLAB ICD 2 module are the opposite of connections shown here MPLAB ICD 2 Connector VPP MCLR Vss PC Board Bottom Side Figure 3 2 Pin Numbering for Modular Connector Figure 1 3 shows the interconnections of the MPLAB ICD 2 to the modular connector on the target board There are six pins on the ICD connector but only five are used The diagram also shows the wiring from the connector to the PIC MCU device on the target PC board A pull up resistor usually around 10k Ohm is recommended to be connected from the VPP MCLR line to VDD so that the line may be strobe low to reset the PIC MCU Although pin 2 VDD can supply a limited amount of power to the target application under certain conditions for the purposes of these descriptions pins 2 and 3 VSS are omitted They are shown on the diagram for completeness but in the following descripti
68. ster contents cannot be seen or altered The MPLAB ICD 2 programs the target using ICSP No clock is required while programming and all modes of the processor can be programmed including code protect Watchdog Timer enabled and table read protect Note A header board is required to debug smaller pin count parts with the MPLAB ICD 2 These parts can be programmed without the header by connecting the VPP PGC and PGD lines as described previously 25 3 2 2 Protel SE 99 Protel SE 99 includes a powerful design synchronization tool that makes it very easy to transfer design information from the schematic to the PCB and back again The Synchronizer will automatically extract the component and connectivity information from the schematic locate the required footprints in the PCB libraries and place them in the PCB workspace then add the connection lines between connected component pins You use the synchronizer to initially transfer your design from the schematic documents to a PCB design document and also to synchronize design changes made in either the PCB or the schematic documents Edt Ven Hace Desp 4 0 Rowe lk PLB Z j ane Loma 5 pom x ri LIL ILES ig J Uw osd pcd Long Ederson pots Show Extortion peb Encionse 974 Management pem wesh
69. t Vector Mi Interrupt Vecto 2 22 a BEEN Program lt Memory 10 Page 2 Figure 3 9 Program Memory Map and Stack 3 3 1 5 Timer1 Operation in Synchronized Counter Mode Counter mode is selected by setting bit TMRICS In this mode the timer increments on every rising edge of clock input on pin RCI TIOSI CCP2 when bit TIOSCEN is set or on pin RCO TIOSO TICKI when bit TIOSCEN is cleared If TISYNC is cleared then the external clock input is synchronized with internal phase clocks The synchronization is done after the prescaler stage The prescaler stage is an asynchronous ripple counter In this configuration during Sleep mode Timerl will not increment even if the external clock is present since the synchronization circuit is shut off The prescaler however will continue to increment 33 Set Flag bit TMR1IF on Overfiow Synchronized TMR1 Clock Input men TMR1ON On Off AAC T1 RCO T1OSO T1CKI Prescaler TIOSCEN 1 2 4 8 f det ris Internal 4 RC1 T1OSU CC Clock 2 Q Clock KH 1 51 11 50 ole Note 1 When the 105 bit is cleared the inverter is turned off This eliminates power drain Figure 3 10 Timer 1 Block Diagram 3 3 2 LCD The Nokia 3310 LCD is a nice small graphical LCD suitable for a lot of various projects The display is 38 35 mm with an active display surface of 30 22 mm and a 84 48 pixel resolution The display is e
70. tage Range 4 5 V to 36 V ii Separate Input Logic Supply ii Internal ESD Protection iv Thermal Shutdown v High Noise Immunity Inputs vi Functionally Similar to SGS L293 and SGS L293D vii Output Current 1 A Per Channel 600 mA for L293D viii Peak Output Current 2 A Per Channel 1 2 A for L293D ix Output Clamp Diodes for Inductive Transient Suppression L293D 3 3 5 2 Description The L293 and L293D are quadruple high current half H drivers The L293 is designed to provide bidirectional drive currents of up to 1 A at voltages from 4 5 V to 36 V The L293D is designed to provide bidirectional drive currents of up to 600 mA at voltages from 4 5 V to 36 V Both devices are designed to drive inductive loads such as relays solenoids dc and bipolar stepping motors as well as other high current high voltage loads in positive supply applications All inputs are TTL compatible Each output is a complete totem pole drive circuit with a Darlington transistor sink and a pseudo Darlington source Drivers are enabled in pairs with drivers 1 and 2 enabled by 1 2EN and drivers 3 and 4 enabled by 3 4EN When an enable input is high the associated drivers are enabled and their outputs are activated and in phase with their inputs When the enable input is low those drivers are disabled and their outputs are off and in the high impedance state With the 41 proper data inputs each pair of drivers forms a full H or bridge reversible drive
71. tended for two way asynchronous communication between data buses the direction of data transmission is determined by DIR input The enable input G can be used to disable the device so that the buses are effectively isolated All inputs and outputs are equipped with protection circuits against static discharge giving them 2KV ESD immunity and transient excess voltage All floating bus terminals during High Z state must be held HIGH or LOW 38 3 3 4 3 Pin Description dU RARE dU ER B BEI AT 4 0086 8 u 0 Figure 3 13 Pin Connection and IEC Logic Symbols e Ws SYMBOL NAME AND FUNCTION to 2 3 4 5 6 7 8 9 A1 to A8 Data Inputs Outputs 5 Postve Suppy ote Table 3 2 Pin Description 39 3 3 4 4 Absolute Maximum Ratings Paname Supply Voltage 05 to 7 0 DC A Voltage 0 5 to 47 0 DC Output Voltage OFF State 0 5 to 7 0 DC Output Voltage High or Low State note 1 0 5 to 05 Tx DC Input Diode Current 775 Be Output Curent Sm Table 3 3 Absolute Maximum Ratings 3 3 4 5 Recommended Operating Conditions Wc a v muve 0685 v vs 005 Vo An Table 3 4 Recommended Operating Conditions 40 3 3 5 1293 3 3 5 1 Features i Wide Supply Vol
72. tput_high PIN_ AS output low PIN A5 input PIN BO input PIN B1 input PIN B2 input PIN B3 input PIN B4 input PIN B5 C define Scan0 define L define Scanl_H define Scanl_L define Scan2_H define Scan2_L define EN_H define EN_L define Buzer_L define Buzer_H define Phone_L define Phone_H define motor1 L define motorl fidefine motor2 L fidefine motor2 H flags 01 define flg 10ms output high PIN output low PIN output high PIN output low PIN output high PIN C2 output low PIN C2 output high PIN output low PIN output low PIN C4 output high PIN C4 output low PIN C5 output high PIN C5 output low PIN C6 output high PIN output low PIN C7 output high PIN C7 5 501 Declare for Integer spei int8 tmp int8 tmp00 int8 tmp01 int8 tmp02 int8 01 1118 cnt02 int8 cnt03 int8 Dgt int8 bmp org int8 bmp Bent int8 tmr10ms int8 counter int8 change int8 keyNew 76 int8 KeyFlag int8 skip int8 Skip_2 int8 SKIP_3 int8 loop int8 keytmp int8 keyCnt int8 keyNew_2 int8 keyNew 1 int8 reset int8 shf int8 shftmp int8 shfct int8 cursor int8 CsrMarker int8 confirm int8 code int8 try int8 DispPg int8 bUpdateLCD int8 Lk int8 W REG int8 page int8 FSR int8
73. understand the whole development of this alarm system CHAPTER 6 CONCLUSION AND FUTURE SUGGESTIONS 6 1 Conclusion As a conclusion the project is to come out with the hardware of safety cabinet alarm system The safety cabinet alarm system will increase the security cabinet and make society feel secure to their valuable things The specifications of the safety cabinet alarm system are universal LCD alarm system keyless flexible low cost repairable reprogrammable auto reset 73 6 1 Future Suggestions Projection In this project there are plenty of rooms for improvement to further enhance the project in terms of functionality and reliability Due to time constraint and lack of sources a few suggestions are suggested here for better advancement on the safety cabinet alarm system in future a b 4 Manual Authentication If black out occurs the users still can certain manual key to activate the lock and access the cabinet Second Authentication In order to increase security of the cabinet this system need second authentication such as fingerprint or image processing to access the cabinet Improve The Mechanical Part The cabinet must be built by certain concrete materials that are not easy to break in The cabinet should be fire and water proof to make the safety of valuable things Continuous Power Supply Actually the safety cabinet alarm system need continuous power supply to operate cont
74. vi LIST OF ABBREVIATIONS Light Emitting Diode And Private Limited Input or Output Liquid Crystal Display Printed Circuit Board Read Only Memory Random Access Memory Erasable Programmable Read Only Memory Electrical Erasable Programmable Read Only Memory First In First Out First In Last Out Integrated Circuit Input Voltage Serial Clock Serial Data Input Data Command Input Chip Select Ground Reset Master Clear Arithmetic Logical Unit Direct Current Watchdog Timer In Circuit Debug Equivalent Series Resistance Alternating Current DIR ESD EN Direction Electrostatic Discharge Enable High Low LIST OF NOTATIONS millimeter centimeter meter volt walt percent mega Hertz pico Farad micro Farad ohm kilo ohm CHAPTER 1 INTRODUCTION 1 1 Background of Study Nowadays safety cabinet alarm system becomes common and very important to ensure total security of cabinet or valuable things from various sectors The safety cabinet alarm system Electronic lock system is a locking system which uses some form of electronics to authenticate those accessing it The alarm systems are typically considered more secure than conventional mechanical locks and can include additional features The alarm system is simple to use and maintain and provide a convenient method for controlling cabinet access for residents and professionals It is known to provide electronic locks of var
75. x18 0x18 0x18 display _ m 77 const int8 bmpc_36 7 0x18 0x18 Ox1f Ox1f 0 0 0 display const int8 bmpc_37 7 0 0 Oxff Oxff 0 0 0 display const int8 bmpc_40h 7 0 0 0 0 0 0 0 dislay blank Display Character from A to Z const int8 bmpc_AAMM 13 7 0 Ox7e 0x11 0x11 0x11 Ox7e 0 A M 0 Ox7f 0x49 0x49 0x49 0x36 0 0 0x41 0x41 0x41 0x22 0 0 Ox7f 0x41 0x41 0x22 Oxlc 0 0 Ox7f 0x49 0x49 0x49 0x41 O 0 0 7 0x09 0x09 0x09 0x01 0 0 0x41 0x49 0x49 7 0 0 0 7 0x08 0x08 0x08 Ox7f 0 0 0x00 0x41 Ox7f 0x41 0x00 0 0 0x20 0x40 0x41 Ox3f 0x01 0 0 Ox7f 0x08 0x14 0x22 0x41 0 0 0 7 0x40 0x40 0x40 0x40 0 0 Ox7f 0x02 0x02 Ox7f 011 const int8 bmpc_NNZZ 13 7 0 Ox7f 0x04 0x08 0x10 Ox7f 0 N Z 0 0x41 0x41 0x41 0 0 Ox7f 0x09 0x09 0x09 0x06 0 0 0 3 0x41 0x51 0x21 5 0 0 Ox7f 0x09 0x19 0x29 0x46 0 0 0x46 0x49 0x49 0x49 0x31 O 0 0x01 0x01 Ox7f 0x01 0x01 0 0 0 3 0x40 0x40 0x40 0 3 0 0 Ox 1f 0x20 0x40 0x20 Ox1f 0 0 Ox3f 0x40 0x38 0x40 Ox3f 0 0 0x63 0x14 0x08 0x14 0x63 0 0 0x07 0x08 0x70 0x08 0x07 0 0 0x61 0x51 0x49 0x45 0x43 0 Display Character from to z const int8 bmpc_am 13 7

Download Pdf Manuals

image

Related Search

Related Contents

A.O. Smith GW/GWO-2500 Specification Sheet  NTD-18- CONEXÃO DE MICROGERAÇÃO DISTRIBUIDA  DEVA_UserManual  AX4E-Centos5.4-Dahdi-User Manual-V1.0-EN  Beko CS5713AP  4 - ABB  User guide  Plustek Opticfilm 8100  Operating Instructions HICO VARIOTHERM 550  User Manual - Listen Technologies  

Copyright © All rights reserved.
Failed to retrieve file