Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

counters in pic16f877

Status
Not open for further replies.

jis

Junior Member level 3
Joined
Dec 17, 2011
Messages
27
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,501
hi..........
I need to use pic's timer in counter mode...I guess it counts in hexa-dcimal... pls correct me if i am wrong.. If I assign the timer register's value to an integer variable will it automatically converted to decimal ya retained in hexa-decimal format itself??? I am using mikroc for coding..
 

Hexadecimal and decimal are just ways of representing the data. It doesn't matter which, since they essentially refer to the same value. The timer starts from 0 and increments to 1, 2, 3, 4, all the way up to 255 and overflows. You may also say that it starts from 0x00, increments to 0x01, 0x02,....0x0A, 0x0B,......0xFF. In the end, they're both the same thing. But you're talking about two different methods of representation. Bottom line is, it starts from 0 all the way to 255 and then overflows to 0. This is for 8-bit timer. For a 16-bit timer, it starts from 0, increments all the way to 65,535 (or 0xFFFF in hexadecimal).

Hope this helps.
Tahmid.
 

hi..........
I need to use pic's timer in counter mode...I guess it counts in hexa-dcimal... pls correct me if i am wrong.. If I assign the timer register's value to an integer variable will it automatically converted to decimal ya retained in hexa-decimal format itself??? I am using mikroc for coding..

You can assign a decimal number to a register or variable without a problem

register = 15;
and
register = 0xF;

do the same thing and depending on the compiler used usually you can also use the binary representation too

register = 0b11111111;

Note that for decimal you write just the number, for hexadecimal you use 0x.. and for binary 0b..

Alex
 

Thanks for replying.......
so if I do some mathematical manipulations for eg if i multiplied the timer's value by 5 (tmro*5,after disabling the clk to counter) and i compared the result with its hex equivalent, wil i get the same result as if i compared with the decimal equivalent???? as per your explanation I should get the same na...


Hexadecimal and decimal are just ways of representing the data. It doesn't matter which, since they essentially refer to the same value. The timer starts from 0 and increments to 1, 2, 3, 4, all the way up to 255 and overflows. You may also say that it starts from 0x00, increments to 0x01, 0x02,....0x0A, 0x0B,......0xFF. In the end, they're both the same thing. But you're talking about two different methods of representation. Bottom line is, it starts from 0 all the way to 255 and then overflows to 0. This is for 8-bit timer. For a 16-bit timer, it starts from 0, increments all the way to 65,535 (or 0xFFFF in hexadecimal).

Hope this helps.
Tahmid.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top