Why you need two timers? Timers are independent.
See timers/counters section here **broken link removed**
Code ASM - [expand] |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
| //ASSUME DUTY CYCLE 50%
//ASSUME 12MHZ CLOCK IS CONNECTED TO
//MICRO-CONTROLLER
//USE TIMERS Timer 0 and Timer 1 used as 16-bit Timers
//CHECK OUT PUT IN P3.2 and P3.3
CODE:
ORG 0000H
MOV TMOD,#11H ;TMOD = 0b00010001, M0 of Timer0 and Timer1 is set to 1
TMR0:SETB P3.2
LCALL DELAYT0
CLR P3.2
LCALL DELAYT0
SJMP TMR0
TMR1:SETB P3.3
LCALL DELAYT1
CLR P3.3
LCALL DELATT1
SJMP TMR1
DELAYT0:
MOV TH0,#0FEH
MOV TL0,#0CH
CLR TF0
SETB TR0
HERE1:JNB TF0,HERE1
RET
DELAYT1:
MOV TH1,#0FEH
MOV TL1,#0CH
CLR TF1
SETB TR1
HERE2:JNB TF1,HERE2
RET
END |
If you just want two 1 KHz pulses on two output pins then you can use one timer to toggle the two output pins.
Do you want to use the timers as counters to do some counting?