How to read a timer's value
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2007-04-24 1:01 AM
This discussion is locked. Please start a new topic to ask your question.
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2007-04-23 3:11 PM
Posted on April 24, 2007 at 00:11
Hi,
The datasheet for 72325 states that: QUOTE The user must read the MS Byte first, then the LS Byte value is buffered automatically. This buffered value remains unchanged until the 16-bit read sequence is completed, even if the user reads the MS Byte several times. END QUOTE Does that mean that if I write code like this: unsigned int TimerValue; ... TimerValue=TACR; the compiler will automatically do as quoted from the datasheet? I did have a look at the assembly but could not make out much Thanks,Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2007-04-23 9:08 PM
Posted on April 24, 2007 at 06:08yes, the compiler will generate a code that reads the MSB first, as required by the datasheet. Regards, Luca (Cosmic)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2007-04-24 12:13 AM
Posted on April 24, 2007 at 09:13
... when you use the COSMIC compiler, everything is o.k.
But: As it is not prescribed (in ANSI-C), other compilers may apply the reverse sequence to read or write a 16-bit integer. Regards WoRoOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2007-04-24 12:41 AM
Posted on April 24, 2007 at 09:41
... when you use the COSMIC compiler, everything is o.k.
But: As it is not prescribed (in ANSI-C), other compilers may apply the reverse sequence to read or write a 16-bit integer. Regards WoRoOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2007-04-24 1:01 AM
Posted on April 24, 2007 at 10:01
Hi,
Thank you for your replies. I guess in cases like this the chip's nature must take priority over ANSI C. The registers in question are not just simple ROM/RAM locations but rather special ones and their hardware implementation apparently has impact on the way these registers are read/written.