| ??? 12/06/01 07:06 Read: times |
#17313 - RE: Please check my program codes- Steve |
Hi Nutty Blue,
Your name sounds like a star and code is working, but if you want 1 minute you must include one more raw instruction. This is DJNZ R2, Time2. Put this after DJNZ R1, Time1 instruction. I've choose R2 but could be other register. Before get in the delay loop load R2 with #C3H. This way you will multiply with 60 the time spent in all DJNZ loop. Because I don't know what you are doing with timer2 in your code. Though it's not bad to use it like you did, as baud rate generator for serial port with clocks coming from outside. Easy to fine adjust the serial baud rate, though I preffer changing RCAP2L and RCAP2H register with timer driven by internal clock. Here is a code based on George's forum post. org 2000h ; 1 Minute Program minute: CLR P1.7 clr tr0 MOV TMOD,#00000010B MOV TL0,#00H MOV TH0,#00H SETB TR0 Min1: MOV R2, #3CH ;I took off the initialised instruction from the loop Time2: MOV R1,#25 ;and load R2 with 60 decimal Time1: MOV R0,#160 Time: JNB TF0,Time CLR TF0 DJNZ R0,Time DJNZ R1,Time1 DJNZ R2, Time2 ;here is multiplied with 60 CPL P1.7 AJMP Min1 END You can use this only as test purpose. If you want to use it in a program as "CALL minute" instruction, be aware that the code is never ending loop. Regards, Silviu |
| Topic | Author | Date |
| 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 |



