英锐恩单片机论坛,Microchip单片机,模拟器件,接口电路,麦肯单片机,单片机应用交流

 找回密码
 立即注册
搜索
电子烟方案单片机单片机开发深圳单片机开发
单片机方案国产单片机8位单片机电子烟方案开发
查看: 4278|回复: 1
打印 上一主题 下一主题

CCSC有没有象汇编代码中的关于SFR的定义

[复制链接]
跳转到指定楼层
1#
发表于 2009-3-26 10:38:42 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
#asm
        bcf     0x03,6      //选中BANK 1
        bcf     0x03,5
        btfsc   0x17,0           //取反CCP检测的边缘
        goto    SetCCP1FE
        bsf     0x17,0
        goto    SetIsFinish
SetCCP1FE:
        bcf     0x17,0
SetIsFinish:
        bcf     0x0c,2      //清除中断标志位
    #endasm
2#
 楼主| 发表于 2009-3-26 10:39:26 | 只看该作者
用 CCS 就根本不需要用到 SFR
查 Help -> index -> setup_ccp1()

查 Help -> index -> #int_ccp1

根本不需要用到 SFR

SETUP_CCP1( )
SETUP_CCP2( )
SETUP_CCP3( )
SETUP_CCP4( )
SETUP_CCP5( )


Syntax:
setup_ccp1 (mode)

setup_ccp2 (mode)

setup_ccp3 (mode)

setup_ccp4 (mode)

setup_ccp5 (mode)



Parameters:
mode is a constant.  Valid constants are in the devices .h file and are as follows:

Disable the CCP:

CCP_OFF



Set CCP to capture mode:

CCP_CAPTURE_FE
Capture on falling edge

CCP_CAPTURE_RE
Capture on rising edge

CCP_CAPTURE_DIV_4
Capture after 4 pulses

CCP_CAPTURE_DIV_16
Capture after 16 pulses




Set CCP to compare mode:

CCP_COMPARE_SET_ON_MATCH
Output high on compare

CCP_COMPARE_CLR_ON_MATCH
Output low on compare

CCP_COMPARE_INT
interrupt on compare

CCP_COMPARE_RESET_TIMER
Reset timer on compare




Set CCP to PWM mode:

CCP_PWM
Enable Pulse Width Modulator




Returns:
undefined



Function:
Initialize the CCP.  The CCP counters may be accessed using the long variables CCP_1 and CCP_2.  The CCP operates in 3 modes.  In capture mode it will copy the timer 1 count value to CCP_x when the input pin event occurs.  In compare mode it will trigger an action when timer 1 and CCP_x are equal.  In PWM mode it will generate a square wave.  The PCW wizard will help to set the correct mode and timer settings for a particular application.



Availability:
This function is only available on devices with CCP hardware.



Requires
Constants are defined in the devices .h file.



Examples:
setup_ccp1(CCP_CAPTURE_RE);



Example Files:
ex_pwm.c, ex_ccpmp.c, ex_ccp1s.c



Also See:
set_pwmX_duty()
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|公司首页|Microchip单片机,模拟器件,接口电路,麦肯单片机,单片机应用交流 ( 粤ICP备09008620号 )

GMT+8, 2024-11-24 06:24 , Processed in 0.047993 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表