John's Vademecum

Try to learn something about everything, and everything about something -Thomas Huxley “Darwin's bulldog” (1824-1895)

User Tools

Site Tools


public:calculator:progs:dm32_progs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
public:calculator:progs:dm32_progs [19/07/23 07:08 BST] – created johnpublic:calculator:progs:dm32_progs [06/03/25 06:49 GMT] (current) – external edit 127.0.0.1
Line 6: Line 6:
 ** Description ** ** Description **
  
-===== Section One =====+===== Return Loss & SWR from Complex Impedance =====
  
 +Input Rs and Xs to calculate |z|, |ρ|, VSWR and R.Loss
  
-===== Section Two =====+=== Complex numbers in DM32 === 
 + 
 +The DM32/HP31Sii handles complex numbers by treating stack-X as //Real//, stack-Y and //Imaginary// for one complex number, and stack-Z as //Real// and stack-T as //Imaginary// for a second complex number.  
 + 
 +This means the normal 4 level stack can hold 2 complex numbers. This is similar to the HP41 Advantage Pack's method. 
 + 
 +To store a complex number in a register actually requires two to be used - one for Real part and one for Imaginary part. This is similar to the HP15C/DM15L. 
 + 
 +Once the real and imaginary values are on the stack various "Complex" functions are accessed by <key>SHIFT</key><key>CMPLX</key><key>Function</key> for example to add 
 + 
 +Z<sub>1</sub> (10 + j20)  
 + 
 +and 
 + 
 +Z<sub>2</sub> (30 - j25) 
 + 
 +gives 
 + 
 +Z<sub>3</sub> Z<sub>1</sub> + Z<sub>2</sub> ( 10 + j20 ) + ( 30 - j25 ) 
 + 
 +<code> 
 +20 ENTER 10 ENTER 
 +25 CHS ENTER 30 
 + 
 +</code> 
 + 
 + 
 +The stack will show  
 +<code> 
 +20.0000 
 +10.0000 
 +-25.0000 
 +30.0000 
 +</code> 
 + 
 +Then carry out the addition 
 + 
 +<code> 
 + 
 +SHIFT CMPLX + 
 +</code> 
 + 
 +The display will show 
 + 
 +<code> 
 +20.0000 
 +10.0000 
 +-5.0000 
 +40.0000 
 +</code> 
 + 
 + 
 +X has the real part of Z<sub>3</sub> (40) and Y has the imaginary part of Z<sub>3</sub> (-5) 
 + 
 +Z<sub>3</sub> = ( 40 - j5 ) 
 + 
 + 
 +===== The program  ===== 
 + 
 +<code> 
 + 
 +LBL Z 
 +INPUT R 
 +INPUT X 
 +X<>      ; swap so Real is R and Imag is X 
 +
 +ENTER 
 +50         ; enter Zo as 50 + j 0  
 +CMPLX +    ; complex addition Z + Zo 
 +STO A      ; store intermediate value Re (Z + Zo) 
 +R↓         
 +STO B      ; store intermediate value Im (Z + Zo) 
 +R↓         ; X and Y stack now holds input Z real & imag again    
 +
 +ENTER 
 +50         ; enter Zo as 50 + j 0 (again) 
 +CMPLX -    ; complex subtraction Z - Zo 
 +RCL B      ; Im (Z + Zo)   
 +RCL A      ; Re (Z + Zo) 
 +CMPLX ÷    ; complex divide (STACK z,t holds (Z - Zo) stack x,y holds (Z + Zo) (from reg. A & B) to calculate complex reflection coeff. ρ 
 +STO E      ; save Re ρ 
 +R↓ 
 +STO F      ; save Im ρ 
 +RCL E 
 +y,x -> θ, r ; convert complex rectangular ρ to mag/angle - X holds the magnitude |ρ| ( Y holds the angle, but we don't care) 
 +STO P       ; save |ρ| 
 +
 +RCL+ P 
 +
 +RCL- P 
 +÷ 
 +STO S       ; store VSWR ( 1 + |ρ| ) / ( 1 - |ρ| )  
 +RCL P        
 +LOG 
 +20 
 +
 +STO Y       ; store Return Loss = 20 LOG |ρ| 
 +RCL X 
 +RCL R 
 +y,x -> θ, r 
 +STO Z       ; store magnitude of impedance |z| 
 +RCL P       ; |ρ| 
 +RCL S       ; VSWR 
 +RCL Y       ; Return Loss 
 +RTN 
 + 
 +</code> 
 + 
 +=== Example === 
 + 
 +  * Z = 65.2 + j 17.7 
 +  * R = 65.2 
 +  * X = 17.7 
 + 
 +  * Results on stack: 
 + 
 +<code> 
 +67.5598 
 +0.2002 
 +1.5006 
 +-13.9718 
 +</code> 
 + 
 +  * |Z| = 67.6 ohms 
 +  * |ρ| = 0.2 
 +  * SWR = 1.5:1 
 +  * Return Loss = 13.9dB
  
  
public/calculator/progs/dm32_progs.1689746934.txt.gz · Last modified: 06/03/25 06:49 GMT (external edit)