Problems with microcontroller timers and serial port interrupts

Publisher:SHow111timeLatest update time:2016-09-14 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

 TMOD |= 0x20; //0011 0000 
 SCON = 0x50; //0101,0000   

TH1 = 0xFA;
 TL1 = 0xFA;

 TMOD = 0x01; //Should be changed to TMOD |= 0x01;
 TH0 = 0x70;
 TL0 = 0xc6;
    ET0=1;

 ES = 1; //
 EA = 1; //
 TR0 = 1;
 TR1 = 1; //
}

The above is the serial port interrupt initialization and timer T0 initialization. At first glance, there is no problem.

But please note that when setting the TMOD of the timer, you should use TMOD |= 0x01,,, otherwise the serial port interrupt will not work,,,, these small problems are always very annoying~~~~~

Reference address:Problems with microcontroller timers and serial port interrupts

Previous article:A simple method to convert ".hex" files to ".iic" files in Keiil
Next article:Convert digital string into digital number in MCU

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号