Help me with my mini-project MPLAB pls i wan to creat a mini game -- if you clic
ID: 2266893 • Letter: H
Question
Help me with my mini-project MPLAB pls
i wan to creat a mini game -- if you click the switch the LED will start lighting up so fast from 1 to 10 ... your goal is to make it stop at 10/10
if you make it stop at 10/10 LEDs it will start flashes if you fail it will reset
here is my code so far ... Helpp pls :)
"
/*
* File: main.c
*
* Created on February 9, 2010, 10:53 AM
*/
#include <stdio.h>
#include <stdlib.h>
#include <p24Fxxxx.h>
#define Leds LATB
#define Sw1_RA0
/*
*
*/
void delay(void) {
long i = 65535 ;
while(i--)
;
}
int main( ) {
int i ;
TRISB = 0x0000;
_TRISA0=1;
// Setup PortB IOs as digital
AD1PCFG = 0xffff;
Leds=0x8000;
while(1) {
while(Sw1_RA0==0);
{ delay ();
Leds=Leds>>1;
}
Leds=0x8000;
// delay ();
// delay ();
}
}
"
File: main.c *Created on February 9, 2010, 10:53 AM 1b #include 811 #include 9L #include 101 #de fine Leds LATB 11 #de fine SwI RAO 12 13 14 15 16 void delay (void) { 17 18 19 20L h 21 22 int main( ) 23 24 25 26 27 28 29 30 31while (Swl_RAO0) 32 long i 65535 ; while (i--) int i; TRISB = 0x0000; TRI SAO=1 ; // Setup PortB IOs as digital AD1 PCFG = 0xffff; Leds 0x8000; while (1) t delay Leds=Leds>>1 ; Leds 0x8000; 35 36 37 38 // delay / delayExplanation / Answer
Answer:- Assuming LEDs are connected to PORTB as defined in macro definination.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.