打印

请教下PSoC4的定时器的用法

[复制链接]
1298|7
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
对PSoC4的定时器还是不是很了解,请教下
沙发
heping517| | 2015-6-24 16:45 | 只看该作者
#include <device.h>

uint32 InterruptCnt;


/*******************************************************************************
* Define Interrupt service routine and allocate an vector to the Interrupt
********************************************************************************/
CY_ISR(InterruptHandler)
{
        /* Clear Inerrupt */
           Timer_ClearInterrupt(Timer_INTR_MASK_CC_MATCH);
   
        /* Increment the Counter to indicate the keep track of the number of
     * interrupts received */
    InterruptCnt++;   
}

void main()
{
    CyDelay(50);
   
    /* Enable the global interrupt */
    CyGlobalIntEnable;
   
    /* Enable the Interrupt component connected to interrupt */
    CC_ISR_StartEx(InterruptHandler);

        /* Start the components */
    Timer_Start();
    LCD_Start();
   
    /* Display Timer on LCD */
    LCD_Position(0u, 0u);
    LCD_PrintString("Timer");

    for(;;)
    {
        /* To display Period on LCD */
        LCD_Position(0u, 7u);
        LCD_PrintInt16(Timer_ReadPeriod());

        /* To display Capture value on LCD */
        LCD_Position(0u, 12u);
        LCD_PrintInt16(Timer_ReadCapture());

        /* To display count on LCD */
        LCD_Position(1u, 0u);
        LCD_PrintInt16(Timer_ReadCounter());
        
        /* To display Interrupt count on LCD */
        LCD_Position(1u, 5u);
        LCD_PrintString("IntCnt:");
        LCD_PrintInt16(InterruptCnt);
               
                CyDelay(100u);
    }
}

使用特权

评论回复
板凳
heping517| | 2015-6-24 17:00 | 只看该作者
要不

QQ截图20150624164410.jpg (136.17 KB )

QQ截图20150624164410.jpg

使用特权

评论回复
地板
heping517| | 2015-6-24 17:01 | 只看该作者
夺得

QQ截图20150624164445.jpg (119.27 KB )

QQ截图20150624164445.jpg

使用特权

评论回复
5
heping517| | 2015-6-24 17:01 | 只看该作者
检查

QQ截图20150624164503.jpg (85.68 KB )

QQ截图20150624164503.jpg

使用特权

评论回复
6
heping517| | 2015-6-24 17:02 | 只看该作者
tt

QQ截图20150624164503.jpg (85.68 KB )

QQ截图20150624164503.jpg

使用特权

评论回复
7
heping517| | 2015-6-24 17:02 | 只看该作者
rew

QQ截图20150624164513.jpg (178.36 KB )

QQ截图20150624164513.jpg

使用特权

评论回复
8
heping517| | 2015-6-24 17:02 | 只看该作者
we

QQ截图20150624164521.jpg (127 KB )

QQ截图20150624164521.jpg

使用特权

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

本版积分规则

50

主题

502

帖子

1

粉丝