The._.One
Newbie level 5
- Joined
- Oct 25, 2008
- Messages
- 10
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,283
- Location
- Czech Republic
- Activity points
- 1,330
Problem with LCD
Hi, I'm using PIC and PIC C18 compler from Hi-tech. I had little problem with LCD in 8 bit mode. When i want print number it's ok, but when i want print some char i had problem.
This is library which i use:
When i write lcd8_putch('e'); I have on LCD •.
This character have same low half-byte abd upper half-byte is +4.
I have use condition for corect this, ucan see it in code above. It!s some resolution where a don't need charge 4 to upper half-byte?
Hi, I'm using PIC and PIC C18 compler from Hi-tech. I had little problem with LCD in 8 bit mode. When i want print number it's ok, but when i want print some char i had problem.
This is library which i use:
Code:
#include <htc.h>
#include "lcd8.h"
#define LCD_RS RC0
#define LCD_RW RB5
#define LCD_EN RC5
#define LCD_DATA PORTA
#define LCD_STROBE() ((LCD_EN = 1),(LCD_EN=0))
void lcd8_write(char c) {
_delay(10);
LCD_DATA = c;
LCD_STROBE();
}
void lcd8_clear(void) {
LCD_RS = 0;
lcd8_write(0x01);
_delay(500);
}
void lcd8_putch(char c) {
LCD_RS = 1;
if(c >= 0x40 && c <= 0x7f)
c+=0x40;
lcd8_write( c );
}
void lcd8_puts(const char * s) {
LCD_RS = 1;
while(*s)
lcd8_putch(*s++);
}
void lcd8_goto(char pos) {
LCD_RS = 0;
lcd8_write(0x80+pos);
}
void lcd8_init(void) {
LCD_RS = 0;
LCD_EN = 0;
LCD_RW = 0;
_delay(3750);
LCD_DATA = 0x30;
LCD_STROBE();
_delay(1250);
LCD_STROBE();
_delay(50);
LCD_STROBE();
_delay(50);
lcd8_write(0x38);
lcd8_write(0x08);
lcd8_clear();
lcd8_write(0x06);
lcd8_write(0x0C);
}
When i write lcd8_putch('e'); I have on LCD •.
This character have same low half-byte abd upper half-byte is +4.
I have use condition for corect this, ucan see it in code above. It!s some resolution where a don't need charge 4 to upper half-byte?