[SOLVED] Problem with digital I/O on GP5 of 12F675

Status
Not open for further replies.

Mithun_K_Das

Advanced Member level 3
Joined
Apr 24, 2010
Messages
899
Helped
24
Reputation
48
Reaction score
26
Trophy points
1,318
Location
Dhaka, Bangladesh, Bangladesh
Activity points
8,254
Problem with digital I/O on GP5 of 12F675. GO5 is not responding as input or output.

Code:
int x =0, y = 0, cnt = 0;
void main() 
{
CMCON=0x07;
ANSEL=0x00;
OSCCAL = 0xFF;
TRISIO=0b00011100;;
GPIO=0x00;
WPU = 0x00;
while(1)

{
   while(GP2_bit == 1)
  {
   x = x^y;
   EEPROM_Write(0x01,x);
   Delay_ms(500);
   break;
  }
  EEPROM_Read(0x01);
  if(x == 1)// Automatic service !!!
  {
   cnt++;
   while(cnt >= 50)
   {
    GP0_bit = ~GP0_bit;
    cnt = 0;
    Delay_ms(10);
    break;
   }
   if(GP4_bit == 1)
   {
   GP5_bit = 0; // Relay will on if LDR  senses no light;
   Delay_ms(20);
   }
   else
   {
    GP5_bit = 1;
    Delay_ms(20);
   }
  }
  else // Manual service !!!
  {
   y = 1;
   GP0_bit = 1;
   Delay_ms(200);
   GP5_bit = 1;
  }

}

}
 

Your configuration code doesn't work? I don't understand--you have to make sure you are disabling the CLKOUT function on the pin that serves as GP5.
 

In mikroC, the configuration settings must be done here: Project > Edit Project (Cntrl + Shift + E). Not in code.

Hope this helps.
Tahmid.
 
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…