Вы находитесь на странице: 1из 10

[PTSS.JKE.

EC501] August 3, 2012

TUANKU SYED SIRAJUDDIN POLYTECHNIC


ELECTRICAL ENGINEERING DEPARTMENT
EMBEDDED SYSTEM APPLICATION [EC501]

LAB I

Chong Wei Ting 18DTK10F1036 DTK5B Submit date: 3st August 2012 MR. MOHD SHAHAROM BIN IDRIS

18DTK10F1036

Page 1

[PTSS.JKE.EC501] August 3, 2012

LAB 1

: INTRODUCTION TO MPLAB & PROTEUS

TITLE :To expose student with MPLAB and Proteus software

Objective: By the end of this lab, students should be able to: 1) Understand the operation and the basic use of MPLAB, Micro C and Proteus. 2) Use MPLAB and Micro C to write program and assembly language for PIC microcontroller. 3) Use MPLAB SIM and Proteus to simulate assembly language and C language for PIC Microcontroller.
Equipment: Lab sheet, Computer, software MPLAB and Proteus.

Procedure
Activity 1A: Design Circuit Using Proteus
1. Proteus was been open by clicking START > ALL PROGRAM > PROTEUS 7 PROFESIONAL > ISIS 7 PROFESIONAL. 2. Selected button P by left hand side and follow the next instruction. 3. Selected instruction bellows and double clicked left mouse to input components inside category. Category
Microprocessors Resistors Optoelectronic Switches PIC18F4550 MINRES470R LED-BIBY BUTTON

Devices

18DTK10F1036

Page 2

[PTSS.JKE.EC501] August 3, 2012


.

4. Drag and drop Components by clicking at DEVICES window to working window as shown at figure below:

Activity 1B: To Create New Project & Writing The Programming Using MPLAB.
1. Go to STARTALL PROGRAMMICROCHIPMPLAB IDE v8.48MPLAB IDE. 2. Then by clicking PROJECTPROJECT WIZARD at taskbar. 3. Chosen device to PIC18F4550 for our limitation course, then clicked NEXT. 4. Selected the MICROCHIP C18 TOOLSUITE, and MPASM ASSEMBLER was been chosen, then clicked NEXT. 5. Click Browse to save project file in own folder/directories. 6. No file to add to project, so clicked NEXT. 7. My project should be created. 8. Clicked FILENEW to write PIC assembly program.
18DTK10F1036 Page 3

[PTSS.JKE.EC501] August 3, 2012 9. Wrote down the program as show in below and saved it by name lab1.asm and clicked ADD FILE TO PROJECT.

10. Clicked ProjectBuild All to assembler the program and check the error.

18DTK10F1036

Page 4

[PTSS.JKE.EC501] August 3, 2012

RESULT SIMULATION & ANALYSIS USING MAPLAB

1. To start simulation, clicked DebuggerSelect ToolMPLAB SIM.

2. Clicked DebuggerAnimate.

The green arrow running that follows the programming instruction set.

18DTK10F1036

Page 5

[PTSS.JKE.EC501] August 3, 2012

3.

Click DebuggerHalt to stop the simulation process. Then clicked DebuggerResetMCLR to reset the program.

The green arrow would be stop at first line of coding, and value of port B would be 00000000. 4. Clicked DebuggerStimulusNew WorkbookAsynch. And chosen the RA4 pin and at action column choose set toggle. Then animate it program after click FIRE and view what happen to watch window.

18DTK10F1036

Page 6

[PTSS.JKE.EC501] August 3, 2012

RESULT SIMULATION & ANALYSIS USING PROTEUS

1. Chosen the HEX file to PIC18F4550 then clicked Debuggerexecute and observe the working space.

2. The BUTTON should be pressed and the LEB would emit light according to PORT B programming code.

18DTK10F1036

Page 7

[PTSS.JKE.EC501] August 3, 2012

DISCUSSION
In our subject embedded system, I used one of manufacturing of microcontroller chip to design according to accepted electronic and computer principles, and are fundamentally made up of microprocessor core, memory and peripherals using PIC18F4550. In the LAB, we use two common software that are MPLAB and Proteus to program and design to assemble the PIC into circuit board.

The function of this software includes: 1. 2. 3. 4. Editing Project management Design Develop for embedded system application using PIC.

So in the lab 1, I employ lower language for program an assembly language in it. That the number usually represents decimal, binary and hexadecimal in assembler file that on below. Hexadecimal representation number Binary representation number
18DTK10F1036

0x 0b
Page 8

[PTSS.JKE.EC501] August 3, 2012

For example of decimal number 100 is written by: 0x64 for hexa and 0b01100100 for binary. The coding to set Input/output for PIC18F4550. MOVLW 0b00000000 ; move the value of 0 to working register. MOVWF TRISB ; set port B as output due to value of 0. MOVLW 0b11111111 ; move the value of 1 to working register. MOVWF TRISA ; set port A as input due to value of 1. Structure: TRISx; when x = port such as Port A, B, Cchange Input when TRIS the value to 1 and the output that TRIS the value to 0. When I pressed the BUTTON, the LED would been emitted, then LED off when release the BUTTON that according to programming code that I wrote in lab. LOOP BTFSS PORTA, 4; Bit test PORTA bit 4, if SET skip next line GOTO ON; Skip to label ON portion of code if button is pressed OFF BCF PORTB,0 ;LED is OFF when button at PORTA is not pressed. GOTO LOOP; Go back to label loop portion of code and test the button again. ON goes ON GOTO LOOP; Go back to label LOOP portion of code and test the button again. BSF PORTB,0 ;As PORTA input is 0, mean button is pressed so LED at PORTB bit 0

18DTK10F1036

Page 9

[PTSS.JKE.EC501] August 3, 2012

CONCLUSION
At the end of the LAB, I should be able to understand the operation and the basic use of MPLAB, assembly language, microcontroller and Proteus using MPLAB and Micro-controller to write program and assembly language for PIC Microcontroller by manufacturer PIC18F4550. Meanwhile, I also capable to use MPLAB SIM set and Proteus to simulate assembly for PIC Microcontroller then using MPLAB software to convert object file to HEX file, then burn it to PIC that I had to finish designed using Proteus ISIS Professional 7.6 SP4. And then, viewed the result when I play the simulation of it. As a conclusion PIC can perform the real time function due to LED emitting immediately when we press and hold the button.

18DTK10F1036

Page 10

Вам также может понравиться