(**********************************************************************) (* *) (* Function: RECTW2 - RECTANGULAR WAVE2 *) (* *) (* Creation Date: 03/Mar/92 From: RECTW *) (* *) (* Author: Amy Dyson *) (* *) (* Description: *) (* ------------ *) (* RECTW2 produces a continuous rectangular wave or a single *) (* pulse after initialization. The user chooses continuous or single *) (* pulse, and pin state on intialization. The user also chooses *) (* the period and the high time by writing the *) (* parameters HIGH_TIME and PERIOD in ram. HIGH_TIME and *) (* PERIOD - HIGH_TIME must be between $0000-$8000. *) (* *) (* Updates: By: Modification: *) (* -------- --- ------------- *) (* 05/Mar/92 AD Combined code for efficiency. *) (* 11/Apr/93 JL Converted to new syntax. *) (* *) (*--------------------------------------------------------------------*) (* Standard Exits Used:- End_Of_Phase: N End_Of_Link: Y *) (* *) (* External Files included: NONE *) (* *) (* CODE SIZE excluding standard exits = 18 LONG WORDS *) (*--------------------------------------------------------------------*) (* *) (* *) (********** This Revision: 1.1 *********) (* *) (********** LAST MODIFIED: 11/Apr/93 BY: Jeff Loeliger ********) (* *) (**********************************************************************) (***************************************************************************) (*Motorola reserves the right to make changes without further notice to any*) (*product herein. Motorola makes no warranty, representation or guarantee *) (*regarding the suitability of its products for any particular purpose, nor*) (*does Motorola assume any liability arising out of the application or use *) (*of any product or circuit, and specifically disclaims any and all *) (*liability, including without limitation consequential or incidental *) (*damages. "Typical" parameters can and do vary in different applications. *) (*All operating parameters, including "Typical",must be validated for each *) (*customer application by customer's technical experts. Motorola does not *) (*convey any license under its patent rights nor the rights of others. *) (*Motorola products are not designed, intended, or authorized for use as *) (*components in systems intended for surgical implant into the body, or *) (*other applications intended to support or sustain life, or for any other *) (*application in which the failure of the Motorola product could create a *) (*situation where injury or death may occur. Should Buyer purchase or use *) (*Motorola products for any such unintended or unauthorized application, *) (*Buyer, shall indemnify and hold Motorola and its officers, employees, *) (*subsidiaries, affiliates, and distributors harmless against all claims, *) (*costs, damages, and expenses, and reasonable attorney fees arising out *) (*of, directly or indirectly, any claim of personal injury or death *) (*associated with such unintended or unauthorized use, even if such claim *) (*alleges that Motorola was negligent regarding the design or manufacture *) (*of the part. *) (*Motorola and the Motorola logo are registered trademarks of Motorola Inc.*) (*Motorola is an Equal Opportunity/Affirmative Action Employer. *) (*Copyright Motorola Inc. 1993 *) (***************************************************************************) (*()()()()()()()()()()() 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 *) (* *) (*()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()*) (*+++++++++++++++++++++ PARAMETER MACROS +++++++++++++++++++++++++++*) %macro HIGHTIME_RECTW2 'prm0'. %macro PERIOD_RECTW2 'prm1'. (*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*) (*====================================================================*) (*||||||||||||||||||||| MICROCODE STARTS BELOW |||||||||||||||||||||*) (*VVVVVVVVVVVVVVVVVVVVV--------------------------VVVVVVVVVVVVVVVVVVVVV*) (**********************************************************************) (* *) (* ENTRY name: INIT_CONT_RECTW2 *) (* *) (* STATE(S) ENTERED: S1 *) (* *) (* PRELOAD PARAMETER : HIGHTIME_RECTW2 *) (* *) (* ENTER WHEN : HSR = %11 *) (* *) (* ACTION: set CFLAG0 to indicate continuous mode. *) (* set time base as TCR1. Test hsq1 to see what the initial *) (* pin state should be. According to hsq1, set the pin high *) (* or low, set pac high or low, and write mer with the *) (* current TCR + hightime or the current TCR + lowtime. *) (* Enable m/tsr service requests. Negate latches. *) (* *) (**********************************************************************) %entry name = INIT_CONT_RECTW2; start_address *; disable_match; cond hsr1=1,hsr0=1,lsr=x,m/tsr=x,pin=x,flag0=x; ram p <-@HIGHTIME_RECTW2. chan set flag0; (* cflag0=1 for cont mode *) goto L0_RECTW2, flush. (* go to shared init code *) (**********************************************************************) (* *) (* ENTRY name: INIT_1SHOT_RECTW2 *) (* *) (* STATE(S) ENTERED: S2 *) (* *) (* PRELOAD PARAMETER : HIGHTIME_RECTW2 *) (* *) (* ENTER WHEN : HSR = %10 *) (* *) (* ACTION: Clear CFLAG0 to indicate single shot mode. *) (* set time base as TCR1. Test hsq1 to see what the initial *) (* pin state should be. According to hsq1, set the pin high *) (* or low, set pac high or low, and write mer with the *) (* current TCR + hightime or the current TCR + lowtime. *) (* Enable m/tsr service requests. Negate latches. *) (* *) (**********************************************************************) %entry name = INIT_1SHOT_RECTW2; start_address *; disable_match; cond hsr1=1,hsr0=0,lsr=x,m/tsr=x,pin=x,flag0=x; ram p <-@HIGHTIME_RECTW2. chan clear flag0. (* cflag0=0 for 1-shot mode *) L0_RECTW2: chan TBS:= out_m1_c1, (* pin is output, use TCR1 *) enable_mtsr; (* enable m/tsr requests *) if hsq1=1 then goto L1_RECTW2,nflsh. (* hsq1=1 means pin hi on init *) au ert:= tcr1; (* allows for shared code *) ram diob<- @PERIOD_RECTW2. (* fetch period for lowtime *) (* service *) (**********************************************************************) (* *) (* ENTRY name: MATCHED_LOW__CONT_RECTW2 *) (* *) (* STATE(S) ENTERED: S4 *) (* *) (* PRELOAD PARAMETER : HIGHTIME_RECTW2 *) (* *) (* ENTER WHEN : HSR = %00 m/tsr=1 lsr=X flag0=1 (continuous mode) *) (* pin=0 *) (* *) (* ACTION: Find low time by subtracting the high time from the *) (* period. Add the low time to the last matched time (ert) *) (* and write this to mer, set the pin to go high on match *) (* and negate mrl. (Service is kept enabled for continuous *) (* mode.) *) (* *) (**********************************************************************) %entry name = MATCHED_LOW__CONT_RECTW2; start_address *; disable_match; cond hsr1=0,hsr0=0,lsr=x,m/tsr=1,pin=0,flag0=1; ram p <-@HIGHTIME_RECTW2. (* Low time servicing here: *) L2_RECTW2: ram diob<-@PERIOD_RECTW2. (* fetch period from ram *) chan pin:= low; (* initialize pin as low *) PAC:= high; (* pin to go high on match *) au p:= diob - p. (* subtract high time from *) (* period to get low time *) au ert:= ert + p; (* write next match *) chan write_mer, (* time to mer *) neg_mrl,neg_tdl,neg_lsl; (* negate latches *) end. (* end of S1,S2,S3,S4 *) (**********************************************************************) (* *) (* ENTRY name: MATCHED_LOW_SS_RECTW2 *) (* *) (* STATE(S) ENTERED: S3 *) (* *) (* PRELOAD PARAMETER : HIGHTIME_RECTW2 *) (* *) (* ENTER WHEN : HSR = %00 m/tsr=1 lsr=X flag0=0 (single shot mode) *) (* pin=0 *) (* *) (* ACTION: Find low time by subtracting the high time from the *) (* period. Add the low time to the last matched time (ert) *) (* and write this to mer, set the pin to go high on match *) (* and negate mrl. (Service is disabled for single shot mode) *) (* *) (**********************************************************************) %entry name = MATCHED_LOW__SS_RECTW2; start_address *; disable_match; cond hsr1=0,hsr0=0,lsr=x,m/tsr=1,pin=0,flag0=0; ram p <-@HIGHTIME_RECTW2. chan disable_mtsr; (* disable m/tsr services *) if TRUE then goto L2_RECTW2, flush. (* goto lowtime servicing *) (**********************************************************************) (* *) (* ENTRY name: MATCHED_HIGH_SS_RECTW2 *) (* *) (* STATE(S) ENTERED: S5 *) (* *) (* PRELOAD PARAMETER : HIGHTIME_RECTW2 *) (* *) (* ENTER WHEN : HSR = %00 m/tsr=1 lsr=X flag0=0 pin=1 *) (* *) (* ACTION: Add the high time to the last match time (ert) and write *) (* this to the mer. set the pin to go low on a match. *) (* (m/tsr service is disabled for single shot mode.) *) (* *) (* *) (**********************************************************************) %entry name = MATCHED_HIGH_SS_RECTW2; start_address *; disable_match; cond hsr1=0,hsr0=0,lsr=x,m/tsr=1,pin=1,flag0=0; ram p <-@HIGHTIME_RECTW2. chan disable_mtsr. (* m/tsr service disabled *) (**********************************************************************) (* *) (* ENTRY name: MATCHED_HIGH_CONT_RECTW2 *) (* *) (* STATE(S) ENTERED: S6 *) (* *) (* PRELOAD PARAMETER : HIGHTIME_RECTW2 *) (* *) (* ENTER WHEN : HSR = %00 m/tsr=1 lsr=X flag0=1 pin=1 *) (* *) (* ACTION: Add the high time to the last match time (ert) and write *) (* this to the mer. set the pin to go low on a match. *) (* (m/tsr service is left enabled for continuous mode.) *) (* *) (* *) (**********************************************************************) %entry name = MATCHED_HIGH_CONT_RECTW2; start_address *; disable_match; cond hsr1=0,hsr0=0,lsr=x,m/tsr=1,pin=1,flag0=1; ram p <-@HIGHTIME_RECTW2. (* High time servicing here: *) L1_RECTW2: au ert:= ert + p; (* write next match *) chan pin:= high, (* initialize pin as low *) PAC:= low, (* pin to go high on match *) write_mer, (* time to mer *) neg_mrl,neg_tdl,neg_lsl; (* negate latches *) end. (* end of S1,S2,S5,S6 *) (**********************************************************************) (* UNUSED STATES *) (**********************************************************************) %entry name = UNUSED_RECTW2; start_address END_OF_LINK; disable_match; cond hsr1=0,hsr0=1,lsr=x,m/tsr=x,pin=x,flag0=x; ram p <-none. %entry name = UNUSED_RECTW2; start_address END_OF_LINK; disable_match; cond hsr1=0,hsr0=0,lsr=1,m/tsr=0,pin=x,flag0=x; ram p <-none.