本帖最后由 TDB1111 于 2014-6-14 13:01 编辑
以下是我的代码:
void UpdateListView(void)
{
unsigned char i;
unsigned char str_date[10];
unsigned char str_
time[10];
unsigned char str_num[10];
char Record[3][10];
/********* date translate to string type (example : 2014-06-06) **************/
str_date[0] = Clock.Year/1000+0x30; //year first bit
str_date[1] = (Clock.Year/100)%10+0x30; //year second bit
str_date[2] = (Clock.Year%100)/10+0x30; //year third bit
str_date[3] = Clock.Year%10+0x30; //year fouth bit
str_date[4] = '-';
str_date[5] = Clock.Month/10+0x30; //month first bit
str_date[6] = Clock.Month%10+0x30; //month second bit
str_date[7] = '-';
str_date[8] = Clock.Day/10+0x30; //day fisrt bit
str_date[9] = Clock.Day%10+0x30; //day second bit
/*********** time translte to string type (example: 12:12:00) **************/
str_time[0] = Clock.Hour/10+0x30; //hour fisrt bit
str_time[1] = Clock.Hour%10+0x30; //hour second bit
str_time[2] = '-';
str_time[3] = Clock.Min/10+0x30; //minute 1 bit
str_time[4] = Clock.Min%10+0x30; //minute 2 bit
str_time[5] = '-';
str_time[6] = Clock.Sec/10+0x30; //second 1 bit
str_time[7] = Clock.Sec%10+0x30; //second 2 bit
/*********** number of student or teacher translate to string ***************/
str_num[0] = card_num;
for(i=0;i<10;i++)
{
Record[0]
= str_date;
Record[1] = str_time;
Record[2] = str_num;
}
/************* translate to Record to display in listview *******************/
for (i = 0; i < GUI_COUNTOF(Record); i++)
{
LISTVIEW_AddRow(listview, ( GUI_ConstString *)Record);
}
}
我创建了一个LISTVIEW 这个函数是用于当检测到数据是添加一行,但是这最基本的都不行:
原型:void LISTVIEW_AddRow(LISTVIEW_Handle hObj, const GUI_ConstString * ppText);
原型:void LISTVIEW_SetItemText(LISTVIEW_Handle hObj, unsigned Column,unsigned Row, const char * s);
这两个添加 数据的函数都是 const 类型,而且我使用变量 作为数据添加到行时,就进入硬件错误,不知道怎么回事?有没有好的建议,和例程呢,谢谢!
一周热门 更多>