Page 1 of 1

how to reduce the power consumption of pic18

PostPosted: Sun Sep 06, 2015 3:43 am
by alicolumbia
Hi guys,
I have connected my pic18f4455 to sensors by external A/D called MCP3001 (10-bit resolution) .This A/D always sends 5v to the pic18 even there is no data coming from the sensors. Also this A/D needs a clock from Pic18 to work. For that reason, I selected the idle mode instead of sleeping mode. To save power, I have tried to make my pic18 works in idle mode when the coming data from sensors less than 250, and it works greater than 250.
I can't make the interrupt because the A/D sends 5v to the pic18 all the time.In addition, I don't think watchdog will help me with the condition (less the 250).
could you help me to write the right code for my project. I wrote a code to explain my case, but it needs a modification to work


Code: Select all
    while(1)                  //This is the primary control loop
    {
      SLEEP();               

      get_sensor_data();      //This function gets a sample from your A/D

      if(sensor_data >= 250)  //This checks the value of the sensor data
      {
        Do_Other_Tasks();     //If greater or equal to 250, it will run your other tasks
      }
    }    //Returns to the start of the While() loop which puts the MCU to SLEEP.

Re: how to reduce the power consumption of pic18

PostPosted: Sun Sep 06, 2015 4:09 am
by jtemples
Why are you using that A/D instead of the internal A/D? What is waking you from sleep? What do you mean by, "This A/D always sends 5v to the pic18 even there is no data coming from the sensors"?

Re: how to reduce the power consumption of pic18

PostPosted: Sun Sep 06, 2015 5:40 pm
by alicolumbia
I used this A/D to increase the speed of processing. I tried to use the interrupt to wake the microcontroller by using the output signal from A/D, but this A/D always send signal its value 5 volts. So the interrupt way have not helped me.
I hope to do sleep mode when the data from A/D is less than 250.

Re: how to reduce the power consumption of pic18

PostPosted: Tue Sep 08, 2015 4:15 am
by ric
There seem to be multiple bad assumptions in your design.
[1] You have to clock data out of that ADC, it doesn't take measurements when you are not talking to it, so how could it ever interrupt you upon a certain voltage level being reached?
[2] You keep saying "it always sends 5V" without ever revealing which pin on the ADC or PIC you are talking about.
[3] You say you selected the ADC to "increase the speed of processing", without mentioning what speed you require.

Have you ever used any sort of ADC before? I suspect you don't really know how they work or what they do.