if(PORTA.F0 == 1) {
Delay_ms(30);
if((PORTA.F0 == 1) && (sw0 == 0)) { //here sw=0 means switch off knw ??
PORTB.F0 = 1;
sw0 = 1;
}
else if ((PORTA.F0 == 1) && (sw0 == 1)) {
PORTB.F0 = 0;
sw0 = 0;
}
if(PORTA.F0 == 1) {
Delay_ms(30);
if((PORTA.F0 == 1) {
PORTB.F0 = ~PORTB.F0;
}
but in program itz checking sw0==0;and RA0==1;and inside the loop sw0=1....that makes me confusion....
if(PORTA.F0 == 1) {
Delay_ms(30);
if((PORTA.F0 == 1) {
PORTB.F0 = ~PORTB.F0;
}
if(PORTA.F1 == 1) {
Delay_ms(30);
if((PORTA.F1 == 1) {
PORTB.F1 = ~PORTB.F1;
}
if(PORTA.F2 == 1) {
Delay_ms(30);
if((PORTA.F2 == 1) {
PORTB.F2 = ~PORTB.F2;
}
if(PORTA.F3 == 1) {
Delay_ms(30);
if((PORTA.F3 == 1) {
PORTB.F3 = ~PORTB.F3;
}
if(PORTA.F4 == 1) {
Delay_ms(30);
if((PORTA.F4 == 1) {
PORTB.F4 = ~PORTB.F4;
}
if(PORTA.F5 == 1) {
Delay_ms(30);
if((PORTA.F5 == 1) {
PORTB.F5 = ~PORTB.F5;
}
any way to found out the programmer is working proprly?
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 void main() { TRISB = 0b00000000; OSCCON=0b01101111; while(1) { PORTB.RB7=1; delay_ms(1000); PORTB.RB7=0; PORTB.RB6=1; delay_ms(1000); PORTB.RB6=0; } }
yes i have changed..........!
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 void main() { int sw0; TRISA = 0b01111111; TRISB = 0b00000000; PORTB = 0b00000000; ADCON1 = 0b00001111; CMCON = 0b00000111; CVRCON.CVREN = 0; CVRCON.CVROE = 0; while(1) { if(PORTA.F0 == 1) { Delay_ms(30); if((PORTA.F0 == 1) && (sw0 == 0)) { PORTB.F0 = 1; sw0 = 1; } else if ((PORTA.F0 == 1) && (sw0 == 1)) { PORTB.F0 = 0; sw0 = 0; } } } }
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?