I did that it doesn't use the linker from the down load it has it in it the one you said to use.Please download the zip file from the webpage which contains a fully working project.
#pragma code low_vector=0x08 // was 8x18
void low_interrupt (void)
{
_asm GOTO interrupt _endasm
}
#pragma code
#pragma interruptlow interrupt
I tried that and it still used the new one And I set the box to let me use my own. It works fine with your code change.18F1320.lkr or 18F1320i.lkr file will result in a correct executable.
#include <p18cxxx.h>
#include <stdio.h>
#include <delays.h>
#include "LCD.h"
//#pragma config OSC = INTIO67 //Internal oscillator
//#pragma config FCMEN = OFF //these are the 4 I commented out
#pragma config IESO = OFF
#pragma config PWRT = ON
//#pragma config BOREN = OFF
#pragma config WDT = OFF
#pragma config MCLRE = OFF //MCLR is disabled
//#pragma config PBADEN = OFF
#pragma config LVP = OFF
void delay1s() {
Delay10KTCYx(200);
}
//User defined putc for user defined output stream
void _user_putc(unsigned char c) {
send_data(c); //Send character to LCD
}
void main() {
OSCCON = 0b01110010; //8 MHz
TRISC = 0x00; //PORTC is all output
stdout = _H_USER; //Set to user-defined output stream via _user_putc
lcd_init(); //Initialize the LCD
send_cmd(0x0C); //Turn off cursor
set_cursor(1, 1); //Set cursor to row 1, column 1
printf("Hello!"); //Print "Hello!" to the LCD
set_cursor(2, 1); //Set cursor to row 2, column 1
printf("HD44780");
while(1) {
delay250ms(); //Scroll the display 1 character right every 250 ms
sc_r();
}
}
/*
* PIC 16F886 HD44780 LCD Driver
* Author: solarwind
* Date: 2009-01-31
* Email: x.solarwind.x@gmail.com
* Compiler: Microchip C18 (v3.22)
*
* Pin Configuration:
* The LCD's data 4 - 7 pins should be connected to bits 4 - 7,
* respectively, of any port you wish to use on your PIC.
*
* The E, R/W and RS pins can be connected to any unused port at
* any pin.
*
* My configuration is as follows:
* LCD PIC
* 16 BK-
* 15 BK+
* 14 D7 -> RC7
* 13 D6 -> RC6
* 12 D5 -> RC5
* 11 D4 -> RC4
* 10 D3
* 9 D2
* 8 D1
* 7 D0
* 6 E -> RC0
* 5 R/W -> RC1
* 4 RS -> RC2
* 3 VO
* 2 VDD
* 1 VSS
*
* Note:
* This driver is designed to work with almost any PIC 18. Be sure to
* correctly initialize your PIC, correctly connect your LCD and
* define your connections below.
*
* Note:
* DDRAM Addresses are as follows on 16 x 4 displays:
*
* Line 1: 0x00 -> 0x0F
* Line 2: 0x40 -> 0x4F
* Line 3: 0x10 -> 0x1F
* Line 4: 0x50 -> 0x5F
*
*/
#ifndef LCD_H_
#define LCD_H_
#include "main.h"
//Define your LCD's data PORT here:
#define LCD_PORT PORTC
//Define your LCD's control pins here:
#define LCD_E PORTCbits.RC0 //Enable
#define LCD_RW PORTCbits.RC1 //Read/write
#define LCD_RS PORTCbits.RC2 //Register select
void strobe(void); //Strobes the enable pin of the LCD
void send_nibble(byte b); //Send high nibble of byte b to LCD
void send_byte(byte b); //Send entire byte b to LCD via 4 bit interface
void send_cmd(byte b); //Send command to LCD
void send_data(byte b); //Send data to LCD
void set_cursor(byte row, byte col); //Set cursor position at (row, col)
void cursor_on(void); //Turn on cursor
void cursor_off(void); //Turn off cursor
void cls(void); //Clear screen
void sc_r(void); //Scroll all lines one character right
void sc_l(void); //Scroll all lines one character left
void home(void); //Send cursor to top-left position
byte b2hc(byte data); //Convert lower nibble of byte data to an ascii character
void lcd_init(void); //Initialize LCD
#endif /*LCD_H_*/
#include "LCD.h"
#include "delay.h"
void strobe() {
LCD_E = 1;
Nop();
LCD_E = 0;
Nop();
}
void send_nibble(byte b) {
LCD_PORT = (LCD_PORT & 0x0F) | (b & 0xF0);
strobe();
}
void send_byte(byte b) {
send_nibble(b); //Send high nibble
send_nibble(b << 4); //Send low nibble
}
void send_cmd(byte b) {
LCD_RS = 0; //Command mode
send_byte(b);
delay5ms();
}
void send_data(byte b) {
LCD_RS = 1; //Data mode
send_byte(b);
delay100us();
}
void set_cursor(byte row, byte col) {
byte command = 0x80;
switch(row) {
case 1:
command += col - 1;
break;
case 2:
command += 0x40 + col - 1;
break;
case 3:
command += 0x10 + col - 1;
break;
case 4:
command += 0x50 + col - 1;
break;
default:
command += col - 1;
break;
}
send_cmd(command);
}
void cursor_on() {
send_cmd(0x0E);
}
void cursor_off() {
send_cmd(0x0C);
}
void cls() {
send_cmd(0x01);
}
void sc_r() {
send_cmd(0x1E);
}
void sc_l() {
send_cmd(0x18);
}
void home() {
send_cmd(0x02);
}
byte b2hc(byte data) {
switch(data & 0x0F) {
case 0:
return '0';
case 1:
return '1';
case 2:
return '2';
case 3:
return '3';
case 4:
return '4';
case 5:
return '5';
case 6:
return '6';
case 7:
return '7';
case 8:
return '8';
case 9:
return '9';
case 10:
return 'A';
case 11:
return 'B';
case 12:
return 'C';
case 13:
return 'D';
case 14:
return 'E';
case 15:
return 'F';
}
return 0;
}
void lcd_init() {
delay100us(); //Delay for LCD to start itself up
LCD_E = 0;
LCD_RW = 0;
LCD_RS = 0;
//Start initializing the LCD
send_nibble(0x30);
delay5ms();
send_nibble(0x30);
delay5ms();
send_nibble(0x30);
delay100us();
send_nibble(0x20); //4 bit interface
delay100us();
send_cmd(0b00101000); //Function set: 4 bit interface
send_cmd(0b00001110); //Display on/off: display on, cursor on, blink off
send_cmd(0b00000110); //Entry mode: increment, no shift
send_cmd(0b00000010); //Cursor home
send_cmd(0b00000001); //Clear DDRAM/LCD
delay5ms();
}
#ifndef DELAY_H_
#define DELAY_H_
#include <delays.h>
//Required for LCD
void delay5ms(void);
void delay100us(void);
//Useful for user
void delay1s(void);
void delay250ms(void);
void delay100ms(void);
#endif /*_DELAY_H_*/
#include "delay.h"
//Required for LCD
void delay5ms() {
Delay10KTCYx(4);
}
void delay100us() {
Delay100TCYx(8);
}
//Useful for user
void delay1s() {
Delay10KTCYx(200);
Delay10KTCYx(200);
Delay10KTCYx(200);
Delay10KTCYx(200);
}
void delay250ms() {
Delay10KTCYx(200);
}
void delay100ms() {
Delay10KTCYx(80);
}
void strobe(void); //Strobes the enable pin of the LCD
//63 (below)
void send_nibble(byte b); //Send high nibble of byte b to LCD
void send_byte(byte b); //Send entire byte b to LCD via 4 bit interface
void send_cmd(byte b); //Send command to LCDio
void send_data(byte b); //Send data to LCD
void set_cursor(byte row, byte col); //Set cursor position at (row, col)
void cursor_on(void); //Turn on cursor
void cursor_off(void); //Turn off cursor
void cls(void); //Clear screen
void sc_r(void); //Scroll all lines one character right
void sc_l(void); //Scroll all lines one character left
void home(void); //Send cursor to top-left position
byte b2hc(byte data); //Convert lower nibble of byte data to an ascii character
void lcd_init(void); //Initialize LCD
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?