⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 freescale

📁 Freescale 系列单片机常用模块与综合系统设计
💻
字号:
/** ###################################################################
**     Filename  : Power_Monitor.C
**     Project   : Power_Monitor
**     Processor : MC9S08JM60CLHE
**     Version   : Driver 01.11
**     Compiler  : CodeWarrior HCS08 C Compiler
**     Date/Time : 2010-1-23, 15:42
**     Abstract  :
**         Main module.
**         This module contains user's application code.
**     Settings  :
**     Contents  :
**         No public methods
**
** ###################################################################*/
/* MODULE Power_Monitor */


/* Including needed modules to compile this module/procedure */
#include "Cpu.h"
#include "Events.h"
#include "Master_SPI.h"
#include "LCD_Data.h"
#include "LCD_E.h"
#include "LCD_DI.h"
#include "LCD_RW.h"
#include "LCD_CS1.h"
#include "LCD_CS2.h"
/* Include shared modules, which are used for whole project */
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
#include "LCD128_64.h"
#include "CS5460A.h"
#include "delay.h"

/* User includes (#include below this line is not maintained by Processor Expert) */

void main(void)
{
  /* Write your local variable definition here */
   dword VRMS=0,VRMSNew=0;
	dword IRMS=0,IRMSNew=0;
  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
  PE_low_level_init();
  /*** End of Processor Expert internal initialization.                    ***/
   init_lcd();
   SetRowCol(1,0); 
   disp_str("VRMS=");
   SetRowCol(2,0); 
   disp_str("IRMS=");

    SetRowCol(1,70); 
    disp_str("V");
    SetRowCol(2,70); 
    disp_str("A");
    
	Init5460();
  /* Write your code here */
  for(;;) {
       VRMSNew = filter(CS_VRMS);
		if( (VRMSNew-VRMS>3) || (VRMS-VRMSNew>3) )
		{
			VRMS = VRMSNew;
		}
		
		IRMSNew = filter(CS_IRMS);
		if( (IRMSNew-IRMS>3)||(IRMS-IRMSNew>3) )
		{
			IRMS=IRMSNew;
		}
		SetRowCol(1,30); 
       disp_ch(VRMS/100);
       SetRowCol(2,30); 
      disp_ch(IRMS/1000);
		delay_nms(50);
   }

  /*** Don't write any code pass this line, or it will be deleted during code generation. ***/
  /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
  for(;;){}
  /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/

/* END Power_Monitor */
/*
** ###################################################################
**
**     This file was created by Processor Expert 3.07 [04.34]
**     for the Freescale HCS08 series of microcontrollers.
**
** ###################################################################
*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -