用定时器Terminalcountout中断控制 一个发光二极管每一秒钟闪烁一次,但是程序下进后二极管一直亮着,是不是没有响应中断啊?
我的程序代码:
#include <m8c.h> // part specific constants and macros
#include "PSoCAPI.h" // PSoC API definitions for all User Modules
#pragma interrupt_handler Timer8_ISR_C
/*
extern void Timer8_EnableInt(void);
extern void Timer8_DisableInt(void);
extern void Timer8_Start(void);
extern void Timer8_Stop(void);
extern BYTE Timer8_bReadTimer(void);
extern BYTE Timer8_bReadTimerSaveCV(void);
extern void Timer8_WritePeriod(BYTE bPeriod);
extern BYTE Timer8_bReadCompareValue(void);
extern void Timer8_WriteCompareValue(BYTE bCompareValue);
*/
void main()
{
// Insert your main routine code here.
//Timer8_WritePeriod(183);
M8C_EnableGInt;
Timer8_EnableInt();
Timer8_Start();
while(1);
}
void Timer8_ISR_C()
{
PRT0DR^ =0x02;
}
芯片配置
Global Resources
CPU_Clock =12 MHz
VC1 =16 Divide 24 MHz SysClock by 16.
VC2 =16 Divide VC1 by 16.
VC3 Source =VC2 Set the source for VC3 as VC2.
VC3 Divider =256 Divide VC2 by 256 (to produce a 366 Hz clock)
User Module Parameters
Timer8_1 Clock =VC3 Input 366 Hz clock from VC3.
Capture =Low Not used.
TerminalCountOut =Row_0_Output_0 For routing to Pin2[3].
CompareOut =None Not used.
Period =182 Set to 182 and count down.
Compare Value =0 Not used.
Compare Type =Less Than Not used.
Interrupt Type =Terminal Count To generate interrupt after the down counter reaches 0.
Clock Sync =Sync To SysClk Synchronize to system clock.
TC_PulseWidth =Full width Generate a full pulse width at every terminal count. InvertCapture =Normal Not used. |