??? 10/31/05 12:32 Read: times |
#103170 - Does this work on anyone's simulator? Responding to: ???'s previous message |
Thanks a lot Jan for directing me in the right direction, I have been to this page
http://www.atmel.com/dyn/resou...oc4345.pdf "page 77, 3.3.1 Mode 16 bits up/down Auto reload Timer" and have tried exactly the same technique outlined by manufacturer to use timer2 as 16 bit up/down timer. everything works except it does not generate interrupt even thats what example is supposed to do. I could see the TF2 flag getting set on overflow but interrupt is not generated. I wanted to ask can anyone please use this code on their compiler/simulator and see if it works , there might be something wrong with my simulator (which to be honest is unlikely) but who knows. I am pasting the program below if someone wants to have a try. I am also adding comments where my compiler gave me errors. #define MSB_reload_value 0x36 #define LSB_reload_value 0x36 $include (reg_c51.inc) my compliler (Pinnacle52) does not recongnise "#define" and does not open "include" fine, so I have moved reload values in main program and have omitted $include (reg_c51.inc), which I think is for Keil software ORG 00H LJMP BEGIN ORG 002BH LJMP IT_TIMER2 ORG 0100H BEGIN: ANL T2MOD,#0FCH ORL T2MOD,#01H CLR EXF2 CLR TCLK CLR RCLK CLR EXEN2 MOV TH2,#036H MOV TL2,#036H MOV RCAP2H,#036H MOV RCAP2L,#036H CLR C_T2 CLR CP_RL2 my compliler does not allow me to clear C_T2, and CP_RL2
using "CLR C_T2/CP_RL2", so I have used "MOV T2CON,#00H" command as all bits are zero for this mode and omitted "CLR C_T2" and "CLR CP_RL2" lines from main program MOV T2CON,#00H SETB EA SETB ET2 SETB TR2 JMP $ IT_TIMER2: CLR TF2 CPL P1.2 RETI END could you please point out, why program is not going into interrupt routine on overflow? I hope this post does not creat any confusion and is easy to understand, if not, please let us know and I will try again, Regards Kaz |