public:calculator:progs:dm16l_progs
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
public:calculator:progs:dm16l_progs [24/04/23 17:06 BST] – created john | public:calculator:progs:dm16l_progs [06/03/25 06:49 GMT] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 2: | Line 2: | ||
- | ====== | + | ====== |
- | ** 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: | ||
+ | |||
+ | ==== Counter calculation ==== | ||
+ | |||
+ | The required count is calculated from '' | ||
+ | |||
+ | Count (decimal) | ||
+ | |||
+ | { Φ< | ||
+ | |||
+ | for 1000Hz | ||
+ | |||
+ | Count = { 1,000,000 / ( 2 X 1000 ) } - 2 = 498 | ||
+ | |||
+ | 498d -> $01F2 | ||
+ | |||
+ | |||
+ | Start in DEC mode (and '' | ||
+ | |||
+ | put required audio tone frequency in X | ||
+ | |||
+ | < | ||
+ | |||
+ | Result is shown in '' | ||
+ | |||
+ | e.g. | ||
+ | |||
+ | < | ||
+ | 1000 | ||
+ | < | ||
+ | Result '' | ||
+ | |||
+ | $01F2 | ||
+ | |||
+ | |||
+ | T1CH = $01 | ||
+ | T1CL = $F2 | ||
+ | |||
+ | The Program Listing | ||
+ | |||
+ | < | ||
+ | |||
+ | 43, | ||
+ | 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 Φ< | ||
+ | |||
+ | Switch to < | ||
+ | |||
+ | Put required | ||
+ | |||
+ | < | ||
+ | |||
+ | Answer is in HEX. | ||
+ | |||
+ | e.g 1MHz CPU Φ< | ||
+ | |||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | | ||
+ | 0001F2 H | ||
+ | | ||
+ | Timer values T1CL -> $F2 and T1CH -> $01 | ||
+ | |||
+ | | ||
+ | or for 4MHz and 100Hz (e.g. for a 10ms TICK) | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | |||
+ | 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 ===== | ||
+ | |||
+ | |||
+ | {{tag>}} | ||
- | ===== Section Two ===== | ||
public/calculator/progs/dm16l_progs.1682352371.txt.gz · Last modified: 06/03/25 06:49 GMT (external edit)