PDA

View Full Version : One LED not light up



rajaafiq
- 4th July 2013, 09:25
hi all,
i trying to make a running light LED on dsPIC33FJ64MC802 and this is my code



void main (void){
TRISA=0x0000; //portA as output
unsigned int data;
unsigned int n;
unsigned int m;
while (1){
data=0x01;
for(n=0;n<5;n++){ //make a loop for led to on
LATA=data; //to confugure which led to on
data=data<<1; //change the value in data
delay1s();
}
data=0x10; //Change value in data to make led light on backwork
for(m=0;m<5;m++){ //make a loop for led to on
LATA=data; //to confugure which led to on
data=data>>1; //change the value in data
delay1s();
}
}
}


my question is, why my LED 4 not light up while other run as what i want.

Ioannis
- 4th July 2013, 09:28
1. This is a PicBasic Forum and not C.
2. The above compiler does not support 24 or 32 series PICs.
3. Maybe your PortA is input only, so check your PICs datasheet.

Ioannis

aratti
- 4th July 2013, 11:26
Very likely porta for led 4 is an open collector port. In such a case, you just need to change the way the led is connected.
(Check the data sheet for confirmation)

Cheers

Al.