Function: RECTW - RECTANGULAR WAVE ========================================= Description: ------------ RECTW produces a continuous output rectangular wave. The user specifies the period and the high time by writing the parameters HIGH_TIME and PERIOD to the first two parameters of the selected channel. The function can be thought of as a PWM without 0 or 100% duty cycle support. The function uses TCR1 as a timebase and starts with a rising edge after initialisation. HIGH_TIME must be in the range $0000 to $8000 and PERIOD must be chosen such that PERIOD - HIGH_TIME is also in the range $0000-$8000. Note that the actual minimum PERIOD and minimum pulse width that can be generated will depend on other TPU activity - ie time taken to service other channels will define the maximum performance of this function. With no other channels active, the minimum PERIOD of this function is 32 CPU clocks and the minimum pulse width (high or low) is 18 CPU clocks. CODE SIZE excluding standard exits = 14 LONG WORDS Initialisation: --------------- ASSUMING a new function set containing RECTW has been created following notes elsewhere and downloaded into ON-chip RAM and emulation mode enabled: To use the RECTW function , the user should do the following:- i) Disable the selected channel by writing %00 to priority bits. ii) Write desired high time and period into the first and second parameters of the chosen channel respectively. iii) Select RECTW function on that channel by writng the assigned function number to the channels function select field. iv) Issuing a host service request type %11 to the channel. v) Enable servicing by writing High, Medium or Low priority to priority bits. The function will then start running. HIGH_TIME and PERIOD can be updated at any time by the CPU and the new values will be used after the next signal edge. (*()()()()()()()()()()() DATA STRUCTURE ()()()()()()()()()()()()()()()*) (* *) (* Name: Written By: Location Bits: *) (* ----- ----------- --------------- *) (* HIGH_TIME_RECTW CPU Parameter0 0..15 *) (* High time of period. HIGH_TIME_RECTW cannot *) (* be greater than $8000. *) (* PERIOD_RECTW CPU Parameter1 0..15 *) (* Period. PERIOD_RECTW - HIGH_TIME_RECTW cannot *) (* be greater than $8000. *) (* *) (* HSR1 HSR0 Action *) (* ---- ---- ------ *) (* 1 1 Initialize continuous rectangular wave *) (* *) (* *) (* Links Accepted: NO Links Generated: NO *) (* *) (* Interrupts Generated After: No interrupts generated *) (* *) (*()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()*) Function: RECTW2 - RECTANGULAR WAVE2 ========================================= Description: ------------ RECTW2 produces a single shot output pulse or a continuous output rectangular wave. The user specifies the period and the high time by writing the parameters HIGH_TIME and PERIOD to the first two parameters of the selected channel. Single shot or continuous mode is selected via the host service type used for initialisation. The user also selects the initial pin state via a host sequence bit. The function uses TCR1 as a timebase. HIGH_TIME must be in the range $0000 to $8000 and PERIOD must be chosen such that PERIOD - HIGH_TIME is also in the range $0000-$8000. Note that the actual minimum PERIOD and minimum pulse width that can be generated will depend on other TPU activity - ie time taken to service other channels will define the maximum performance of this function. With no other channels active, the minimum PERIOD of this function is 32 CPU clocks and the minimum pulse width (high or low) is 18 CPU clocks. CODE SIZE excluding standard exits = 18 LONG WORDS Initialisation: --------------- ASSUMING a new function set containing RECTW2has been created following notes elsewhere and downloaded into ON-chip RAM and emulation mode enabled: To use the RECTW2 function , the user should do the following:- i) Disable the selected channel by writing %00 to priority bits. ii) Write desired high time and period into the first and second parameters of the chosen channel respectively. iii) Select RECTW2 function on that channel by writng the assigned function number to the channels function select field. iv) Issuing a host service request %11 to the channel for continuous mode or issuing a host service request %10 to the channel for single shot mode. v) Enable servicing by writing High, Medium or Low priority to priority bits. The function will then start running. HIGH_TIME and PERIOD can be updated at any time by the CPU in continuous mode and the new values will be used after the next signal edge. (*()()()()()()()()()()() DATA STRUCTURE ()()()()()()()()()()()()()()()*) (* *) (* Name: Written By: Location Bits: *) (* ----- ----------- --------------- *) (* HIGHTIME_RECTW2 CPU Parameter0 0..15 *) (* High time of period. HIGHTIME_RECTW2 cannot *) (* be greater than $8000. *) (* PERIOD_RECTW2 CPU Parameter1 0..15 *) (* Period. PERIOD_RECTW2 - HIGH_TIME_RECTW2 *) (* cannot be greater than $8000. *) (* *) (* HSR1 HSR0 Action *) (* ---- ---- ------ *) (* 1 1 Initialize continuous rectangular wave *) (* 1 0 Initialize single pulse *) (* *) (* HSQ1 HSQ0 Action *) (* ---- ---- ------ *) (* 0 X Initialize pin low *) (* 1 x Initialize pin high *) (* *) (* *) (* Links Accepted: NO Links Generated: NO *) (* *) (* Interrupts Generated After: No interrupts generated *) (* *) (*()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()*)