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

How to use time. and capcom

Hi
I have some question about timer.If i recive one signal squarewave and i want to detect it only 1 period and i want to know the time of it .How i can do it .
i haved tried to use capcom but i don't know how it work !!!!
i have another question how i can change number in base 16 to base 10 and how i can change number in base 10 to base 16
thank you
i use c167cr

Parents
  • There are a number of threads on timing the interval between two pulses, as well as app notes. So I'll leave that question up to the search function, and just skim the easy one...

    Base 10 and base 16 are just human-readable output conventions. Internally, of course, the values are all in base two. So, the question is really which I/O routines you use.

    For printf and scanf, the %u and %d specifiers print in base 10. %x (or %X) prints in base 16 (hexadecimal).

    The strtol / strtoul functions take a parameter for the base to use, or you can pass in 0 to have the routine follow the usual C conventions (leading 0 octal, leading 0x hex).

    See the C51 Library Functions manual for more details.

Reply
  • There are a number of threads on timing the interval between two pulses, as well as app notes. So I'll leave that question up to the search function, and just skim the easy one...

    Base 10 and base 16 are just human-readable output conventions. Internally, of course, the values are all in base two. So, the question is really which I/O routines you use.

    For printf and scanf, the %u and %d specifiers print in base 10. %x (or %X) prints in base 16 (hexadecimal).

    The strtol / strtoul functions take a parameter for the base to use, or you can pass in 0 to have the routine follow the usual C conventions (leading 0 octal, leading 0x hex).

    See the C51 Library Functions manual for more details.

Children