Functional Overview
Timer2
These options lets the user configure and use timer2. The clock/counter is 8-bit on pic16s and
pic18s. It counts up and also provides interrupt on overflow. The options available differ and are
listed in the device header file.
Relevant Functions:
setup_timer_2
(mode,period,postscale)
set_timer2(value)
value=get_timer2
Relevant Preprocessor:
None
Relevant Interrupts:
INT_TIMER2
Relevant Include Files:
None, all functions built-in
Relevant getenv() parameters:
TIMER2
Example Code:
For PIC18F452
setup_timer_2(T2_DISABLED);
Disables or sets the prescale, period and a postscale for
timer2
Initializes the timer2 clock/counter
Returns the value of the timer2 clock/counter
Interrupt fires when timer2 overflows
Returns 1 if the device has timer2
//disables timer2
or
setup_timer_2(T2_DIV_BY_4,0xc0,2); //sets the prescale as 4, period as 0xc0 and
//postscales as 2.
//At 20Mhz timer2 will increment every .8us in this
//setup overflows every 154.4us and interrupt every
308.2us
set_timer2(0);
time=get_timer2();
//this sets timer2 register to 0
//this will read the timer1 register value
Timer3
Timer3 is very similar to timer1. So please refer to the Timer1 section for more details.
Timer4
Timer4 is very similar to Timer2. So please refer to the Timer2 section for more details.
59
相关PDF资料
PCI-EXP-T42G5-N1 IP CORE PCI EXPRESS ORCA 4
PCM18XH2 PROCESSOR MODULE MPLAB-ICE 2000
PCM18XN0 PROCESSOR MODULE FOR ICE2000
PDA-B-24-615-E-2B1-1-C CIRCUIT BREAKER MAG 1P 15A
PFMF.260.2 PFMF PTC FUSE SMT 2.6A 1812
PFNF.200.2 PFNF PTC FUSE SMT 2A 1206
PFRY.375 PTC-FUSE RADIAL 72 VDC
PFSM.150.33.2 FUSE PTC 8A 15V FST-TRIP SMD
相关代理商/技术参数
PCD_09 制造商:MACOM 制造商全称:Tyco Electronics 功能描述:Low Profile PCB Relay PCD
PCD-00173-0C 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY
PCD-00173-0E 制造商:Molex 功能描述:Ethernet Cable Assembly
PCD-00173-0H 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY
PCD-00173-0K 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY
PCD-00174-0C 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY; Cable Length - Imperial:3ft; Cable Length - Metric:914.4mm; Connector Type A:RJ45 Plug; Connector Type B:RJ45 Plug; Jacket Color:Red; Approval Bodies:CSA / UL; Body Material:PVC; Cable Assembly Type:Ethernet ;RoHS Compliant: NA
PCD-00174-0E 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY; Cable Length - Imperial:3ft; Cable Length - Metric:914.4mm; Connector Type A:RJ45 Plug; Connector Type B:RJ45 Plug; Jacket Color:Grey; Approval Bodies:CSA / UL; Body Material:PVC; Cable Assembly Type:Ethernet;RoHS Compliant: NA
PCD-00174-0H 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY