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:dm16l_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:dm16l_progs [24/04/23 17:06 BST] – created johnpublic:calculator:progs:dm16l_progs [06/03/25 06:49 GMT] (current) – external edit 127.0.0.1
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|]])
 +
 +==== Counter calculation ====
 +
 +The required count is calculated from ''Φ<sub>2</sub>'' and the audio frequency required.
 +
 +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
 +0
 +42 44     | f WSIZE (i.e. WSIZE = 20)
 +1         | 1000000
 +0
 +0
 +0
 +0
 +0
 +0
 +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
 +2
 +4
 +42 44
 +45 1
 +45 0
 +2
 +20
 +10
 +2
 +30
 +23
 +43 21
 +</code>
 +
 +--- //John Pumford-Green 07/08/22 07:14//
 +
 +
 +===== Further Information =====
 +
 +
 +{{tag>}}
  
-===== Section Two ===== 
  
  
public/calculator/progs/dm16l_progs.1682352371.txt.gz · Last modified: 06/03/25 06:49 GMT (external edit)