Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Problem with using Timer 2 as a clock out for 8952

Status
Not open for further replies.

fminniti

Newbie level 1
Joined
Feb 20, 2011
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,291
Hi people.
I'm quite new on Timer 2 programming for 8952 and I have a simple problem.
I'm trying to use Timer 2 as a clock out, and following Atmel instructions cannot make it work.
I'm using Keil to compile and simulate, and I get frustrated since Th2 and TL2 neveer changes their values.
Could anybody help with this single issue?
Thanks
This is part of the code to generate a 50% duty cycle on P1.0 as indicated on Atmel Manual which is not working

t2con data 0c8h
t2mod data 0c9h
rcapl data 0cah
rcaph data 0cbh
tl2 data 0cch
th2 data 0cdh

org 0000h

mov t2con,#00h ;clears t2con.1 (C/T)
mov t2mod,#02h ;sets t2mod.1 (T2OE)
mov rcapl,#0fdh
mov rcaph,#0ffh
mov tl2,#0fdh
mov th2,#0ffh
mov t2con,#04h ;starts timer (Sets TR2)
here:
inc a
mov p2,a ;just to check program and Keil
sjmp here ;are running properly

end
 

Re: 8952 Timer 2 Problem

Atmel instructions cannot make it work.
Th2 and TL2 never changes their values.

This is part of the code to generate a 50% duty cycle on P1.0 as indicated on Atmel Manual which is not working

your program is configured as 16bit autoreload timer and since you are loading the value as fffd, in the next cycle it jumps 2 count and goes to ff, after that it reloads it... so you cannot see the change , but instead of running on the debugger window if you do step by step execution using f11, you can see the variation in tl flag only and not in th as it is already having maximum value of FF.....

you are not toggling port 1.0 in the program , so you dont see output in that port pin. iinside here write cpl p1.0 ( compliment port 1.0) and see the variation in the port pin...

do step by step execution and dont run the program...
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top