Interfacing LEDs with PIC microcontroller
Objectives:
- To create a program to interface LEDs with PIC microcontroller Introduction and Familiarization with Proteus software.
- Basic Understanding of how to install and create project in Proteus.
- To interface LEDs with PIC microcontroller using Assembly language.
Introduction:
PIC is a peripheral interface microcontroller developed by General Instruments Microcontrollers in 1993. It is controlled by software and programmed in such a way that it performs various functions and controls the generation line. PIC microcontrollers are used in a variety of new applications such as smartphones, audio accessories and modern medical devices.PIC microcontroller are electronic circuit that can be programmed to carry out a vast range of tasks. They can be programmed to be timers or to control a production line and much more. They are found is most electronic devices such as alarm system, computer control system, phones in fact almost any electronic device.
Commands
Clrf = Clear f
EQU = Equates to
ADDLW = Add literal value to WREG
MOVLW = Move literal value to WREG
MOVWF = Move WREG to file
DECF = Decrement F
DECFSZ = Decrement F, skip if zero
BNZ = Branch if not zero
GOTO = Go to address first word
I create a new project in MPLABx IDE and select the Pic family chip PIC18F458 and also I embed the PIC18F458 Library code in MPLABx IDE.
Procedure
- First I write a code in MPLAB X IDE to glow a single LED
- Then I save the program and open the Proteus software to draw the circuit diagram.
- The components we used are DC Power Supply, PIC18F458 Chip and Ground and make their required connections respectively using wire.
- And then I copy the code that I make in MPLAB X IDE and embedded or paste it in the circuit that we made on Proteus.
- At last I press the run button on Proteus and LED’s starts glowing which justifies the understanding and performance of my today’s lab.
Program Code:
CounterA equ 24H
CounterB equ 25H
CLRF TRISB; 33, 35, 37
MOVLW d'1'
MOVLW d'21'
MOVWF PORTB
Ø First of all we write a code in mplab and save a exe file
Ø After that we install exe file in PIC18F458
Ø After install file run the simulation file
0 Comments