Discussion in "Project Help" started by    Utsavi    May 17, 2017.
Wed May 17 2017, 04:31 pm
#1
Hello

I am working with PXAG49KBA. In my project I used Timer0 as Timer and Timer1 as counter.

The timer in my case is working perfectly (1msec timer).

I want to use Counter to count external frequency. I set Counter 1 in 16 bit non auto reload mode (Set TMOD to 0x50). I cleared TH1 and TL1. Set TR1. On every 500msec I read TH1 and TL1 and clearing it. Every time I got garbage values.

Do I required to use RTL1 and RTH1?

Is there any register I need to set in XAG-49?

In my previous project I worked on P89C51RD2 and used Timer1 as Counter, which is working ok. From the reading, XAG-49 and P89C51RD2 have same settings.

But still my counter is not working. Also I set T1OE bit to 0. Still not succeed.

Any clue on this?

Regards
Utsavi Bharuchwala







Thu May 18 2017, 01:08 am
#2
Just from reading the data sheet you seem to doing the right thing.

> Do I required to use RTL1 and RTH1?
I don't think so.

Are the values in TH1 and TL1 correct ( or at least stable) if you use timer mode ( TMOD = 0x10).
How are you timing the 500msec ?
It seems most likely your counter input is faulty, where does it come from ?


Thu May 18 2017, 11:27 am
#3
Hello

Thanks for reply.

No the input pin is not faulty. I measured the frequency from input pin, which is OK. I also toggle Input pin.

> I read counter on every 500msec with help of my 1msec Timer 0, by incrementing variable upto 500 and after reset it.

Can you provide me a demo of XAG-49 counter so that I can verify.

Regards
Utsavi Bharuchwala





Fri May 19 2017, 04:48 am
#4


Can you provide me a demo of XAG-49 counter so that I can verify.

Utsavi


I have never used the XAG-49 so can't provide code known to work on it.

What signal are you using as input to the counter ?

Can you provide your code and a circuit diagram.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

carpinteyrowrl
Fri Apr 19 2024, 02:51 pm
DonaldJAX
Fri Apr 19 2024, 01:08 pm
Lewisuhakeply
Thu Apr 18 2024, 06:00 pm
Darrellciz
Thu Apr 18 2024, 11:07 am
Charlessber
Thu Apr 18 2024, 09:29 am
BartonSem
Thu Apr 18 2024, 04:56 am
DonaldKnown
Thu Apr 18 2024, 12:24 am
utaletxcyw
Wed Apr 17 2024, 10:21 am