Question: Example Code: #include xc . h / / CW 1 : FLASH CONFIGURATION WORD 1 #pragma config ICS = PGx 1 #pragma config
Example Code:
#include xch
CW: FLASH CONFIGURATION WORD
#pragma config ICS PGx
#pragma config FWDTEN OFF
#pragma config GWRP OFF
#pragma config GCP OFF
#pragma config JTAGEN OFF
CW: FLASH CONFIGURATION WORD
#pragma config ICSEL PRI
#pragma config IOLWAY OFF
#pragma config OSCIOFNC ON
#pragma config FCKSM CSECME
#pragma config FNOSC FRCPLL
void setupvoid
ADPCFG xfff; sets all pins to digital IO
TRISA b; set port A to inputs,
TRISB b; and port B to outputs
LATA xffff; Set all of port A to HIGH
LATB xffff; and all of port B to HIGH
CLKDIVbits.RCDIV ; Set RCDIV:default :MHz or FCYM
void delayvoid
int curCount ;
whilecurCount
curCount;
int mainvoid
setup;
LATB xFFF; This will turn on the most significant LED
while
Execute repeatedly forever and ever and ever and ever
delay; This pauses execution so the shifts are visible
LATB LATB ; This shifts the LATB register
LATB x;
return ;
however, the example code only outputs RB on the circuit, not RB Modify the example code to implement a bouncing LED. Use shifting both and and masking operations to illuminate the LEDs in this pattern: RBRBRBRBRBRBRB This pattern should repeat indefinitely. Please help me figure out this code. I am having a hard time getting this code to shift and light up the LEDs invidually like the pattern. I would really appreciate it PS I have also attached a image of what the circuit would look like
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
