Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <p18cxxx.h>
- #include <stdio.h>
- #include "LCD.h"
- #include "main.h"
- #include "delay.h"
- #pragma config OSC = INTIO67 //Internal oscillator
- #pragma config FCMEN = OFF
- #pragma config IESO = OFF
- #pragma config PWRT = ON
- #pragma config BOREN = OFF
- #pragma config WDT = OFF
- #pragma config MCLRE = OFF
- #pragma config PBADEN = OFF
- #pragma config LVP = OFF
- //User defined putc for user defined output stream
- void _user_putc(unsigned char c) {
- send_data(c);
- }
- void main() {
- OSCCON = 0b01110000; //8 MHz
- OSCTUNE = 0b01011111; //PLL is enabled, maximum frequency
- TRISC = 0x00;
- stdout = _H_USER;
- lcd_init(); //Initialize the LCD
- send_cmd(0x0C); //Turn off cursor
- set_cursor(1, 1);
- printf("Hello world!");
- send_cmd(0x40 + 0); //Set character RAM address to zero
- send_data(0b00000); //Define our first character
- send_data(0b00100);
- send_data(0b00010);
- send_data(0b11111);
- send_data(0b00010);
- send_data(0b00100);
- send_data(0b00000);
- send_data(0b00000);
- set_cursor(2, 1); //Set the display pointer to a valid position on the LCD
- send_data(0x00); //Display our first character
- while(1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement