Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/08/01 06:07
Read: times


 
#17397 - RE: Ps Check program codes-George & Silviu
To Eric

You wrote : "You can't"
But he can !. I know it's not common practice (neither I use it) but SETB C9H will do the job. Obvious with external T2 pin driven by 3Hz square wave signal.

To Nutty Blue

No I didn't use SAB 80C535. But, the delay routine is common for all micro from MCS51 family.
If you use 11,0592Mhz that means aprox. 1us machine cycle. If you load now the RCAP2L and RCAP2H register with 00H, you will get maxim 65536 us which is obvious less than what you want.
If we consider the timer unit increment as one rolls over of Timer 2 you will need counter for 327300 units.
Because you can't wait until this counter fill up (or maybe you want to smoke a long cigaret), as Erik suggest you have to use interrupts.

First you have to place in your code:

ORG 002BH
AJMP 6Hours

and bellow in the code:

MOV IE, #A0H ;enable timer 2 interrupt, again I don't care about other bits inside A8H direct address
MOV RCAP2L, #00H ;set the reload value
MOV RCAP2H, #00H
MOV T2CON, #04H ;set autoreload mode and start timer 2

6Hours:
; here you have to count 327300 units
; I leave the routine as exercise for you
; Choose from internal RAM three bytes. when the first one rolls over increment the second.
; When the third will catch up 04H, the second FEH and the first #84H, - BINGO!
; Obvious, you can decrease from this value since is much easier to use DJNZ instruction rather than increment and compare after.
CLR EXF2 ;acknowledge interrupt
RET




List of 16 messages in thread
TopicAuthorDate
Please check my program codes            01/01/70 00:00      
RE: Please check my program codes            01/01/70 00:00      
RE: Please check my program codes            01/01/70 00:00      
RE: Please check my program codes            01/01/70 00:00      
RE: Please check my program codes            01/01/70 00:00      
RE: Please check my program codes- Steve            01/01/70 00:00      
RE: Please check my program codes- Steve            01/01/70 00:00      
RE: Please check my program codes- Steve            01/01/70 00:00      
Ps Check program codes-George & Silviu            01/01/70 00:00      
RE: Ps Check program codes-George & Silviu            01/01/70 00:00      
RE: Ps Check program codes-George & Silviu            01/01/70 00:00      
RE: Ps Check program codes-George & Silviu            01/01/70 00:00      
RE: Ps Check program codes-George & Silviu            01/01/70 00:00      
RE: Ps Check program codes-Silviu            01/01/70 00:00      
RE: Ps Check program codes-Erik            01/01/70 00:00      
RE: Please check my program codes            01/01/70 00:00      

Back to Subject List