dgchaos
Newbie level 4
I'm new to dsPIC programming. I decided to try a simple LED blinking project using Proteus ISIS and the MikroC compiler.
void main() {
LATB=0xFFFF;
while(1) {
LATB=~LATB;
Delay_ms(1000);
}
}
So I hooked up a dsPIC33fj32mc202 to a 16 segment display and it started blinking. Yay.
I made a small change in the program. instead of LATB=0xFFFF, I made it LATB=0x8000. So in theory, only one segment should light up at first and then the remaining should be on while the first one is off, right? Instead, the entire godforsaken 16 segment display kept blinking like before. What am I doing wrong here?
I loaded the .hex again and all that. What could be wrong?
My apologies, the actual code was the following. I had not forgotten TRIS:
EDIT_________________________
void main() {
ADPCFG=0XFFFF;
TRISB=0;
LATB=0xFFFF;
while(1) {
LATB=~LATB;
Delay_ms(1000);
}
}
_____________________________________
void main() {
LATB=0xFFFF;
while(1) {
LATB=~LATB;
Delay_ms(1000);
}
}
So I hooked up a dsPIC33fj32mc202 to a 16 segment display and it started blinking. Yay.
I made a small change in the program. instead of LATB=0xFFFF, I made it LATB=0x8000. So in theory, only one segment should light up at first and then the remaining should be on while the first one is off, right? Instead, the entire godforsaken 16 segment display kept blinking like before. What am I doing wrong here?
I loaded the .hex again and all that. What could be wrong?
My apologies, the actual code was the following. I had not forgotten TRIS:
EDIT_________________________
void main() {
ADPCFG=0XFFFF;
TRISB=0;
LATB=0xFFFF;
while(1) {
LATB=~LATB;
Delay_ms(1000);
}
}
_____________________________________
Last edited: