Professional Documents
Culture Documents
Experiment No.3
Experiment No.3
Components Needed:
PC
Software (Proteus 8, MPLABX IDE 5.20v)
Procedure:
1. First step is to open the “Proteus” software then make a new project.
Figure 1
2. Then go to “component mode” and search for “pic18f458” and past it on Editing
Window.
Figure 2
3. Then again go to the component mode and search for “LED” and past it on the Editing
Window.
Figure 3
4. Then select the “generator mode” and select the “SINE” to get the sine wave and set 5 v
to operate the led and connect it on pin1 of IC.
Figure 4 Figure 5
5. Then connect the led anode with pin 33 and cathode with the ground.
Figure 6
6. Now open the MPLABX then make new file then write the code to oprate led on pin 33.
7. Ten run it. The code automatically generate hex file.
Figure 7
9. Then select the pic18 and right click on the pic18 and click “ Edit Properties” then select
the hex file created in MPLABX.
Figure 8 Figure 9
10. Now run the “Editing Window” then we have the following results.
Figure 10 Figure 11
MPLABX Program :
;**************************
; *
; Files required: P18F458.INC *
; *
;**************************
LIST P=18F458, F=INHX32 ;directive to define processor and file format #include
<P18F458.INC> ;processor specific variable definitions
;**************************
;Configuration bits
;Microchip has changed the format for defining the configuration bits, please
;see the .inc file for futher details on notation. Below are a few examples.
; Oscillator Selection:
;**************************
;Variable definitions
; These variables are only needed if low priority interrupts are used.
; More variables may be needed to store other special function registers used
; in the interrupt routines.
UDATA
;**************************
;EEPROM data
; Data to be programmed into the Data EEPROM is defined here DATA_EEPROM CODE
0xf00000
DE "Test Data",0,1,2,3,4,5
;**************************
;Reset vector
; This code will start executing when a reset occurs.
;**************************
;High priority interrupt vector
; This code will start executing when a high priority interrupt occurs or
; when any interrupt occurs if interrupt priorities are not enabled.
;**************************
;Low priority interrupt vector
; This code will start executing when a low priority interrupt occurs.
; This code can be removed if low priority interrupts are not used.
LOW_INT_VECTORCODE 0x0018
;**************************
;High priority interrupt routine
; The high priority interrupt code is placed here.
CODE
HighInt:
retfie FAST
;**************************
;Low priority interrupt routine
; The low priority interrupt code is placed here.
; This code can be removed if low priority interrupts are not used.
LowInt:
;**************************
;Start of main program
; The main program code is placed here. Main:
COUNT equ 25H
MOVLW d'10' ; WREG = 10 (decimal) for counter MOVWF COUNT ; load the counter
;**************************
;End of program
END
Conclusion: