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

📄 pwm16.h

📁 此程序是用CYPRESS单片机编写
💻 H
字号:
//*****************************************************************************
//*****************************************************************************
//  FILENAME: PWM16.h
//   Version: 2.4, Updated on 2005/09/30 at 11:09:49
//  Generated by PSoC Designer ver 4.2  b1013 : 02 September, 2004
//
//  DESCRIPTION: PWM16 User Module C Language interface file
//               for the 22/24/27/29xxx PSoC family of devices
//-----------------------------------------------------------------------------
//  Copyright (c) Cypress MicroSystems 2000-2004. All Rights Reserved.
//*****************************************************************************
//*****************************************************************************

#include <m8c.h>

#pragma fastcall16 PWM16_EnableInt
#pragma fastcall16 PWM16_DisableInt
#pragma fastcall16 PWM16_Start
#pragma fastcall16 PWM16_Stop
#pragma fastcall16 PWM16_wReadCounter              // Read  DR0
#pragma fastcall16 PWM16_WritePeriod               // Write DR1
#pragma fastcall16 PWM16_wReadPulseWidth           // Read  DR2
#pragma fastcall16 PWM16_WritePulseWidth           // Write DR2

// The following symbols are deprecated.
// They may be omitted in future releases
//
#pragma fastcall16 wPWM16_ReadCounter              // Read  DR0 (Deprecated)
#pragma fastcall16 wPWM16_ReadPulseWidth           // Read  DR2 (Deprecated)


//-------------------------------------------------
// Prototypes of the PWM16 API.
//-------------------------------------------------

extern void PWM16_EnableInt(void);                  // Proxy Class 1
extern void PWM16_DisableInt(void);                 // Proxy Class 1
extern void PWM16_Start(void);                      // Proxy Class 1
extern void PWM16_Stop(void);                       // Proxy Class 1
extern WORD PWM16_wReadCounter(void);               // Proxy Class 2
extern void PWM16_WritePeriod(WORD wPeriod);        // Proxy Class 1
extern WORD PWM16_wReadPulseWidth(void);            // Proxy Class 1
extern void PWM16_WritePulseWidth(WORD wPulseWidth);// Proxy Class 1

// The following functions are deprecated.
// They may be omitted in future releases
//
extern WORD wPWM16_ReadCounter(void);            // Deprecated
extern WORD wPWM16_ReadPulseWidth(void);         // Deprecated


//-------------------------------------------------
// Constants for PWM16 API's.
//-------------------------------------------------

#define PWM16_CONTROL_REG_START_BIT            ( 0x01 )
#define PWM16_INT_REG_ADDR                     ( 0x0e1 )
#define PWM16_INT_MASK                         ( 0x04 )


//--------------------------------------------------
// Constants for PWM16 user defined values
//--------------------------------------------------

#define PWM16_PERIOD                           ( 0xffff )
#define PWM16_PULSE_WIDTH                      ( 0x8000 )


//-------------------------------------------------
// Register Addresses for PWM16
//-------------------------------------------------

#pragma ioport  PWM16_COUNTER_LSB_REG:  0x024              //DR0 Count register LSB
BYTE            PWM16_COUNTER_LSB_REG;
#pragma ioport  PWM16_COUNTER_MSB_REG:  0x028              //DR0 Count register MSB
BYTE            PWM16_COUNTER_MSB_REG;
#pragma ioport  PWM16_PERIOD_LSB_REG:   0x025              //DR1 Period register LSB
BYTE            PWM16_PERIOD_LSB_REG;
#pragma ioport  PWM16_PERIOD_MSB_REG:   0x029              //DR1 Period register MSB
BYTE            PWM16_PERIOD_MSB_REG;
#pragma ioport  PWM16_COMPARE_LSB_REG:  0x026              //DR2 Compare register LSB
BYTE            PWM16_COMPARE_LSB_REG;
#pragma ioport  PWM16_COMPARE_MSB_REG:  0x02a              //DR2 Compare register MSB
BYTE            PWM16_COMPARE_MSB_REG;
#pragma ioport  PWM16_CONTROL_LSB_REG:  0x027              //Control register LSB
BYTE            PWM16_CONTROL_LSB_REG;
#pragma ioport  PWM16_CONTROL_MSB_REG:  0x02b              //Control register MSB
BYTE            PWM16_CONTROL_MSB_REG;
#pragma ioport  PWM16_FUNC_LSB_REG: 0x124                  //Function register LSB
BYTE            PWM16_FUNC_LSB_REG;
#pragma ioport  PWM16_FUNC_MSB_REG: 0x128                  //Function register MSB
BYTE            PWM16_FUNC_MSB_REG;
#pragma ioport  PWM16_INPUT_LSB_REG:    0x125              //Input register LSB
BYTE            PWM16_INPUT_LSB_REG;
#pragma ioport  PWM16_INPUT_MSB_REG:    0x129              //Input register MSB
BYTE            PWM16_INPUT_MSB_REG;
#pragma ioport  PWM16_OUTPUT_LSB_REG:   0x126              //Output register LSB
BYTE            PWM16_OUTPUT_LSB_REG;
#pragma ioport  PWM16_OUTPUT_MSB_REG:   0x12a              //Output register MSB
BYTE            PWM16_OUTPUT_MSB_REG;
#pragma ioport  PWM16_INT_REG:       0x0e1                 //Interrupt Mask Register
BYTE            PWM16_INT_REG;


//-------------------------------------------------
// PWM16 Macro 'Functions'
//-------------------------------------------------

#define PWM16_Start_M \
   ( PWM16_CONTROL_LSB_REG |=  PWM16_CONTROL_REG_START_BIT )

#define PWM16_Stop_M  \
   ( PWM16_CONTROL_LSB_REG &= ~PWM16_CONTROL_REG_START_BIT )

#define PWM16_EnableInt_M   \
   M8C_EnableIntMask(  PWM16_INT_REG, PWM16_INT_MASK )

#define PWM16_DisableInt_M  \
   M8C_DisableIntMask( PWM16_INT_REG, PWM16_INT_MASK )

// end of file PWM16.h

⌨️ 快捷键说明

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