
80C196KB USER’S GUIDE
event to be cancelled by simply writing the opposite
event to the CAM. However, once an entry is placed in
the CAM, it cannot be removed until either the speci-
fied timer matches the written value , a chip reset oc-
curs or IOC2.7 is set. IOC2.7 is the CAM clear bit
which clears all entries in the CAM.
Internal events cannot be cleared by writing an oppo-
site event. This includes events on HSO channels 8
through F. The only method for clearing these events
are by a reset or setting IOC2.7.
HSO LOCKED ENTRIES
The CAM Lock bit (HSOÐCommand.7) can be set to
keep commands in the CAM, otherwise the commands
will clear from the CAM as soon as they cause an
event. This feature allows for generation periodic events
based on Timer2 and must be enabled by setting
IOC2.6. To clear locked events from the CAM, the en-
tire CAM can be cleared by writing a one to the CAM
clear bit IOC2.7. A chip reset will also clear the CAM.
Locked entries are useful in applications requiring peri-
odic or repetitive events to occur. Timer2 used as an
HSO reference can generate periodic events with the
use of the HSO T2RST command. HSO events pro-
grammed with a HSO time less then the Timer2 reset
time will occur repeatedly as Timer2 resets. Recurrent
software tasks can be scheduled by locking software
timers commands into the High Speed Output Unit.
Continuous sampling of the A/D converter can be ac-
compished by programming a locked HSO A/D con-
version command. One of the most useful features is
the generation of multiple PWM’s on the High Speed
Output lines. Locked entries provide the ability to pro-
gram periodic events while minimizing the software
overhead. Section 9.6 describes the generation of four
PWMs using locked entries.
Individual external events setting or clearing an HSO
pin can by cancelled by writing the opposite event to
the CAM. The HSO events do not occur until the timer
reference has changed state. An event programmed to
set and clear an HSO event at the same time will cancel
each other out. Locked entries can correspondingly be
cancelled using this method. However, the entries re-
main in the HSO CAM and can quickly fill up the
available eight locations. As an alternative, all entries in
the HSO CAM can be cleared by setting IOC2.7.
9.5 HSO Precautions
Timer1 is incremented once every 8 state-times. When
it is being used as the reference timer for an HSO com-
mand, the comparator has a chance to look at all 8
CAM registers before Timer1 changes its value. Writ-
ing to Timer1, which is allowed in Window 15, should
be carefully done. The user should ensure writing to
Timer1 will not cause programmed HSO events to be
missed or occur in the wrong order. The same precau-
tion applies to Timer2.
The HSO requires at least eight state times to compare
each entry in the CAM. Therefore, the fast increment
mode for Timer2 cannot be used as a reference for the
HSO if transitions occur faster then once every eight
state times.
Referencing events when Timer2 is being used as an
up/down counter could cause events to occur in oppo-
site order or be missed entirely. Additionally, locked
entries could possibly occur several times if Timer2 is
oscillating around the time tag for an entry.
When using Timer2 as the HSO reference, caution
must be taken that Timer2 is not reset prior to the
highest value for a Timer2 match in the CAM. If that
match is never reached, the event will remain pending
in the CAM until the part is reset or CAM is cleared.
9.6 PWM Using the HSO
The HSO unit can generate PWM waveforms with very
little CPU overhead using Timer2 as a reference. A
PWM is generated by programming an HSO line to a
high and a T2RST to occur at the same time. An HSO
low time is programmed on the CAM to generate the
duty cycle of the PWM. A repetitive PWM waveform is
generated by locking the commands into the CAM. Re-
programming of the duty cycle or PWM frequency can
be accomplished by generating a software interrupt and
reprogramming the HSO high, HSO low and T2RST
commands.
Multiple PWMs can be programmed using Timer2 as a
reference and locked CAM entries. Up to four PWM’s
can be generated by locking a PWM(High) and
PWM(low) into the CAM for each HSO.0 through
HSO.3. Timer2 is used as a reference and set to zero by
programming a T2RST command at the same time an
HSO command sets all the lines high. Two CAM en-
tries program the four PWM (high) times by setting
HSO.0/HSO.1 and HSO.2/HSO.3 high with the same
command. Four entries in the CAM set each of the
HSO lines low. One entry is used to reset Timer2. This
method uses a total of seven CAM entries with little or
no software overhead. The PWMs can change their
duty cycle by reprogramming the CAM with different
HSO levels.
Changing the duty cycle for each PWM requires the
flushing of the CAM and reprogramming of all seven
entries in the CAM. The 80C196KB can flush the en-
tire CAM by setting bit 7 in the IOC2 register (location
16H). Each HSO(high) and HSO(low) times should be
44
数控原理与维修
http://www.agreenleaf.cn
Содержание 80C196KB Series
Страница 1: ...November 1990 80C196KB User s Guide Order Number 270651 003 http www agreenleaf cn...
Страница 59: ...80C196KB USER S GUIDE Figure 11 7 Ideal A D Characteristic 270651 37 55 http www agreenleaf cn...
Страница 60: ...80C196KB USER S GUIDE Figure 11 8 Actual and Ideal Characteristics 270651 38 56 http www agreenleaf cn...
Страница 61: ...80C196KB USER S GUIDE Figure 11 9 Terminal Based Characteristic 270651 39 57 http www agreenleaf cn...
Страница 70: ...80C196KB USER S GUIDE Figure 13 5 Reset Sequence 80C196KB Reset Sequence 270651 45 66 http www agreenleaf cn...
Страница 83: ...80C196KB USER S GUIDE 270651 80 Figure 15 14 AC Timing Diagrams 79 http www agreenleaf cn...
Страница 84: ...80C196KB USER S GUIDE 270651 81 270651 84 Figure 15 14 AC Timing Diagrams Continued 80 http www agreenleaf cn...