Differences

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

Link to this comparison view

Next revision
Previous revision
public:calculator:progs:dm16l_progs [24/04/23 17:06 BST] – created johnpublic:calculator:progs:dm16l_progs [27/01/26 15:34 GMT] (current) – [Version 2] john
Line 2: Line 2:
  
  
-====== Dm16l Progs ======+====== DM16L Progs ======
  
-** Description **+** Some Programming aids... **
  
-===== Section One =====+===== 65C22 Timer values =====
  
 +To calculate T1CH & T1CL values for an audio frequency tone generator (akin to the DM41X Ladybug version [[public:calculator:progs:dm41x_progs|]])
  
-===== Section Two =====+==== Counter calculation ====
  
 +The required count is calculated from ''Φ<sub>2</sub>'' and the audio frequency required.
  
---- //John Pumford-Green 24/04/23 16:06//+Count (decimal)  
 + 
 +{ Φ<sub>2</sub> / ( 2 x F ) } - 2 
 + 
 +for 1000Hz  and a 1MHz Φ<sub>2</sub>
 + 
 +Count = { 1,000,000 / ( 2 X 1000 ) } - 2 = 498 
 + 
 +498d -> $01F2 
 + 
 + 
 +Start in DEC mode (and ''UNSIGNED'' integers) 
 + 
 +put required audio tone frequency in X 
 + 
 +<key>GSB</key><key>'A'</key> 
 + 
 +Result is shown in ''hex'' 
 + 
 +e.g. 
 + 
 +<key>DEC</key> 
 +1000 
 +<key>GSB</key><key>'A'</key> 
 +Result ''001F2 H'' 
 + 
 +  $01F2 
 + 
 + 
 +  T1CH = $01 
 +  T1CL = $F2 
 + 
 +The Program Listing 
 + 
 +<code> 
 + 
 +43,22,  | g LBL A 
 +44 0      | STO 0 
 +2         | 20 
 +
 +42 44     | f WSIZE (i.e. WSIZE = 20) 
 +1         | 1000000 
 +
 +
 +
 +
 +
 +
 +45 0      | RCL 0 
 +2         | 2 
 +20        | x 
 +10        | / 
 +2         | 2 
 +30        | - 
 +23        | HEX 
 +43 21     | g RTN 
 +</code> 
 + 
 + 
 +===== Version 2 ===== 
 + 
 +To calculate VIA T1 values with different CPU Φ<sub>2</sub> clock frequencies. 
 + 
 +Switch to <key>DEC</key> mode. Set word size to 24. 
 + 
 +Put required  CPU Φ<sub>2</sub> in Y and required audio freq. in X 
 + 
 +<key>GSB</key><key>B</key> 
 + 
 +Answer is in HEX. 
 + 
 +e.g 1MHz  CPU Φ<sub>2</sub> and 1000Hz Audio 
 + 
 + 
 +<key>1000000</key> 
 +<key>Enter</key> 
 +<key>1000</key>  
 +<key>GSB</key><key>B</key> 
 +   
 +  0001F2 H 
 +   
 +Timer values T1CL -> $F2 and T1CH -> $01 
 + 
 +   
 +or for 4MHz and 100Hz (e.g. for a 10ms TICK) 
 + 
 +<key>4000000</key> 
 +<key>Enter</key> 
 +<key>100</key> 
 +<key>GSB</key><key>B</key> 
 + 
 +  4E1E H 
 +   
 +Timer values T1CL -> $1E and T1CH -> $4E 
 + 
 + 
 +  * Routine B 
 + 
 +<code> 
 +42,22, B 
 +44 0 
 +34 
 +44 1 
 +
 +
 +42 44 
 +45 1 
 +45 0 
 +
 +20 
 +10 
 +
 +30 
 +23 
 +43 21 
 +</code> 
 + 
 +--- //John Pumford-Green 07/08/22 07:14//
  
  
Line 18: Line 137:
  
  
-{{tag>}}+{{tag>calculator dm16l}}
  
  

Navigation