| công cụ tìm kiếm bảng dữ liệu linh kiện điện tử |
|
STC89LE53RC bảng dữ liệu(PDF) 155 Page - STCmicro Technology Co,.Ltd |
|
|
|||||||||||||||||||||||||||||
STC89LE53RC bảng dữ liệu(HTML) 155 Page - STCmicro Technology Co,.Ltd |
|
155 / 165 page ![]() Appendix B: 8051 C Programming ADVANTAGES AND DISADVANTAGES OF 8051 C The advantages of programming the 8051 in C as compared to assembly are: Offers all the benefits of high-level, structured programming languages such as C, including the ease of writing subroutines Often relieves the programmer of the hardware details that the complier handles on behalf of the programmer Easier to write, especially for large and complex programs Produces more readable program source codes Nevertheless, 8051 C, being very similar to the conventional C language, also suffers from the following disadvantages: Processes the disadvantages of high-level, structured programming languages. Generally generates larger machine codes Programmer has less control and less ability to directly interact with hardware To compare between 8051 C and assembly language, consider the solutions to the Example—Write a program using Timer 0 to create a 1KHz square wave on P1.0. A solution written below in 8051 C language: sbit portbit = P1^0; /*Use variable portbit to refer to P1.0*/ main ( ) { TMOD = 1; while (1) { TH0 = 0xFE; TL0 = 0xC; TR0 = 1; while (TF0 !=1); TR0 = 0; TF0 = 0; portbit = !(P1.^0); } } A solution written below in assembly language: ORG 8100H MOV TMOD, #01H ;16-bit timer mode LOOP: MOV TH0, #0FEH ;-500 (high byte) MOV TL0, #0CH ;-500 (low byte) SETB TR0 ;start timer WAIT: JNB TF0, WAIT ;wait for overflow CLR TR0 ;stop timer CLR TF0 ;clear timer overflow flag CPL P1.0 ;toggle port bit SJMP LOOP ;repeat END • • • • • • • 155 |
|
Link URL |
| Cho đến nay ALLDATASHEET có giúp ích cho doanh nghiệp của bạn hay không? [ DONATE ] |
Alldatasheet là | Quảng cáo | Liên lạc với chúng tôi | Chính sách bảo mật | Liên kết đến bảng dữ liệu | Trao đổi link | Tìm kiếm theo nhà sản xuất All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |