13th March 2009, 06:46 #1
Newbie level 4
lcd programming in c
I wrote ASM code for huge project, but it still has few bugs. So I'll try to
program it again with C language. Reazon is not working I2C communication
between two PICs (Í disscuss with that problem earlier in here).
Maybe it is easier with C ?.
I use 8 bit data for LCD with this project and E,RW,RS are routed via Altera logic chip. (I use PIC portA for addressing different IO's and PORTD is the bidirectional 8bit data). (It was working on my asm code)
Signals generated as follow:
E = 0x0a address + PORTE,2
RS = 0x0a address + PORTE,1
RW = 0x0a address + PORTE,0
I searhed many example codes at internet but almost all has 4bit data and
I don't wan't it. And all examples has those control signals connected direcly
tu PIC pin.
Question is: Do anyone find any example C-code for controlling 16x2 LCD with 8bit mode? How I should replace examples direct port pin driving to my system?
If anyone has idea how i replace to example "output_high(PIN_E0);" to my system that will help me much. Then I can countinue programming code.
In C that should be like this: But how I implement it to examples...
output_high(PIN_E1); //Set RS to data mode...
output_high(PIN_E0); //set E signal to high
13th March 2009, 06:46