J jnilo New Member Mar 15, 2015 #1 TMR1 is a word variable that stores a 16bit timer. However when I write: lcdout #TMR1 Click to expand... only the dec value of TMR1L shows up on the LCD screen. Why is that ? How can I display the full TMR1 variable in decimal ?
TMR1 is a word variable that stores a 16bit timer. However when I write: lcdout #TMR1 Click to expand... only the dec value of TMR1L shows up on the LCD screen. Why is that ? How can I display the full TMR1 variable in decimal ?
Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member Mar 15, 2015 #2 Create a long variable.... Say LngTimer!! LngTimer = TMR1H LngTimer = LngTimer * 256 LngTimer = LngTimer + TMR1L lcdout #LngTimer
Create a long variable.... Say LngTimer!! LngTimer = TMR1H LngTimer = LngTimer * 256 LngTimer = LngTimer + TMR1L lcdout #LngTimer
J jnilo New Member Mar 15, 2015 #3 It works great but it's a bit of black magic to me How come a normal word variable can be easily "lcdouted" and not timer1 ? Many thanks anyway ! Jacques
It works great but it's a bit of black magic to me How come a normal word variable can be easily "lcdouted" and not timer1 ? Many thanks anyway ! Jacques
Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member Mar 16, 2015 #4 It depends on the compiler... I looks like a bug to me... I have just given you a workaround.. TMR1 is TMR1H and TMR1L pair.... With C compilers they can cast ( change its size ) and force it into a word... I have no idea how Vladimir does it!
It depends on the compiler... I looks like a bug to me... I have just given you a workaround.. TMR1 is TMR1H and TMR1L pair.... With C compilers they can cast ( change its size ) and force it into a word... I have no idea how Vladimir does it!