Description: 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
To Search:
File list (Check if you may need any files):
CAPTURE.hex
CAPTURE2.DSN
CAPTURE.C