#include <at89x52.h>
unsigned long xdata datas[] = {0x00000001,0x00000002,0x00000003, 0x00000004,0x3F065B4F,0x666D7D07, 0x7F6F777C,0x895E7971}; unsigned long xdata datas2[] = {0x00030001,0x00040002,0x00005003, 0x00060004,0x4F065B4F,0x676D7D07, 0x7F89777C}; unsigned char xdata datas3[] = {0x01,0x02,0x03,0x04,0x05,0x06, 0x07,0x08,0x09,0xf8,0xfe,0xff}; void DelayMs(unsigned int time);//延时函数
/*********************************************** *主函数 *功能:程序入口 ************************************************/ void main() { unsigned char *p; unsigned char i; unsigned char da;
DelayMs(500); //延时,等待将数据写入外部存储器
while (1) { p = datas3;
for (i = 0; i < 7; i++) { da = *p++; P1 = 0xFE;//P1, P0端口控制8个7段数码管显示 P0 = da; //
DelayMs(1000); } } }
/***************************************************** * 延时函数 *******************************************************/ void DelayMs(unsigned int time) { unsigned int i; unsigned int j; for (j = 0x00; j < time; j++) { for (i = 0x00; i < 0x189; i++); } }
datas[]中每个数怎么是8位十六进制数啊,在访问外部存储器时是怎么处理的? |