Remote Processing RPC-220 User Manual

Page 31

Advertising
background image

COUNTER/TIMERS

SECTION 8

Page 8-2

TIMER 2

Time r 2 is used to m easure time betw een edges, genera te
timed interrupts, or set, clear, and toggle certain bits at
timed intervals. CP U port P1 (located on J3 and shared
with the LCD display port) and P4 ar e mostly used for
this purpose.

Timer 2 can use an external (at CP U port P1. 4) or
internal clock. The internal clock frequency is 1. 8432
Mhz. and can be divided down via TM2CON register.

Review 8XC552OV.PDF file for more timer 2
information. T ext starts on the second page (3-474).
AN418. PDF is an application note for timer 2.

NOTE: Ther e is an err or in the 8X C552O V. PDF data

file. Figures 6 and 7 are in error. The RTE
register in Figure 6 resets bits P4. 0 to P4.5 on
a match to CM1, not CM2. The STE register
in Figur e 7 sets bits P4. 0 to P4. 5 on a ma tch to
CM1, not CM2.

APPLICATION PROGRAMS

The following programs are in the subdirectory as
shown. A ll programs can use the RTC output for
counting and pulse width m easure ment to tr y them ou t.
See SECT ION 7, SQUAR E WA VE OU TPU T for
generating information.

The prog rams list the input and contr ol lines.

F i le n am e

Description

timer0\timer0a. c

Timer 0 in counter mode.
Displays current count using J3-19
input.

timer0\timer 0b.c

Timer 0 in timing mode.
M e a su r e s h ig h pu ls e ti m e ( 3 5 m s
maximum) at J3-6.

timer2\timer2a. c

Timer 2 used to generate timed
interr upts. Can also u se to
generate time d pulse outputs.

timer2\timer 2b.c

Measure pulse widths (rising edge
to rising edg e). Prints ou t time in
micro-seco nds.

timer2\timer2c. c

Measure positive pulse width.
Faster interrupt routine for shorter
pulses. Prints out number of
counter ticks.

timer2\timer 2d.c

Outputs delayed pulses. Need
oscilloscope to view.

Advertising