文件名称:CAPTURE
-
所属分类:
- 标签属性:
- 上传时间:2013-06-03
-
文件大小:16.72kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
PIC单片机的CCP功能
//220V的交流电源直接用电阻限流,经光耦隔离,形成脉冲送到CCP2,
//CCP2模块的捕捉功能,设置为每16个上升沿捕捉一次,相当于平均滤波,目的是为了减小误差
//TMR1计数的分频系数计算:假设电源为50Hz,即一个周期为20ms,16个周期为320ms
//320ms=320000us,单片机用4MHz晶振,指令周期为1us,设TMR1的分频系数为K:65536×K=320000
//得K=4.88,取K=8,即TMR1的预分频系数设为1:8
//电源频率计算,假设频率显示为2位小数,即频率值放大100倍,16次捕捉值为TTZ,
//则f=1000000×100/(TTZ×8/16)=200000000/TTZ-PIC microcontroller CCP function// 220V AC power directly limiting resistor, the optocoupler isolation, a pulse sent CCP2,// CCP2 module' s capture function, set to capture rising once every 16, equivalent to an average filter The purpose is to reduce the error// TMR1 counter division ratio calculation: Suppose power is 50Hz, ie a period of 20ms, 16 cycles of 320ms// 320ms = 320000us, microcontroller 4MHz crystal, the instruction cycle is 1us, setting TMR1 divider coefficient K: 65536K = 320000// get K = 4.88, take K = 8, ie the TMR1 prescaler is set to 1:8// power frequency, assuming that the frequency is displayed as two decimal that frequency value magnified 100 times, 16 times to capture value TTZ,// then f = 1000000100/(TTZ8/16) = 200000000/TTZ
//220V的交流电源直接用电阻限流,经光耦隔离,形成脉冲送到CCP2,
//CCP2模块的捕捉功能,设置为每16个上升沿捕捉一次,相当于平均滤波,目的是为了减小误差
//TMR1计数的分频系数计算:假设电源为50Hz,即一个周期为20ms,16个周期为320ms
//320ms=320000us,单片机用4MHz晶振,指令周期为1us,设TMR1的分频系数为K:65536×K=320000
//得K=4.88,取K=8,即TMR1的预分频系数设为1:8
//电源频率计算,假设频率显示为2位小数,即频率值放大100倍,16次捕捉值为TTZ,
//则f=1000000×100/(TTZ×8/16)=200000000/TTZ-PIC microcontroller CCP function// 220V AC power directly limiting resistor, the optocoupler isolation, a pulse sent CCP2,// CCP2 module' s capture function, set to capture rising once every 16, equivalent to an average filter The purpose is to reduce the error// TMR1 counter division ratio calculation: Suppose power is 50Hz, ie a period of 20ms, 16 cycles of 320ms// 320ms = 320000us, microcontroller 4MHz crystal, the instruction cycle is 1us, setting TMR1 divider coefficient K: 65536K = 320000// get K = 4.88, take K = 8, ie the TMR1 prescaler is set to 1:8// power frequency, assuming that the frequency is displayed as two decimal that frequency value magnified 100 times, 16 times to capture value TTZ,// then f = 1000000100/(TTZ8/16) = 200000000/TTZ
(系统自动生成,下载前可以参看下载内容)
下载文件列表
CAPTURE.hex
CAPTURE2.DSN
CAPTURE.C
CAPTURE2.DSN
CAPTURE.C
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.