• sgprojects.co.in.jpg
  • Slide_Show_1.jpg
  • Thermal_power_plant.jpg

The program is compiled using "mikroC PRO for PIC" compiler. You must be aware to the setting of the compiler while using the internal oscillator. Also disable the MCLR pin function.

/*
Project : Analog type servo temperature indicator
Developer : Sameer Gupta (sgprojects.co.in)
MCU : PIC12F675
XL : Internal 4MHz osc with disabled MCLR pin function
Date : Jan 2016
Description : AN0(GP0) pin input from LM35, GP2 pin output for servo
We've set the temperature maxRange at 50°C Centigrade.
*/
sbit Pulse at GP2_bit;
unsigned short delay;
unsigned long temp_value;
unsigned short multiplier = (250-60)/50; //Servo varies from 60 to 250 machine cycle with 50°C Max temp. range
void interrupt() {
Pulse = 1;
Delay_Cyc(delay);
Pulse = 0;
TMR0 = 180; // TMR0 returns to its initial value
INTCON.T0IF = 0; // Bit T0IF is cleared so that the interrupt could reoccur
}
void main() {
CMCON = 0x07; // Disable Comparators
TRISIO = 0b00000001;
OPTION_REG = 0x07; // Prescaler (1:256) is assigned to the timer TMR0
TMR0 = 180; // Timer T0 counts from 180 to 255 to create ~20 ms period
INTCON = 0xA0; // Enable interrupt TMR0 and Global Interrupts
ANSEL = 0b00000001;
do{
temp_value = ADC_Read(0);
temp_value = temp_value*488;
temp_value = temp_value/1000; // This line gives two digit temp. value
temp_value = temp_value*multiplier;
delay=250-temp_value;
delay_ms(3000);
}while(1);
}

Download the source code.

 

 

Add comment

Security code
Refresh

Amount:


1.png7.png8.png8.png7.png9.png
Visitors Today115
Visitors Yesterday113

  • Your IP Address : 172.18.210.22

2
Online

SG Templetes by Sameer Gupta