Question: To develop a program for the PIC 16F84A using either MPLAB X IDE simulator software. The PIC 16F84A has 8 LEDs connected to Port B.

To develop a program for the PIC 16F84A using either MPLAB X IDE simulator software. The PIC 16F84A has 8 LEDs connected to Port B. The program is to convert your student number (10 ASCII characters), taken in reverse order, one character at a time, to Gray code. Each converted character is to be displayed on 4 of the LEDs connected to Port B (B0 to B3) of the microcontroller. Further, each converted character will be displayed for 3 seconds, with the LEDs turned OFF for 1 second between each character. Once all characters have been displayed the program will continue to run with all of the Port B LEDs flashing in a pattern of Odd Numbered LEDs On and Even Numbered LEDS Off for 1 second, and then Odd Numbered LEDs Off and Even Numbered LEDS On for 1 second. This pattern will repeat indefinitely.

TEMPLATE:

;************************************************** ; Filename: Ass2_2018_xx.asm (your file name) ; Date: ; Author: (Put your name here) ;************************************************** ; Program description: ; Assembly code to output a 10 digit ASCII coded ; student number, in reverse order, one character at a time, ; as Gray code, to 4 LEDs. ; ... ;************************************************************ ; ; Directive sets processor type ............................. list p=16F84A #include "P16F84A.INC" ; Set configuration fuses ................................... __CONFIG _CP_OFF & _WDT_OFF &_PWRTE_ON & _RC_OSC ; Code protection off, watchdog timer off, power up timer on, RC Clock errorlevel -302 ;No warnings about register not in Bank 0 ; Register Label Equates ************************************ PORTB EQU 0x06 ;Port B TRISB EQU 0x86 ;Data direction register B STATUS EQU 0x03 ;Status register Z EQU 0x02 ;Status register Z bit RP0 EQU 0x05 ;Bank select bit PCL EQU 0x02 ;Program counter register ;Add user equates here ; Variable definitions*************************************** ;Place user variables here ; Set program origin***************************************** ORG 0x00 goto main ; Subroutines ************************************** ; Initialise Port B ................................. ;Place code to initialise port B here ; Student number ASCII table .............................. ; Note: Your student number must be given in its correct order ; and accessed in reverse order by your code. snum addwf PCL,F dt "??????????" ;Substitute your student number ; Gray code table for LED display on Port B .. binary addwf PCL,F retlw b'????????' ;Set display to 0 retlw b'????????' ;Set display to 1 retlw b'????????' ;Set display to 2 retlw b'????????' ;Set display to 3 retlw b'????????' ;Set display to 4 retlw b'????????' ;Set display to 5 retlw b'????????' ;Set display to 6 retlw b'????????' ;Set display to 7 retlw b'????????' ;Set display to 8 retlw b'????????' ;Set display to 9 ; Delay timer ...................................... ;Place delay subroutine code here ; Main program ********************************************** ;Place main program code here END 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!