how to delay using 8051 timer 1 or 0?

You can post your problem related to 8051 Microcontroller Projects here. We will try our best to help you out.
Post Reply
Timothy
Posts:11
Joined:Fri Feb 24, 2017 2:17 pm
how to delay using 8051 timer 1 or 0?

Post by Timothy » Wed Mar 01, 2017 9:57 am

how can i generate delay time such as 1 ms or 10 ms or 1 second ..any..using timer 0 or 1 of 8051??
plz give me the code..
thank you

Junaid_Shahid
Posts:110
Joined:Tue Feb 14, 2017 9:00 am

Re: how to delay using 8051 timer 1 or 0?

Post by Junaid_Shahid » Wed Mar 01, 2017 9:59 am

Timothy wrote:
Wed Mar 01, 2017 9:57 am
how can i generate delay time such as 1 ms or 10 ms or 1 second ..any..using timer 0 or 1 of 8051??
plz give me the code..
thank you
sir
top:first you make the timer as 16 bit timer ie mode 1
give the the value for 50 ms ie hex of 50000
give 20 to any register
start the timer with gate
when timer overflows,decriment the register and jump back to top when the register value becomes 0,you will get a dalay of 1 sec
pls check the crystal frequency.this is for 12 mhz.
Also check:
HOW TO USE TIMER INTERRUPT IN 8051 MICROCONTROLLER

Post Reply