This is an old revision of the document!
Table of Contents
DM16L Progs
Some Programming aids…
65C22 Timer values
To calculate T1CH & T1CL values for an audio frequency tone generator (akin to the DM41X Ladybug version dm41_progs)
Counter calculation
The required count is calculated from Φ2
and the audio frequency required.
Count (decimal)
{ Φ2 / ( 2 x F ) } - 2
for 1000Hz and a 1MHz Φ2 :
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
GSBA
Result is shown in hex
e.g.
DEC
1000
GSBA
Result 001F2 H
$01F2
T1CH = $01 T1CL = $F2
The Program Listing
43,22,A | 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
Version 2
To calculate VIA T1 values with different CPU Φ2 clock frequencies.
Switch to DEC mode. Set word size to 24.
Put required CPU Φ2 in Y and required audio freq. in X
GSBB
Answer is in HEX.
e.g 1MHz CPU Φ2 and 1000Hz Audio
1000000 Enter 1000 GSBB
0001F2 H
Timer values T1CL → $F2 and T1CH → $01
or for 4MHz and 100Hz (e.g. for a 10ms TICK)
4000000 Enter 100 GSBB
4E1E H
Timer values T1CL → $1E and T1CH → $4E
- Routine B
42,22, B 44 0 34 44 1 2 4 42 44 45 1 45 0 2 20 10 2 30 23 43 21
— John Pumford-Green 07/08/22 07:14
Further Information
— John Pumford-Green 24/04/23 16:06