I wrote a simple frequency counter program in which TMR0 is 500ms timer and TMR1 as counter. Everything is working fine but what i din't understand is that TMR1 register output is hexadecimal or is decimal. Since input to TMR1 reg is in hexadecimal why my output is in decimal. Input frequency is supplied from 5khz square wave and TMR0 is prescaled to 256.TMR1 no prescaler. I set the input to TMR1 register as


but after 500ms timer my TMR1 register value is

  • \$\begingroup\$ You need to provide a bunch more information. What is your clock frequency? What is the TMR0 prescaler set to? What is TMR1 clocked from? TMR1 prescale value? \$\endgroup\$ Commented Feb 21, 2015 at 19:45
  • \$\begingroup\$ All numbers in microcontrollers are in binary. You may choose to display the numbers in Hex or Decimal. \$\endgroup\$ Commented Feb 21, 2015 at 19:53

1 Answer 1


The timer register contains a bit pattern - how you set it or display it is up to you.

Whether you say TMR1L = 0x55 or TMR1L = 85, or TMR1L = 0b01010101, the register will contain the same bit pattern.

You can display the content of the register as binary, hex, decimal, or as an ASCII character, regardless of how you set the register contents.

If I set the value of TMR1L using any of the statements above,

printf("TMR1L= %2d, %2x, %c\n", TMR1L, TMR1L, TMR1L);

will print:

TMR1L= 85, 0x55, U

showing the decimal, hex and ASCII character represented by the bit pattern in the register.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.