This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

16 bit up down counter

Hi

I have to use a 16 bit up/down counter...... I wrote the code for that in at89c51. The counting is made in external interrupt 0. The pulses are given by a linear scale.
the count values are stored in mem location 50 and 51. The up counting or down counting is decided by the state of the 3.0 and 3.1 pins

counter:
        jnb p3.0,ru
        jnb p3.1,rd
        reti

rd:     push acc
        mov a,51h  ;up counting
        add a,#01h
        jc bb
        sjmp aa
bb:     inc 50h
aa:     inc 51h
        pop acc
        reti

ru:     push acc  ;down counting
        mov a,51h
        clr c
        subb a,#01h
        jc dd
        sjmp cc
dd:     dec 50h
cc:     dec 51h
        pop acc
        reti

Now the issue that i face is that the pulses are too fast and most of the time he controller is in interrupt sub and does not have time for updating the lcd and send data serially.
so i might need a hardware up&down counter. I tried the at89s8252 but during down counting the th2 and tl2 registers are reset to zero and then the downcounting starts.

Is there any other way or should i use the 16 bit 2016 updown counter IC ( :-( too costly )

Thanks

0