Jump to content
 

Cebro

New Member
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Cebro

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hey guys, I am developing a project with the PIC16F1826 and one of my outputs is flotoating like 1.9V, 2.9V and I can´t find why. I already check the ANSEL registers and initialize the PORTs at 0. It start´s when I add more if statements in my checkmodule() function... Here is the code: int c=0; int c1_m1 = 0; int c1_m2 = 0; int c1_m3 = 0; void main(){ OSCCON = 0b01110000; ANSELA = 0b00000000; ANSELB = 0b00000000; TRISA=0b11111111; PORTA = 0b00000000; TRISB=0b00000000; PORTB = 0b00000000; while(1){ checkmodules(); module_status(); } } void checkmodules(){ if(PORTAbits.RA1==1){ if(c1_m1==0){ c++; c1_m1=1; } } if(PORTAbits.RA1 == 0){ if(c1_m1 == 1){ c--; c1_m1 = 0; } } // When I add mores of this if´s, I start to have the problem with my PORTB outputs... } // end checkmodules() void module_status(){ if(c>0 && c<=3){ PORTBbits.RB4 = 1; } if(c==0){ PORTBbits.RB4 = 0; } if(c>=3){ PORTBbits.RB5 = 1; } if(c<3){ PORTBbits.RB5 = 0; } }// end module_status()
×
×
  • Create New...