Forums

What is wrong in this quad timer???

Started by Unknown August 18, 2004
Hi. to understand working of the quad timer i have
written this little software:

//code begins(count up with ip bus clock -60mhz-)
unsigned int cnt1;

void main(void)
{
/*** Processor Expert internal initialization. DON'T
REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal
initialization. ***/

/* Write your code here */
PESL(TMRA0, QT_WRITE_CONTROL_REG, 0b0011000000000000);
PESL(TMRA0, QT_WRITE_COMPARE_REG1, 0xFFFF);

while(1)
{

PESL(TMRA0, QT_WRITE_COUNTER_REG, 0);
cnt1 = PESL(TMRA0, QT_READ_COUNTER_REG, ...);

PESL(TMRA0, QT_WRITE_COUNTER_REG, 0);
cnt1 = PESL(TMRA0, QT_READ_COUNTER_REG, ...);

PESL(TMRA0, QT_WRITE_COUNTER_REG, 0);
cnt1 = PESL(TMRA0, QT_READ_COUNTER_REG, ...);

PESL(TMRA0, QT_WRITE_COUNTER_REG, 0);
cnt1 = PESL(TMRA0, QT_READ_COUNTER_REG, ...);

}

}
//code ends

my aim:

clear timer
read timer
clear timer
read timer
clear timer
read timer
clear timer
read timer

i am reading cnt1 register by putting breakpoints. But
in every reading it has different value. i have just
tried and read these values respectively:
21354-28481-38797-56163.....logically i have to read
same numbers from the timer. Because i am clearing it
before every reading. And i have to read small numbers
because i am immediatly reading timer after clearing.
What is my mistake????

Regards..................

__________________________________




What processor are using? I have executed this code on 56F8323 demo
board and it worked fine: every read of count register gave me value
of 3.

Leonard

--- In , isa "g" <olemp_isa@y...>
wrote:
> Hi. to understand working of the quad timer i have
> written this little software:
>
> //code begins(count up with ip bus clock -60mhz-)
> unsigned int cnt1;
>
> void main(void)
> {
> /*** Processor Expert internal initialization. DON'T
> REMOVE THIS CODE!!! ***/
> PE_low_level_init();
> /*** End of Processor Expert internal
> initialization. ***/
>
> /* Write your code here */ >
> PESL(TMRA0, QT_WRITE_CONTROL_REG, 0b0011000000000000);
> PESL(TMRA0, QT_WRITE_COMPARE_REG1, 0xFFFF); >
>
> while(1)
> {
>
> PESL(TMRA0, QT_WRITE_COUNTER_REG, 0);
> cnt1 = PESL(TMRA0, QT_READ_COUNTER_REG, ...);
>
> PESL(TMRA0, QT_WRITE_COUNTER_REG, 0);
> cnt1 = PESL(TMRA0, QT_READ_COUNTER_REG, ...);
>
> PESL(TMRA0, QT_WRITE_COUNTER_REG, 0);
> cnt1 = PESL(TMRA0, QT_READ_COUNTER_REG, ...);
>
> PESL(TMRA0, QT_WRITE_COUNTER_REG, 0);
> cnt1 = PESL(TMRA0, QT_READ_COUNTER_REG, ...);
>
> }
>
> }
> //code ends
>
> my aim:
>
> clear timer
> read timer
> clear timer
> read timer
> clear timer
> read timer
> clear timer
> read timer
>
> i am reading cnt1 register by putting breakpoints. But
> in every reading it has different value. i have just
> tried and read these values respectively:
> 21354-28481-38797-56163.....logically i have to read
> same numbers from the timer. Because i am clearing it
> before every reading. And i have to read small numbers
> because i am immediatly reading timer after clearing.
> What is my mistake????
>
> Regards.................. >
>
> __________________________________
>




thanks.i am using 56f8300 demo board(the board which
has e-field sensor with 56f8323).i am trying this code
for a while and it dosn't work properly..........
i didn't use any pe bean. i have used pe to initalize
cpu. all code is this.
if it works in your board it should work also in my
board:))it is odd.
--- help56800 <> wrote:

> What processor are using? I have executed this code
> on 56F8323 demo
> board and it worked fine: every read of count
> register gave me value
> of 3.
>
> Leonard
>
> --- In , isa "g"
> <olemp_isa@y...>
> wrote:
> > Hi. to understand working of the quad timer i have
> > written this little software:
> >
> > //code begins(count up with ip bus clock -60mhz-)
> > unsigned int cnt1;
> >
> > void main(void)
> > {
> > /*** Processor Expert internal initialization.
> DON'T
> > REMOVE THIS CODE!!! ***/
> > PE_low_level_init();
> > /*** End of Processor Expert internal
> > initialization. ***/
> >
> > /* Write your code here */
> >
> >
> >
> > PESL(TMRA0, QT_WRITE_CONTROL_REG,
> 0b0011000000000000);
> > PESL(TMRA0, QT_WRITE_COMPARE_REG1, 0xFFFF);
> >
> >
> >
> >
> > while(1)
> > {
> >
> > PESL(TMRA0, QT_WRITE_COUNTER_REG, 0);
> > cnt1 = PESL(TMRA0, QT_READ_COUNTER_REG, ...);
> >
> > PESL(TMRA0, QT_WRITE_COUNTER_REG, 0);
> > cnt1 = PESL(TMRA0, QT_READ_COUNTER_REG, ...);
> >
> > PESL(TMRA0, QT_WRITE_COUNTER_REG, 0);
> > cnt1 = PESL(TMRA0, QT_READ_COUNTER_REG, ...);
> >
> > PESL(TMRA0, QT_WRITE_COUNTER_REG, 0);
> > cnt1 = PESL(TMRA0, QT_READ_COUNTER_REG, ...);
> >
> > }
> >
> > }
> > //code ends
> >
> > my aim:
> >
> > clear timer
> > read timer
> > clear timer
> > read timer
> > clear timer
> > read timer
> > clear timer
> > read timer
> >
> > i am reading cnt1 register by putting breakpoints.
> But
> > in every reading it has different value. i have
> just
> > tried and read these values respectively:
> > 21354-28481-38797-56163.....logically i have to
> read
> > same numbers from the timer. Because i am clearing
> it
> > before every reading. And i have to read small
> numbers
> > because i am immediatly reading timer after
> clearing.
> > What is my mistake????
> >
> > Regards..................
> >
> >
> >
> >
> > __________________________________
>

__________________________________