Timer for two Air conditioners

Status
Not open for further replies.

sachinkallely

Newbie level 3
Joined
Jan 1, 2011
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
hyderabad
Activity points
1,314
I am doing a timer for two Ac s.
PIC used is PIC16F676
environment used is Mikro C

AC hase 5 phases:
1) both AC ON for specified time
2) one ac on other off for spacified time
3) step 1 repeat
4) step 2 repeat but ACs are alternated
5) loop repeats

In proteas the ports do not turn on. they just show grey color

code :
Code:
void main() {
  TRISC=0x00;
  PORTC=0;
  do
  {
    PORTC=0b000011;
    Delay_ms(10000);
    PORTC=0b000010;
    Delay_ms(5000);
    PORTC=0b000011;
    Delay_ms(10000);
    PORTC=0b000001;
    Delay_ms(5000);
  }while(1);
}

photo attached

 

have you tried pullups to 3.3 or 5Volts so
 

Attachments

  • LEDs.jpg
    4 KB · Views: 103

Thanks horace1. But even without the LED attached, the ports do not blink
 

Your LEDs are connected to RC4 and RC5 but you're trying to blink RC0 and RC1. Your delay is 10s and 5s, Isn't that too long for blinking LED?

Code:
void main() {
  TRISC=0x00;
  PORTC=0;
  do
  {
    PORTC=0b000011;            // should be 0b00110000
    Delay_ms(10000);
    PORTC=0b000010;           // should be 0b00100000
    Delay_ms(5000);
    PORTC=0b000011;          // should be 0b00110000
    Delay_ms(10000);
    PORTC=0b000001;         // should be 0b00010000
    Delay_ms(5000);
  }while(1);
}

Allen
 


Oh My mistake. Thank you. Actually the output is not an LED. It goes to a relay. I just put an LED for testing purposes.

- - - Updated - - -

Still not working :sad:
 

Still not working :sad:

Change pullup resistors to 330Ω resistors and you logic indicator on the components should work.
See my sim attached.

And the codes I modified for MPLAB HiTech C to work.....
Plus my hex file in zip format

Code:
#include <htc.h>
#define _XTAL_FREQ 4000000 //USING 4 MHz CRYSTAL

void main() {
  TRISC=0x00;
  PORTC=0;
  do
  {
    PORTC=0b00110000;  // both LED off
    __delay_ms(1000);       // delay 1s
    PORTC=0b00100000;  // LED1 on LED2 off
    __delay_ms(500);         //delay 0.5s
    PORTC=0b00110000;  // both LED off
    __delay_ms(1000);      
    PORTC=0b00010000;  // LED1 off  LED2 on
    __delay_ms(500);
  }while(1);
}

Allen
 

Attachments

  • 16F676 BLINKER.GIF
    148.7 KB · Views: 91
  • 16f676 blinker.rar
    259 bytes · Views: 73
Last edited:


You don't have MCLR pulled up and we don't know if you disabled that in the configuration settings. My guess is that's the issue. Also, change the pull-ups to an 'analog model' such as 'RES' (remember to change the resistance) or 'MINRES330R' for example.

Hope this helps.
Tahmid.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…