automation pic 16f788a.h

Upload: redzuan-kamarudin

Post on 29-Oct-2015

77 views

Category:

Documents


0 download

DESCRIPTION

Report for LAB Session

TRANSCRIPT

EAB 2604AUTOMATION IN AGRICULTUREREPORT 18-BIT LED MODULENAMEMATRIX NUMBER

Muhammad Redzuan Bin KamarudinS15949

COURSE: DIPLOMA IN AGRICULTURAL ENGINEERINGSEMESTER: 05DATE SUBMIT: 27-July-2013PREPARED FOR: PN FAIZATUL AZWA ZAMRI

Objectives:1. To investigate the lab module 8-bit LED and observe the LED pattern by following the certain time delayed by refer the value of which port been used.2. To learn and achieved understanding in basis LED programming based on module.3. To design on a T-junction traffic light system based on the given logic table in lab moduleApparatus and devices:1. Electronic training kit2. A computer with C-Compiler program3. Burner4. PIC 16f877A.h5. Camera

Methods:1. Open and running the PCW C-Compiler in the computer.2. Type and save as Program 1 by refer to lab manual. 3. Type the command on the program based on module.4. After done typing the program command, right click on the mouse and click make file project.5. Compile the Program 16. Make sure the burner is connected to the computer. To be make sure, blink led light on the burner7. Put PIC on the burner.8. Download Program 1.hex file into PIC.9. Go back to the electronic training kit, put the PIC from the burner and connect jumper J3,PIC pin B0 to L1,B1to L2,B2 to L3,B3 to L4, B4 to L5, B5 to L6, B6 to L7, and B7 to L8 using jumper. 10. Switch training kit to execute mode.11. Power on training kit and adapter to test the program.12. Observe the display LED pattern to make sure it followed the program that has been set up.

Results:Program 1

Figure 1: the LED on the patern 1 which is portb=0b01010101 at the rate of 5 seconds

Figure 2: the LED on the patern 2 which is portb=0b00110011 at the rate of 5 seconds

Figure 3: the LED on the pattern 3 which is portb=0b00100111 at the rate of 5 seconds

Exercise on ModuleQuest 1: Modified Program

Figure 4: the LED on the patern which is portb=0b01111110 at the timed of 7seconds (ms 7000) delayed and repeat.

Figure 5: the LED on the patern which is portb=0b11110011 at the rate of 6seconds (ms 6000) and repeat.

Quest 2:Design own program for LED patternThis are my own program LED displays. The display detail on the video 1.#include#use delay(clock=20000000)#fuses hs, noprotect, nowd, nolvp#byte PORTB=6

void main()

{

Set_tris_b(0b00000000);Do{portb=0b00000001;delay_ms(200);portb=0b00000010;delay_ms(200);portb=0b00000100;delay_ms(200);portb=0b00001000;delay_ms(200);portb=0b00010000;delay_ms(200);portb=0b00100000;delay_ms(200);portb=0b01000000;delay_ms(200);portb=0b10000000;delay_ms(200);

}while(1);

}

Quest 3:T-junction traffic light system

The logic table has been simplified into the program command.Which is :Ref 1:portb=0b00010001;delay_ms(5000)Ref 2:portb=0b00001001;delay_ms(2000)Ref 3:portb=0b00001100;delay_ms(5000)Ref 4:portb=0b00001010;delay_ms(2000)LED display pattern be viewed on the compiled video 2.

Conclusions:At the end of the lab session we are able to make a program to display LED pattern that follow the command that has been set up that follows order and sequences based on timed output. A design own LED pattern by modified from the Program 1 shows the objective has been achieved.