void main(void) { unsigned char counter; BYTE camera_on = FALSE; BYTE camera_rec = FALSE; BYTE sw_e_prev = FALSE; BYTE sw_w_prev = FALSE; TRISA = OUTPUT; initBoard(); initLCD(); clearLCD(); backlightOn(); setCursorLCD(0,0); appendStringToLCD("The Stalker"); setCursorLCD(1, 0); appendStringToLCD("..........."); while (TRUE) { if (SW_E == PRESSED) { sw_e_prev = TRUE; } else if (sw_e_prev == TRUE) { //SW_E key up sw_e_prev = FALSE; clearLCD(); setCursorLCD(0,0); if (camera_on == TRUE) { appendStringToLCD("Shut down cam"); camera_on = FALSE; } else { appendStringToLCD("Power up cam"); camera_on = TRUE; } switchPower(); } if (SW_W == PRESSED) { sw_w_prev = TRUE; } else if (sw_w_prev == TRUE) { //SW_E key up sw_w_prev = FALSE; clearLCD(); setCursorLCD(0,0); if (camera_rec == TRUE) { appendStringToLCD("Stop rec"); camera_rec = FALSE; } else { appendStringToLCD("Start rec"); camera_rec = TRUE; } switchRec(); } delay_ms(200); } }
void printIntToLCD(int i, BYTE l, BYTE p) { // set cursor to selected position setCursorLCD(l,p); // append to this position appendIntToLCD(i); }
void printStringToLCD(char* message, BYTE l, BYTE p) { // set cursor to selected position setCursorLCD(l,p); // append to this position appendStringToLCD(message); }
void printCharToLCD(const char c, byte l, byte p) { // set cursor to selected position setCursorLCD(l,p); // append to this position appendCharToLCD(c); }
void printCharToLCD(const char c, BYTE l, BYTE p) { BYTE temp; // set cursor to selected position setCursorLCD(l,p); // append to this position appendCharToLCD(c); }
void appendCharToLCD(const char c) { if (lcd_info.pos>LCD_LASTPOS){ if (lcd_info.line) clearLCD(); else setCursorLCD(1, 0); } // Write data to LCD LCD_RW = 0; LCD_RS = 1; sendByte(c); // Write command data to data port __delay_us(45); // wait until display has processed the data lcd_info.pos++; // increment lcd cursor position }
void sendValuesPC(int device, double voltage, double current) { char sendstr[19] = ""; char volt[6]; char curr[8]; sendstr[0] = device + 0x30; sendstr[1] = 0; snprintf(volt, 6 , "%3.1f", voltage); strcat(sendstr, volt); snprintf(curr, 8, "%2.7f", current); strcat(sendstr, curr); strcat(sendstr, "\r"); putStrPC(&sendstr); setCursorLCD(0,1); writeLCD(sendstr); }
void appendCharToLCD(const char c) { unsigned temp = LCD_DATA; // Save current data on datapins for LED's if (lcd_info.pos>LCD_LASTPOS) if (lcd_info.line) clearLCD(); else setCursorLCD(1, 0); // Write char to LCD LCD_RW = 0; LCD_RS = 1; LCD_EN = 1; // Bring enable pin high temp = LCD_DATA; // Save current data on datapins for LED's LCD_DATA = c; // Write data to data port LCD_EN = 0; // data is clocked at the falling edge of enable pin LCD_DATA = temp; // restore data on datapins delay_us(45); // wait until display has processed the data lcd_info.pos++; // increment lcd cursor position }
void clearLCD(void) { commandLCD(0b00000001); delay_ms(2); setCursorLCD(0,0); }