(**********************************************************************) (* *) (* Function: MHT2- MEASURE HIGH TIME 2 *) (* *) (* Creation Date: 03/Mar/92 From: MHT *) (* *) (* Author: Amy Dyson *) (* *) (* Description: *) (* ------------ *) (* MHT2 measures the high time of a wave using TCR1 and writes it to *) (* a parameter in ram. After initialization, MHT2 will continuously *) (* measure every high time that comes in. The high time input must *) (* be less than or equal to $FFFF TCR1 ticks. MHT2 interrupts the *) (* CPU after measuring each high time. It links to another channel *) (* after measuring the first high time after initialization. *) (* *) (* Updates: By: Modification: *) (* -------- --- ------------- *) (* 11/Apr/93 JL Convert to new syntax *) (* *) (*--------------------------------------------------------------------*) (* Standard Exits Used:- End_Of_Phase: N End_Of_Link: Y *) (* *) (* External Files included: NONE *) (* *) (* CODE SIZE excluding standard exits =15 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: *) (* ----- ----------- --------------- *) (* START_TIME_MHT2 TPU Parameter0 0..15 *) (* Start time of a high pulse. MHT2 uses this *) (* to measure high times. *) (* HIGH_TIME_MHT2 TPU Parameter1 0..15 *) (* High time of the last high pulse measured. *) (* LINK_TO_MHT2 CPU Parameter2 4..7 *) (* Channel number that MHT2 will link to after *) (* measuring the first high time after initial- *) (* ization. *) (* *) (* hsr1 hsr0 Action *) (* ---- ---- ------ *) (* 1 1 Initialize MHT2 function *) (* *) (* *) (* Links Accepted: NO Links Generated: YES *) (* *) (* Interrupts Generated After: Every high time is measured *) (* *) (*()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()*) (*+++++++++++++++++++++ PARAMETER MACROS +++++++++++++++++++++++++++*) %macro START_TIME_MHT2 'prm0'. %macro HIGH_TIME_MHT2 'prm1'. %macro LINK_CHAN_MHT2 'prm2'. (*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*) (*====================================================================*) (*||||||||||||||||||||| MICROCODE STARTS BELOW |||||||||||||||||||||*) (*VVVVVVVVVVVVVVVVVVVVV--------------------------VVVVVVVVVVVVVVVVVVVVV*) (**********************************************************************) (* *) (* ENTRY name: INIT_MHT2 *) (* *) (* STATE(S) ENTERED: S1 *) (* *) (* PRELOAD PARAMETER : none *) (* *) (* ENTER WHEN : HSR = %11 *) (* *) (* ACTION: set time base as TCR1, set pac to look for low to high *) (* transition. Negate latches and enable m/tsr requests. *) (* set flag0 to indicate the first high time measured after *) (* initialization (since it will link on this high time only).*) (* *) (**********************************************************************) %entry name = INIT_MHT2; start_address *; disable_match; cond hsr1=1,hsr0=1,lsr=x,m/tsr=x,pin=x,flag0=x; ram p <- none. chan TBS:= in_m1_c1, (* pin is input, use TCR1 *) PAC:= low_high, (* wait for low to high trans *) enable_mtsr. (* enable m/tsr requests *) chan neg_mrl, neg_tdl, neg_lsl; (* negate latches *) chan set flag0; (* flag0=1 to indicate 1st HI *) (* time after initialization *) end. (* end of S1 *) (**********************************************************************) (* *) (* ENTRY name: TRANS_HIGH_MHT2 *) (* *) (* STATE(S) ENTERED: S2 *) (* *) (* PRELOAD PARAMETER : none *) (* *) (* ENTER WHEN : HSR = %00 m/tsr=1 lsr=X flag0=X pin=1 *) (* *) (* ACTION: Store ert (start time of high pulse) in ram. set pac *) (* to high_low to wait for low edge. Negate tdl. *) (* *) (**********************************************************************) %entry name = TRANS_HIGH_MHT2; start_address *; disable_match; cond hsr1=0,hsr0=0,lsr=x,m/tsr=1,pin=1,flag0=x; ram p <- none. au diob:= ert; (* load start time in diob *) ram diob -> @START_TIME_MHT2. (* store start time in ram *) chan PAC:= high_low; (* wait for high to low trans *) neg_tdl; (* negate tdl *) end. (* end of S2 *) (**********************************************************************) (* *) (* ENTRY name: TRANS_LOW1_MHT2 *) (* *) (* STATE(S) ENTERED: S3 *) (* *) (* PRELOAD PARAMETER : LINK_CHAN *) (* *) (* ENTER WHEN : HSR = %00 m/tsr=1 lsr=X flag0=1 pin=0 *) (* *) (* ACTION: Link to channel specified by user in LINK_CHAN. *) (* Fetch start time from ram. Subtract start time from *) (* end time to get high time. Store high time in ram. *) (* set pac to low_high to wait for next high pulse. Negate *) (* tdl. Interrupt CPU to indicate a new high pulse has just *) (* been measured. Clear flag0 to indicate the first high *) (* time has already been measured, and no further linking *) (* occurs. *) (* *) (**********************************************************************) %entry name = TRANS_LOW1_MHT2; start_address *; disable_match; cond hsr1=0,hsr0=0,lsr=x,m/tsr=1,pin=0,flag0=1; ram p <- @LINK_CHAN_MHT2. au link:= p_low; (* link to channel specified by *) (* user; uses bits 4..7 *) ram diob<-@START_TIME_MHT2. (* fetch start time from ram *) (**********************************************************************) (* *) (* ENTRY name: TRANS_LOW2_MHT2 *) (* *) (* STATE(S) ENTERED: S4 *) (* *) (* PRELOAD PARAMETER : START_TIME_MHT2 *) (* *) (* ENTER WHEN : HSR = %00 m/tsr=1 lsr=X flag0=0 pin=0 *) (* *) (* ACTION: Fetch start time from ram. Subtract start time from *) (* end time to get high time. Store high time in ram. *) (* set pac to low_high to wait for next high pulse. Negate *) (* tdl. Interrupt CPU to indicate a new high pulse has just *) (* been measured. Clear flag0 to indicate the first high *) (* time has already been measured, and no further linking *) (* occurs. *) (* *) (**********************************************************************) %entry name = TRANS_LOW2_MHT2; start_address *; disable_match; cond hsr1=0,hsr0=0,lsr=x,m/tsr=1,pin=0,flag0=0; ram diob<- @START_TIME_MHT2. au diob:= ert-diob; (* subtract start time from *) (* end time to get high time *) ram diob -> @HIGH_TIME_MHT2. (* store high time in ram *) chan PAC:= low_high, (* wait for low to high trans *) neg_tdl; (* negate tdl *) chan cir; (* interrupt CPU to indicate *) (* high time measured *) chan clear flag0; (* flag0=0 to indicate not 1st *) (* high time after init *) end. (* end of S3 *) (**********************************************************************) (* UNUSED STATES *) (**********************************************************************) %entry name = UNUSED_MHT2; 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_MHT2; start_address END_OF_LINK; disable_match; cond hsr1=1,hsr0=0,lsr=x,m/tsr=x,pin=x,flag0=x; ram p <-none. %entry name = UNUSED_MHT2; start_address END_OF_LINK; disable_match; cond hsr1=0,hsr0=0,lsr=1,m/tsr=0,pin=x,flag0=x; ram p <-none.