单片机重点作业题答案整理(18)
发布时间:2021-06-07
发布时间:2021-06-07
LOOP: JNB TI,LOOP MOV A,R2
MOV SBUF,A
LOOP1:JNB TI,LOOP1
SETB P1.0 ACALL DELAY CLR TI CLR C MOV A,R2 RLC A MOV R2,A MOV A,R3 RLC A MOV R3,A CLR P1.0
DJNZ R4,START1 SJMP MAIN
DELAY:MOV R7,#05H LOOP2:MOV R6,#0FFH LOOP1:DJNZ R6,LOOP1
DJNZ R7,LOOP2 RET END
C语言程序:
#include <reg51.h>
void delay(unsigned int x); union {
unsigned int word;
struct{unsigned char high;unsigned char low;}bytes; }number;
void main() {
int i; SCON=0x00;
while(1) {
number.word=0x01; for (i=0;i<16;i++)
{SBUF=number.bytes.low; while(!TI); TI=0;
SBUF=number.bytes.high; while(!TI); TI=0;
delay(10);
number.word=number.word*2; } }
上一篇:义务劳动心得体会3000
下一篇:2014职称英语词汇选项集锦