XAG-49 Counter setting
Discussion in "Project Help" started by Utsavi May 17, 2017.
Wed May 17 2017, 04:31 pm
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
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
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 ?
> 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
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
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
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.
Powered by e107 Forum System