void main() { memset(sell,0,sizeof(sell)); ReadDat(); SortDat(); WriteDat(); }
//-------------------------------------------------------------- // Prototype : void OLED_ShowCN(unsigned char x, unsigned char y, unsigned char N) // Calls : // Parameters : x,y -- 起始点坐标(x:0~127, y:0~7); N:汉字在codetab.h中的索引 // Description : 显示codetab.h中的汉字,16*16点阵 //-------------------------------------------------------------- void OLED_ShowCN(unsigned char x, unsigned char y, unsigned char N) { unsigned char wm=0; unsigned int adder=32*N; OLED_SetPos(x , y); for(wm = 0;wm < 16;wm++) { WriteDat(F16x16[adder]); adder += 1; } OLED_SetPos(x,y + 1); for(wm = 0;wm < 16;wm++) { WriteDat(F16x16[adder]); adder += 1; } }
/** * @brief OLED_ShowStr,显示codetab.h中的ASCII字符,有6*8和8*16可选择 * @param x,y : 起始点坐标(x:0~127, y:0~7); * ch[] :- 要显示的字符串; * TextSize : 字符大小(1:6*8 ; 2:8*16) * @retval 无 */ void OLED_ShowStr(unsigned char x, unsigned char y, unsigned char ch[], unsigned char TextSize) { unsigned char c = 0,i = 0,j = 0; switch(TextSize) { case 1: { while(ch[j] != '\0') { c = ch[j] - 32; if(x > 126) { x = 0; y++; } OLED_SetPos(x,y); for(i=0;i<6;i++) WriteDat(F6x8[c][i]); x += 6; j++; } }break; case 2: { while(ch[j] != '\0') { c = ch[j] - 32; if(x > 120) { x = 0; y++; } OLED_SetPos(x,y); for(i=0;i<8;i++) WriteDat(F8X16[c*16+i]); OLED_SetPos(x,y+1); for(i=0;i<8;i++) WriteDat(F8X16[c*16+i+8]); x += 8; j++; } }break; } }
void main() { int i ; system("cls") ; for(i = 0 ; i < MAXNUM ; i++) xx[i] = 0 ; if(ReadDat()) { printf("数据文件IN58.DAT不能打开!\007\n"); return; } Calvalue() ; printf("文件IN58.DAT中共有正整数=%d个\n", totNum) ; printf("符合条件的正整数的个数=%d个\n", totCnt) ; printf("平均值=%.2lf\n", totPjz) ; WriteDat() ; }
/** * @brief OLED_Fill,填充整个屏幕 * @param fill_Data:要填充的数据 * @retval 无 */ void OLED_Fill(unsigned char fill_Data)//全屏填充 { unsigned char m,n; for(m=0;m<8;m++) { WriteCmd(0xb0+m); //page0-page1 WriteCmd(0x00); //low column start address WriteCmd(0x10); //high column start address for(n=0;n<128;n++) { WriteDat(fill_Data); } } }
void main() { int i; clrscr(); puts(" This program is to deal with the number from file."); puts(" >> The results are:"); for(i=0;i<MAX;i++)xx[i]=0; if(ReadDat()) { printf(" Can't open data file IN182.DAT!\007\n"); return; } Compute(); printf(" There are %d odds.\n There are %d evens.\n The average value of all the odds is %lf.\n The average value of all the evens is %lf.\n The variance of the odds is %lf.\n",odd,even,ave1,ave2,totfc); WriteDat(); PressKeyToQuit(); }
/** * @brief OLED_DrawBMP,显示BMP位图 * @param x0,y0 :起始点坐标(x0:0~127, y0:0~7); * x1,y1 : 起点对角线(结束点)的坐标(x1:1~128,y1:1~8) * @retval 无 */ void OLED_DrawBMP(unsigned char x0,unsigned char y0,unsigned char x1,unsigned char y1,unsigned char BMP[]) { unsigned int j=0; unsigned char x,y; if(y1%8==0) y = y1/8; else y = y1/8 + 1; for(y=y0;y<y1;y++) { OLED_SetPos(x0,y); for(x=x0;x<x1;x++) { WriteDat(BMP[j++]); } } }