- This topic has 0 replies, 1 voice, and was last updated 13 years, 3 months ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
|
Microcontroller › 8051 › qustions about 89c51 timers,8 bit value & 16 bit value in timers, use of DPTR instead of R0-R1
can any body tell me that can i use DPTR to store value of 16 bit tmer value,
basically i want to save 16 bit timer value and then i will use that value to compare with other values but problem is all the registers in 89c51 are 8 bit register and my timer value will come in 16 bit so is that possible to use DPTR to store that value because DPTR is 16 bit register for e.g.
mov DPL,TL0 ;save the TL0 values to lower DPTR portion
mov DPH,TH0 ;save the TH0 values to upper DPTR portion
if it is not possible then tell me
that is that possible when 16 bit value comes then i will divide that value by 2 and then save it in any 8 bit register (R0-R1) for e.g.
1) divide lower value of timer 0 (i.e. TL0) by 2 and save it to accumulator “A”
2) divide upper value of timer 0 (i.e. TH0) by 2 and then ADD it to accumulator “A”
3) Now total value in will become 8 bit value then i will use it for further process
if still is is also not possible then tell me another way to use that 16 Bit value