AWD problems
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2010-04-16 1:01 PM
Posted on April 16, 2010 at 22:01
AWD problems
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2011-05-17 6:08 AM
Posted on May 17, 2011 at 15:08
I've solved my problem:
If I want to set High Treshold to 900d using ((u16)900); it will set 12d. How is it posible. Well 900d is 0000001110000100b and the ADC_HTR register is left alignght. The Function ADC1_SetHighTreshhold takes eight MSB (00000011) and writes them to ADC_HTRH and two LSB bits (in this case 00) writes to ADC_HTRL, so the end effect is 0000001100b=12d. So if w want to set High Treshold to 900d i have to write ((u160xE100). Watch why. 900d=1110000100b, so 11100001b=0xE1 and 00b=0x00. I Hope it is clear. Unfortunately the Firmware Library doesn't tell anything how data is treated by functions if the function operates on left aligned registers. Luckily i managed to figure out my problem.