Question: #include / * * * * * * * * * * * * * * * * * * * * * * *
#include
Author: Ronald Kikoyo
Program Title: Course Project
Microprocessor B
Spring
void delaymsvoid
const int Dms ; Declare a Constant for ms Delay
int i;
for i ; i Dms; i;
return;
PICHJGP Configuration Bit Settings
FBS
#pragma config BWRP WRPROTECTOFF Boot Segment Write Protect Boot Segment may be written
#pragma config BSS NOFLASH Boot Segment Program Flash Code Protection No Boot program Flash segment
FGS
#pragma config GWRP OFF General Code Segment Write Protect User program memory is not writeprotected
#pragma config GSS OFF General Segment Code Protection User program memory is not codeprotected
FOSCSEL
#pragma config FNOSC FRC Oscillator Mode Internal Fast RC FRC
#pragma config IESO OFF Internal External Switch Over Mode Startup device with userselected oscillator source
FOSC
#pragma config POSCMD NONE Primary Oscillator Source Primary Oscillator Disabled
#pragma config OSCIOFNC ON OSC Pin Function OSC pin has digital IO function
#pragma config IOLWAY OFF Peripheral Pin Select Configuration Allow Multiple Reconfigurations
#pragma config FCKSM CSDCMD Clock Switching and Monitor Both Clock Switching and FailSafe Clock Monitor are disabled
FWDT
#pragma config WDTPOST PS Watchdog Timer Postscaler :
#pragma config WDTPRE PR WDT Prescaler :
#pragma config WINDIS OFF Watchdog Timer Window Watchdog Timer in NonWindow mode
#pragma config FWDTEN OFF Watchdog Timer Enable Watchdog timer enableddisabled by user software
FPOR
#pragma config FPWRT PWR POR Timer Value ms
#pragma config ALTIC OFF Alternate IC pins IC mapped to SDASCL pins
FICD
#pragma config ICS PGD Comm Channel Select Communicate on PGCEMUC and PGDEMUD
#pragma config JTAGEN OFF JTAG Port Enable JTAG is Disabled
END Configuration Word
#pragma config statements should precede project file includes.
Use project enums instead of #define for ON and OFF.
#define XTALFREQ Specify the XTAL crystall FREQ
Sequence blink
sblinkint getFunction definition with "get" as parameter
for int i; i && RB; i
PORTB get i; LED move Left Sequence
delayms;
for int i; i && RB; i
PORTB get i; LED move Left Sequence
delayms;
MAIN Function
void mainThe main function
TRISB; Instruct the MCU that the PORTB pin is used as input for button.
TRISB x; Instruct the MCU that all pins are output
LATBx; Initialize all pins to
RBPUb;Enable pull up R on port B
whileGet into the Infinite While loop
if RB
sblink; FUNCTION CALL with parameter
sblink; FUNCTION CALL with parameter
sblink; FUNCTION CALL with parameter
sblink; FUNCTION CALL with parameter
whileRBIf button is still pressed
LATBxFFF; Turn ON all LEDs
what i am missing i am using a picHJGP
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
