Download DM5804/DM6804 User's Manual - RTD Embedded Technologies, Inc.
Transcript
Put the hex number 0000 (decimal 0) in counter 2 load register: OUT CR, &HA OUT DR, &H0 OUT DR, &H0 ‘POINT TO COUNTER 2 LOAD REGISTER (TABLE 5-1) ‘COUNTER 2 LSB ‘COUNTER 2 MSB Next, set up the counter 4 mode register (see Figure 5-2). These are the settings we will use: Gating Control = no gating Source Edge = rising edge Count Source Selection = F1 Count Control = disable special gate = reload from load = count repetitively = binary count = count down Output Control = TC toggled VALUE = HEX 0B22 OUT CR, &H4 OUT DR, &H22 OUT DR, &H0B ‘POINT TO COUNTER 4 MODE REGISTER (TABLE 5-1) ‘COUNTER 4 MODE LSB ‘COUNTER 4 MODE MSB Put the hex number 2710 (decimal 10,000) in counter 4 load register: OUT CR, &HC OUT DR, &H10 OUT DR, &H27 ‘POINT TO COUNTER 4 LOAD REGISTER (TABLE 5-1) ‘COUNTER 4 LSB ‘COUNTER 4 MSB Next, set up the counter 5 mode register (see Figure 5-2). These are the settings we will use: Gating Control = no gating Source Edge = rising edge Count Source Selection = TCN-1 Count Control = disable special gate = reload from load = count repetitively = binary count = count down Output Control = TC toggled VALUE = HEX 0022 OUT CR, &H5 OUT DR, &H22 OUT DR, &H0 ‘POINT TO COUNTER 5 MODE REGISTER (TABLE 5-1) ‘COUNTER 5 MODE LSB ‘COUNTER 5 MODE MSB Put the hex number 1F4 (decimal 500) in counter 5 load register: OUT CR, &HD OUT DR, &HF4 OUT DR, &H1 ‘POINT TO COUNTER 5 LOAD REGISTER (TABLE 5-1) ‘COUNTER 5 LSB ‘COUNTER 5 MSB OUT IRQCLR, 0 OUT CR, &H7B ‘CLEAR INTERRUPT STATUS ‘LOAD & ARM COUNTERS 1,2,4 & 5 (TABLE 5-2) 5-11