void show_bootup(void){ cursorxy(2,2); putstr((unsigned char*)"UON Physics"); cursorxy(3,1); putstr((unsigned char*)"ASK SHOW 2013"); cursorxy(4,3); putstr((unsigned char*)"e-FARMING"); cursorxy(6,3); putstr((unsigned char*)"Version 3.2"); delay_ms(2000); }
void display(void){ clear(2,4,2); clear(3,4,2); clear(4,4,2); clear(2,11,3); clear(3,11,2); clear(4,11,4); cursorxy(2,4);//set cursor //putint(light,3);//print data from adc putint(light,2); //cursorxy(2,7); putstr((unsigned char*)"%"); cursorxy(2,11); putint(humidity,3); putstr((unsigned char*)"%"); cursorxy(3,4);//set cursor putint(temp1,2);//print data from adc putstr((unsigned char*)"^"); cursorxy(3,11); putint(pressure,2); putstr((unsigned char*)"kP"); cursorxy(4,4);//set cursor putint(temp2,2);//print data from adc putstr((unsigned char*)"^"); cursorxy(4,11); if(soil<30) putstr((unsigned char*)"Wet"); else if(soil>70) putstr((unsigned char*)"Dry"); else putstr((unsigned char*)"Mid"); }
void initlcd(void) { _RES = 1; // Set _RES HIGH. _SCE = 1; // Disable Chip. _RES = 0; // Reset the LCD. DelayMs(100); // Wait 100ms. _RES = 1; // Awake LCD from RESET state. writecom(0x21); // Activate Chip and H=1. writecom(0xC2); // Set LCD Voltage to about 7V. writecom(0x13); // Adjust voltage bias. writecom(0x20); // Horizontal addressing and H=0. writecom(0x09); // Activate all segments. clearram(); // Erase all pixel on the DDRAM. writecom(0x08); // Blank the Display. writecom(0x0C); // Display Normal. cursorxy(0,0); // Cursor Home. }
void screen_layout(void){ cursorxy(1,2); putstr((unsigned char*)"e-FARMING"); cursorxy(2,1); putstr((unsigned char*)"L:"); cursorxy(3,1); putstr((unsigned char*)"T1:"); cursorxy(4,1); putstr((unsigned char*)"T2:"); cursorxy(2,8); putstr((unsigned char*)"H:"); cursorxy(3,8); putstr((unsigned char*)"P:"); cursorxy(4,8); putstr((unsigned char*)"W:"); }
void main(void) { int i; TRISD = 0b00000111; // All SCK, SDI, D_C, _SCE and _RES are output pins. initlcd(); putstr(" PCD-8544 LCD "); // A test message.... Also a new year's greeting. :) cursorxy(0,1); // Next line. putstr("Graphical Demo"); for(;;) { for(i=0;i<num_of_points;i++) { plot_pt[i] = (char)(rand() % 256); // Generate random numbers. Default is 0-255. } plotline(plot_pt, num_of_points, 255, 10, 2); // Plot the smooth(er) line graph. plotbars(plot_pt, num_of_points, 255, 10, 4); // Plot the bar graph version with the same points. // DelayS(5); // Remark this line if you want to see some really blazing fast plotting. :) } }
void clearram(void) { int ddram; cursorxy(0,0); // Cursor Home. for (ddram=504;ddram>0;ddram--) {writedata(0x00);} // 6*84 = 504 DDRAM addresses. }