how to reduce the power consumption of pic18

(instructions, reset, WDT, specifications...) PIC17Cxx, PIC18Fxxx

how to reduce the power consumption of pic18

Postby alicolumbia » Sun Sep 06, 2015 3:43 am

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.
Last edited by ric on Sun Sep 06, 2015 12:37 pm, edited 1 time in total.
Reason: Moved topic from "Welcome" to "16-Bit Core", and placed "code" tags around the code.
alicolumbia
 
Posts: 2
Joined: Sat Sep 05, 2015 11:00 pm

Re: how to reduce the power consumption of pic18

Postby jtemples » Sun Sep 06, 2015 4:09 am

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"?
jtemples
Verified identity
 
Posts: 173
Joined: Sun May 25, 2014 2:23 am
Location: The 805
PIC experience: Professional 5+ years with MCHP products

Re: how to reduce the power consumption of pic18

Postby alicolumbia » Sun Sep 06, 2015 5:40 pm

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.
alicolumbia
 
Posts: 2
Joined: Sat Sep 05, 2015 11:00 pm

Re: how to reduce the power consumption of pic18

Postby ric » Tue Sep 08, 2015 4:15 am

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.
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 454
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products


Return to 16-Bit Core

Who is online

Users browsing this forum: No registered users and 9 guests