Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

comparator module and PIC16f877a

Status
Not open for further replies.

toto_na16

Member level 1
Joined
Feb 21, 2010
Messages
34
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Location
Egypt
Activity points
1,478
I have some problem using comparator module.

I want to activate a fan on 25 degree so i connected lm35 output to a 5 mega resistor and connected to RA3

and a reference of 0.25 v to RA0


and the c code

Code:
void com_inti(){
     CMCON.C1INV = 0;
     CMCON.F2 = 0;  
     CMCON.F1 = 0;  
     CMCON.F0 =1;  

     }
void main(){
     TRISA.F0 = 1;
     TRISA.F3 = 1;
     TRISA.F4 = 0;
     TRISD = 0x00;
     com_inti();
     while(1){
              if(CMCON.C1OUT)
                  PORTD = 0b01010101;
              else
                  PORTD = 0b00001111;
                  }

     }


using portd as an indicator to the change in the c1out

anyone can help me in this project??

I will be very thankful :|[/code]
 

Hi,

In your com_inti() subroutine, add this:
Code:
ADCON1 = 7; //Disable ADC
And replace the 5M resistor by something like 5k. And add a decoupling capacitor like 0.1uF.

Hope this helps.
Tahmid.
 

Tahmid said:
Hi,

In your com_inti() subroutine, add this:
Code:
ADCON1 = 7; //Disable ADC
And replace the 5M resistor by something like 5k. And add a decoupling capacitor like 0.1uF.

Hope this helps.
Tahmid.

sorry it doesn't work

I'm using ISIS Professional it may help
 

Hi toto_na16,

I tried your code and found no problems. The simulation goes fine. Is the simulation or actual circuit not working? Give more details.
 

matbob said:
Hi toto_na16,

I tried your code and found no problems. The simulation goes fine. Is the simulation or actual circuit not working? Give more details.
the simulation doesn't work. The state of leds doesn't change with the change of the tempertaure. it seems like that the micro doesn't sense 0.25 volts as when i make it 2.5 volt it works fine.

but with removing the lm35 and changing the VIN+ manually .

how can we amplify such an input ??

I didn't try the actual circuits

thanks for helping

and you can call me toto only :D
 

Hi toto':D',

Please post the Proteus simulation files and your hex file.
 

    toto_na16

    Points: 2
    Helpful Answer Positive Rating
Hi toto,

I've posted the modified circuit. In Proteus, for LEDs, you have two models viz, digital and analog. You have used analog model and I modified it to digital (and no resistors are required in simulation). No other changes.
 

    toto_na16

    Points: 2
    Helpful Answer Positive Rating
very thanks to you :D

but I wish to know how do you changed it to digital ?
 

Hi toto,

Just double click on the model and see.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top