Title of Activity:
The making of software part, PIC programming
Analysis:
- As PIC is the main component to control the whole system, the correct programming is needed to be written.
- C programming is preferred language to be written in PIC16F877a and PIC C compiler is the software used to compile the program.
- In this project, the PIC need to interface with some other components and devices such as RFID reader, IR sensor, switches, RS232 level converter and LEDs.
- It is compulsory to determine and declare the input and output port. In this project,
- Input port -
- pin 2 (RA0) for IR sensor
- pin 28 (RD5), 29 (RD6) and 30 (RD7) to detect RFID reader
- Output port -
- pin 38 (RB5) for blue LED to indicate IR sensor detected
- pin 39 (RB6) for green LED to indicate document detected
- pin 40 (RB7) for red LED to indicate no document detected
- pin 25 (RC6) for serial port to send data to computer
- pin 26 (RC7) for serial port to receive data to computer
- Below is the program build for PIC:
Figure 1: Set the variables and port address
Figure 2: The main program
Figure 3: The sub function of detection card
This coding is crucial to execute the performance of circuit.
No comments:
Post a Comment