/* * File: newmain.c * Author: mmanno * * Created on September 30, 2013, 7:23 PM */ #include #include #include #define SPIBRG SPI3BRG #define SPIBUF SPI3BUF #define SPICLOCK TRISDbits.TRISD1 #define SPIOUT TRISDbits.TRISD3 #define CS_TRIS TRISDbits.TRISD4 #define SPIIN TRISDbits.TRISD2 #define CS LATDbits.LATD4 #define SPILCD_INT IFS0bits.SPI3RXIF unsigned char Velocity[] = {'V','e','l',':'}; unsigned char Mode[] = {'M','o','d','e',':'}; //unsigned char Test[] = {'T','e','s','t'}; //unsigned char Rest[] = {'R','e','s','t'}; //unsigned char Race[] = {'R','a','c','e'}; unsigned char Fix[] = {'F','i','x'}; unsigned char Lap[] = {'L','a','p'}; //unsigned char No[] = {'N','o'}; //unsigned char NA[] = {'N','/','A'}; //unsigned char Space[] = {' ',' '}; unsigned char Current_Lap[] = {'C','u','r','r','e','n','t',':'}; unsigned char Previous_Lap[] = {'P','r','e','v','i','o','u','s',':'}; unsigned char rps[] = {'R','P','S',':'}; void LCD_SPI_init() { SPIBRG = 85; //SCK to 59kHz //SPIOUT = 0; //MOSI output //SPIIN = 1; //MISO input //SPICLOCK = 0; //CLK output CS_TRIS = 0; //CS output int rData = SPI3BUF; SPI3CONbits.CKP = 1; SPI3CONbits.CKE = 0; SPI3CONbits.SMP=0; SPI3CONbits.MSTEN=1; SPI3CONbits.ON=1; SPILCD_INT=0; CS=1; } unsigned char LCD_snd(unsigned char info) { CS=0; SPI3BUF = info; while(!SPI3STATbits.SPIRBF); return SPI3BUF; CS=1; } delay_millisec(int input) { int i=0; while (i