打印

今测试C8051F340功耗,发现以下问题:

[复制链接]
2862|3
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
fmc|  楼主 | 2007-3-3 13:54 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
今测试C8051F340功耗,发现以下问题:

1、用内部震荡器无法进入空闲和停机模式,PCON=1/3,一执行到这系统就复位,直接芯片运行也是这样

2、系统使用内部80K震荡器并且8分频时,功耗非常大为2.6MA(各IO口不接任何器件),程序如下,请各位指教


#include <c8051f340.h>                 // SFR declarations
//#define __SRC
#include "main.h"
//#undef  __SRC
#include "MacroDefine.h"

#include <string.h>
#include <stdio.h>
#include <absacc.h>
#include <intrins.h>

#define uchar unsigned char
#define uint unsigned int

sbit CARD_LED =P1^3;  //2^0;


sfr16 TMR2RL   = 0xca;                 // Timer2 reload value
sfr16 TMR2     = 0xcc;                 // Timer2 counter

//-----------------------------------------------------------------------------
// Global Constants
//-----------------------------------------------------------------------------

#define SYSCLK       24500000 / 8      // SYSCLK frequency in Hz

#define BLINK_RATE   10                // Timer2 Interrupts per second

void OSCILLATOR_Init (void)
{
   int i;

   OSCICN |= 0;//0x03;                     // Configure internal oscillator for
                                       // its maximum frequency
  
   CLKMUL = 0x00;                      // Reset Clock Multiplier and select
                                       // internal oscillator as input source
   //CLKMUL &= 0x7f;
   CLKMUL |= 0x80;                     // Enable the Clock Multiplier

   for(i = 0; i < 256; i++);           // Delay at least 5us
   
   CLKMUL |= 0xC0;                     // Initialize the Clock Multiplier
   
   while(!(CLKMUL & 0x20));            // Wait for MULRDY => 1
   
   RSTSRC = 0x06;                      // Enable missing clock detector
                                       // and VDD monitor
   
   FLSCL |= 0x10;                      // Set Flash Scale for 48MHz
   
   CLKSEL |= 0;//0x03;                    // Select output of clock multiplier
                                       // as the system clock.
}
void OSCILLATOR_Init_low (void)
{
    
    OSCLCN    |= 0x80;
    CLKSEL    = 0x04;
 OSCICN    = 0x00;
}
//***********************************
void delay_10ms(unsigned char cent)    //12mhz
{
   unsigned int j;
   unsigned char i,k;
   
   for(i=0;i<cent;i++);
   {
      for(k=0;k<10;k++)
      {
        for(j=0;j<20;j++);
        //_nop_();
      }
   }   
}

void PORT_Init (void)
{
   
   XBR0    = 0x01;                     // Enable UART on P0.4(RX) and P0.5(TX)
   XBR1    = 0x40;                     // Enable crossbar and enable
                                       // weak pull-ups
   P1MDOUT |= 0x8;                    // push-pull  1101 1111, RF_MISO=0
}

///////////////////////////////////////////////////////////////////////
// 主函数
///////////////////////////////////////////////////////////////////////
void main(void)
{  //设置变量
//    uchar baud;
    uchar status,i;

   //*******************
   PCA0MD &= ~0x40;                         // WDTE = 0 (clear watchdog timer 
   EA=0;                                         // enable)
   OSCILLATOR_Init ();                      // Initialize system clock to 
   OSCILLATOR_Init_low();
                                            // 24.5MHz
   PORT_Init ();                            // Initialize crossbar and GPIO
   for(i=0;i<3;i++)
   {
     CARD_LED=1;
     delay_10ms(1);
     CARD_LED=0;
     delay_10ms(1);
   }

 P1MDOUT = 0;
    CARD_LED=1;
   //PCON |=1;
   while(1);
}

相关帖子

沙发
baodingkeaixyl| | 2011-2-18 09:51 | 只看该作者
根据datasheet上的哪些参数计算C8051F340功耗呢?

使用特权

评论回复
板凳
ayb_ice| | 2011-2-18 10:52 | 只看该作者
这种水平,还是多看看手册吧

使用特权

评论回复
地板
yang6625| | 2011-2-18 11:10 | 只看该作者
统使用内部80K震荡器并且8分频时

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

fmc

10

主题

12

帖子

0

粉丝