예제 #1
0
/**
 * Prints character to LCD with support for character wrapping
 * 
 * Inputs:	db		character to print
 */
static void lcdPrint(char db) {
    if (pos==16) lcdGoTo(1, 0);
    if (pos==32) lcdGoTo(2, 0);
    if (pos==48) lcdGoTo(3, 0);
    if (pos==64) lcdGoTo(0, 0);

    lcdWrite(db, 1);
    pos++;
}
예제 #2
0
파일: user.c 프로젝트: NGenetzky/pic18_c
void print_i2c_inbuff(){
    lcdGoTo(0);
    lcd_init();
    while(!ringbuffer_is_empty()){
        lcdChar(ringbuffer_get());
    }

    print_hello_world();
}
예제 #3
0
파일: user.c 프로젝트: NGenetzky/pic18_c
void system6_LCD_RINGBUFFER(){
    if(state==1){
        SSP1CON1bits.SSPEN = 0; // 0 = Disables serial port and configures these pins as I/O port pins
        lcd_init();
        state = 2;
        
    } else if(state==2){
        lcdGoTo(0);
        if(!ringbuffer_is_empty()){
            lcdChar(ringbuffer_get()); 
        } else {
            lcdChar('N');
            lcdChar('o');
            lcdChar('n');
            lcdChar('e');
        }
        state = 3;
    } else if (state ==3){
        delay_1MSx(500);
        LATD ^= 0xFF;
        delay_1MSx(500);
        LATD ^= 0xFF;
    }
}
예제 #4
0
void println(char * string){
	clearLCD();
	lcdGoTo(0);
	Serial.println(string);
}
예제 #5
0
void println(long string){
	clearLCD();
	lcdGoTo(0);
	Serial.println(string);
}
예제 #6
0
void println(double string){
	clearLCD();
	lcdGoTo(0);
	Serial.println(string);
}
예제 #7
0
파일: main.c 프로젝트: jschisler/pic
void main(void) {
    char packet[] = {'T', 'e', 's', 't'};

    unsigned char i = 0;
    unsigned char packet_size = sizeof (packet) / sizeof (packet[0]);
    unsigned char cArray[10]
            = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'};

    // temporary local array
    unsigned char writtenArray[10];

    // local variables for all test cases and their initialisation
    unsigned char chData;
    unsigned char *pReadArray;
    unsigned char *pWriteArray;
    unsigned char j = 0;
    unsigned char i = 0;
    pReadArray = pWriteArray = writtenArray;

    /* Configure the oscillator for the device */
    ConfigureOscillator();

    /* Initialize I/O and Peripherals for application */
    InitApp();

    //  LCD test
    TRISAbits.RA2 = 0; // our chip select pin needs to be an output so that we can toggle it
    CS = 1; // set CS pin to high, meaning we are sending any information to the MCP23S17 chip

    // configure SPI: the MCP23S17 chip's max frequency is 10MHz, let's use 10MHz/64 (Note FOSC=10Mhz, our external oscillator)
    OpenSPI1(SPI_FOSC_64, MODE_10, SMPEND); // frequency, master-slave mode, sampling type
    // set LCD pins DB0-DB7 as outputs
    setIODIR(IODIRB_ADDRESS, 0x00);
    // set RS and E LCD pins as outputs
    setIODIR(IODIRA_ADDRESS, 0x00);
    // RS=0, E=0
    setGPIO(IODIRA_ADDRESS, 0x00);
    // Function set: 8 bit, 2 lines, 5x8
    lcdCommand(0b00111111);
    // Cursor or Display Shift
    lcdCommand(0b00001111);
    // clear display
    lcdCommand(0b00000001);
    // entry mode
    lcdCommand(0b00000110);

    // send characters
    lcdWriteString((unsigned char *) "Waiting..."); // using the string function
    lcdGoTo(0x40); // go to line two
    /*lcdChar('S'); // using the single character function
    lcdChar('P');
    lcdChar('I');
    lcdChar(' ');
    lcdChar('L');
    lcdChar('i');
    lcdChar('b');
    lcdChar('r');
    lcdChar('a');
    lcdChar('r');
    lcdChar('y');
*/
    ///////////////////////////////////////////////////
    /* TODO <INSERT USER APPLICATION CODE HERE> */
    /*
    while(1)
    {
        i = 0;
        
        do {
            UARTIntPutChar(packet[i++]);
        } while (i < packet_size);

        while (!vUARTIntStatus.UARTIntTxBufferEmpty);

        Delay10KTCYx(1000);
    }
     */
    TRISD = 0;
    PORTD = 0;

    while (1) {
/*
        for (j = 0; j < 100; j++) {
            i = 0;
            do {
                if (vUARTIntStatus.UARTIntTxBufferEmpty)
                    UARTIntPutChar(cArray[i++]);
            } while (i < 10);
        }
*/
        if (!(vUARTIntStatus.UARTIntRxError) &&
                !(vUARTIntStatus.UARTIntRxOverFlow) &&
                !(vUARTIntStatus.UARTIntRxBufferEmpty)) {
            if (UARTIntGetChar(&chData)) {
                PORTD = chData;
                lcdChar(chData);
            }
        }
    }
}
예제 #8
0
/**
 * Clears LCD screen 
 */
void lcdClear() {
    lcdWrite(LCD_CMD_CLEAR, 0);
	lcdBusyWait();
    delay_us(LCD_DELAY_SHORT);
    lcdGoTo(0,0);
}