int main(){ DI();//disable interrupts or hell breaks loose during hardware config construct_system();//bind device addresses init_system();//init devices //clear all interrupts clearall_interrupts(); EI();//enable interrupts: we have UART_recieve //set the lcd contrast //lcd_contrast(0x42); lcd_contrast(0x32); //clear the lcd clearram(); //show boot up message show_bootup(); //clear boot message clearram(); //screen layout screen_layout(); send(1, 225); send(1, 255); send(1, 2); while(1) { get_temperature1(); get_temperature2(); get_light(); get_pressure(); get_humidity(); get_soilwetness(); display(); delay_ms(800); } return 0; }
/* Nokia3310 LCD Initialization */ void initlcd(void) { RES = 1; // Set _RES HIGH. CE = 1; // Disable Chip. ES = 0; // Reset the LCD. Delay(); // Wait 100ms. ES = 1; // Awake LCD from RESET state. wrcmd(0x21); // Activate Chip and H=1. Extended instruction set mode. wrcmd(0xcf); // Set LCD Voltage to about 7V. wrcmd(0xc2); wrcmd(0x20); // Horizontal addressing and H=0. clearram(); // Erase all pixel on the DDRAM. wrcmd(0x0C); // Display Normal. pixelxy(0,0); // Cursor Home. }
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. }