Writing a delay subroutine?

后端 未结 3 915
南方客
南方客 2021-01-07 04:47

I need to write a delay subroutine. It should delay about 1 second. It has to be for 8051 environment, DS89C430 micrcontroller ( 11.0592 MHz XTAL). How can I write this subr

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-07 05:01

    This microcontroller has three on-board timers (see section 11 of the User's Manual) connected to the system clock (divided by 12), so it's a matter of programming them to generate an interrupt when the time expires. Since the divided input is just under 1 MHz, and the largest counter is 16 bits, you'll need to count 14 interrupts to reach one second (at least if I've done the math correctly).

提交回复
热议问题