欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 2218|回復(fù): 2
收起左側(cè)

STC12C5A60S2單片機(jī)怎么檢測(cè)到斷電?

[復(fù)制鏈接]
ID:575533 發(fā)表于 2019-7-24 14:51 | 顯示全部樓層 |閱讀模式
STC12C5A60S2  怎么檢測(cè)到斷電  馬上保存
  
void lvdint() interrupt 6           //(location at 0033H)
{
}
我的中斷操作為什么不停生效 PCON & 0x20也一直是true
回復(fù)

使用道具 舉報(bào)

ID:575533 發(fā)表于 2019-7-24 15:20 | 顯示全部樓層
或者有什么斷電保存的方法  提供一下也行
回復(fù)

使用道具 舉報(bào)

ID:155507 發(fā)表于 2019-7-24 17:04 | 顯示全部樓層
你這個(gè)P4.6口有接嗎?

STC12C5A60S2-LVD.jpg


我給你來(lái)個(gè)程序試試

  1. /*------------------------------------------------------------------*/
  2. /* --- STC MCU Limited ---------------------------------------------*/
  3. /* --- STC12C5Axx Series MCU Power-Down wakeup by LVD(P4.6) Demo ---*/
  4. /* --- Mobile: (86)13922805190 -------------------------------------*/
  5. /* --- Fax: 86-0513-55012956,55012947,55012969 ---------------------*/
  6. /* --- Tel: 86-0513-55012928,55012929,55012966----------------------*/
  7. /* If you want to use the program or the program referenced in the  */
  8. /* article, please specify in which data and procedures from STC    */
  9. /*------------------------------------------------------------------*/

  10. #include "reg51.h"
  11. #include "intrins.h"

  12. sfr WAKE_CLKO = 0x8f;
  13. sfr P4SW = 0xbb;

  14. sbit ELVD = IE^6;

  15. //External interrupt0 service routine
  16. void lvdint() interrupt 6           //(location at 0033H)
  17. {
  18.     PCON &= 0xdf;                   //clear LVD flag
  19. }

  20. void main()
  21. {
  22.     P4SW &= 0xbf;                   //Set P4.6 as LVD function pin
  23.     WAKE_CLKO = 0x08;               //enable LVD signal wakeup MCU from power-down mode
  24.     ELVD = 1;                       //enable LVD interrupt
  25.     EA = 1;                         //open global interrupt switch

  26.     while (1)
  27.     {
  28.         while (PCON & 0x20)
  29.         {
  30.             PCON &= 0xdf;               //clear LVD flag
  31.             _nop_();
  32.             _nop_();
  33.             _nop_();
  34.             _nop_();
  35.         }
  36.         _nop_();
  37.         _nop_();
  38.         PCON = 0x02;                 //MCU power down
  39.         _nop_();
  40.         _nop_();
  41.         P1++;
  42.     }
  43. }

復(fù)制代碼




回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表