Timer2 to clock out on P1.0

I have the following code in my 89C450 running at 29.491mhz which should give me a square wave out at P1.0 but it doesnt work. Serial port works fine at 19200baud so I know thats programmed using timer 1 correctly. What am I doing wrong? Any ideas would be helpful. ; ; ***** TEST ROUTINE FOR TIMER 2 CLOCK OUT ON P1.0 ***** ; pcon equ 87h ;address of PCON register t2con equ 0c8h t2mod equ 0c9h rcap2l equ 0cah rcap2h equ 0cbh

org 0000h ljmp start

org 0100h ;allways start ROM program at 0100h start: nop mov rcap2h,#0ffh mov rcap2l,#0f1h mov a,t2con ;get current t2con value anl a,0fch ;clear bits 0 and 1 to set for 16bit reload mov t2con,a ;write back to t2con

mov a,t2mod ;get current t2mod value orl a,#02h ;sets bit 1 to enable p1.0 output mov t2mod,a ;write back to t2mod

mov a,t2con ;get current t2con value orl a,#04h ;sets bit 2 to enable timer2 mov t2con,a ;write back to t2con

mov scon,#50h ;set serial port 0 to mode 1 with rec enabled mov tmod,#20h ;set timer 1 as auto-reload 8-bit timer mov th1,#0fch ;baud rate equals 19200b at 29.491mhz mov ie,#80h ;do not enable serial interupt mov tcon,#40h ;start timer 1 setb ea ;global enable interrupts setb p3.6 ;set pull-up on WR setb p3.7 ;set pull-up on RD clr ri ;ensure that receive interupt flag is cleared clr ti mov a,#00h ;clear Acc mov p1, a ;clear port 1

loop: jnb ri,loop mov a,sbuf ;get serial data clr ri mov sbuf,a ;echo back jnb ti,$ ljmp loop

end

Reply to
Ed
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.