Hi! i couldt solve my timer problem... my old message is below.....and now i am sending all project in attachment.is there anybody who can try this code in his/her 56f8300 demo board........ (i have downloaded code to the board and read these values from timer variable respectively 59505, 45725, 41337, 63919. i have tried all timer variants(timera1-a2-a3 and timerc...).all same.... but i have build a small led blinking project using TerInt - periodic interrupt bean.it is ok. my timer still vorking properly with this project...) Regards..... isa //******************my old message**************************************** Hi. to understand working of the quad timer i have written this little software: //code begins unsigned int cnt1; void main(void) { /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ /* Write your code here */ PESL(TMRA0, QT_WRITE_CONTROL_REG, 0b0011000000000000); PESL(TMRA0, QT_WRITE_COMPARE_REG1, 0xFFFF); while(1) { PESL(TMRA0, QT_WRITE_COUNTER_REG, 0); cnt1 = PESL(TMRA0, QT_READ_COUNTER_REG, ...); PESL(TMRA0, QT_WRITE_COUNTER_REG, 0); cnt1 = PESL(TMRA0, QT_READ_COUNTER_REG, ...); PESL(TMRA0, QT_WRITE_COUNTER_REG, 0); cnt1 = PESL(TMRA0, QT_READ_COUNTER_REG, ...); PESL(TMRA0, QT_WRITE_COUNTER_REG, 0); cnt1 = PESL(TMRA0, QT_READ_COUNTER_REG, ...); } } //code ends my aim: clear timer read timer clear timer read timer clear timer read timer clear timer read timer i am reading cnt1 register by putting breakpoints. But in every reading it has different value. i have just tried and read these values respectively: 21354-28481-38797-56163.....logically i have to read same numbers from the timer. Because i am clearing it before every reading. And i have to read small numbers because i am immediatly reading timer after clearing. What is my mistake???? Regards.................. __________________________________ | |||
| |||
|
Again what is wrong in this quad timer???
Hi ....i have solved the my (foolish) problem......i want to explain here ... While(1){ (B)Write timer 0 (B)Read timer (B)Write timer 0 (B)Read timer } here (B) is the break point ....until codewarrior stop the processor in breakpoint counter continues to count.....this is the problem.....when i proper the break points like that i understood the problem..... While(1){ (B)Write timer 0 Read timer (B)Write timer 0 Read timer } And i have a new question...what about optimization level.......in this application i have seen different result in different optimization levels.....how we can we know which level is appropriate for our application?... _______________________________ |
Hey
Trying to access some memory, now it’s a char * array, now memory (physical) seems to be word aligned, but I should be able to access a character at the end of the word..
Say, at 0x1DA3 (location) I have two bytes, 0x2C and 0x00, now my pointer is starting at character 0x00, but when I try to read from there on, by pointing a byte structure to it, it jumps back a byte and starts from the start of an address, so the first character is 0x2C…
Anyway I can point a byte structure in the middle of a location? Assumed it would just be possible using byte structures and pointers but inherently it wants to align to the word…
HELP..
Rajesh Singh r...@shockdesign.com.au www.shockdesign.com.au |
|
Hello Rajesh From my understanding, the compiler will generate the code for word access when using a (word *) pointer, but you can force byte access if you type-cast it to a byte pointer. If SomePtr points to a structure with words in it, probably everything in that structure is word-aligned, so to get the byte address you would access it by putting (byte *)SomePtr = ... . Hope this is correct! Robert On 10.09.2004, at 07:36, Rajesh Singh wrote: > Hey > > Trying to access some memory, now its a char * array, now memory > (physical) seems to be word aligned, but I should be able to access a > character at the end of the word.. > > Say, at 0x1DA3 (location) I have two bytes, 0x2C and 0x00, now my > pointer is starting at character 0x00, but when I try to read from > there on, by pointing a byte structure to it, it jumps back a byte and > starts from the start of an address, so the first character is 0x2C > > Anyway I can point a byte structure in the middle of a location? > Assumed it would just be possible using byte structures and pointers > but inherently it wants to align to the word > > HELP.. > > Rajesh Singh |