??? 12/09/09 14:42 Read: times |
#171527 - Clear TF2 in your service routine Responding to: ???'s previous message |
I have not really followed what you want to do. But you appear to have Timer2 in auto-reload mode, and consequently will generate an IRQ on roll-over. If you do not clear this flag, it will constantly go to the service routine.
Re comments: As Erik has suggested, a comment should show important information. I am not used to 8051, so it is useful to have English comments at initialisation. For example: say auto-reload mode timer or external counter etc. Your only useful comment lines are: CLR P0.2 ; TURN OFF LED3 MOV IE, #0A0H ; (ENABLE T2, SET EA=1, REST ALL =0) Then you can simulate your program via Keil uVision. This should show your timing. David. |
Topic | Author | Date |
Problem using Timer2 in 89S52! | 01/01/70 00:00 | |
not a very useful suggestion from 'Plz' | 01/01/70 00:00 | |
further suggestion | 01/01/70 00:00 | |
Message & Readable code is here... | 01/01/70 00:00 | |
look in the assembler manual | 01/01/70 00:00 | |
New Code, hope it helps! | 01/01/70 00:00 | |
what You are trying to make ? | 01/01/70 00:00 | |
mov T2MOD,#4 | 01/01/70 00:00 | |
sorry | 01/01/70 00:00 | |
t2mod=0 ; t2con=4 (tr2=1) It worked!![]() | 01/01/70 00:00 | |
PSW | 01/01/70 00:00 | |
that is not a comment! | 01/01/70 00:00 | |
Comments OR Explaination!!! | 01/01/70 00:00 | |
Comments are mainly for YOU | 01/01/70 00:00 | |
WRONG! | 01/01/70 00:00 | |
Answer the "why" in your comments. | 01/01/70 00:00 | |
I got (I)T2 working !!! | 01/01/70 00:00 | |
Clear TF2 in your service routine | 01/01/70 00:00 | |
Clearing TF2 in ISR | 01/01/70 00:00 |