结构体指针指向结构体数组,要不要加&。数组名就是数组首地址。

void SetRealTime(struct sTime *time) { unsigned char buf[8]; buf[7] = 0; buf[6] = time->year; buf[5] = time->week; buf[4] = time->mon; buf[3] = time->day; buf[2] = time->hour; buf[1] = time->min; buf[0] = time->sec; DS1302BurstWrite(buf); } /* DS1302 初始化,如发生掉电则重新设置初始时间 */ void InitDS1302() { unsigned char dat; struct sTime code InitTime[] = { //2013 年 10 月 8 日 12:30:00 星期二 0x2013,0x10,0x08, 0x12,0x30,0x00, 0x02 }; DS1302_CE = 0; //初始化 DS1302 通信引脚 DS1302_CK = 0; dat = DS1302SingleRead(0); //读取秒寄存器 if ((dat & 0x80) != 0) //由秒寄存器最高位 CH 的值判断 DS1302 是否已停止 { DS1302SingleWrite(7, 0x00); //撤销写保护以允许写入数据 SetRealTime(&InitTime);

差不多吧

你说呢?