I am using the EB005 with the KS006U LCD controller on it. Now I have been trying to program it with avr studios 4. Using an ATmega234P. I have searched far and wide and have not found anything that works for me yet. So could anyone please help me? This is the code i am currently using. I made this code based on PORTA (I am trying to control it trough PORTA) and of of this earlier post http://79.99.43.2/mmforums/viewtopic.ph ... 8d7f0c55e2 The board I am using to program my Controller and LCD on, is the EB019-00-02 ATmel AVR Board
Code:
Code: Select all
#define F_CPU 1000000UL
#include <avr/io.h>
#include <util/delay.h>
#include <stdlib.h>
int lcd_high4bit, lcd_low4bit, lcd_8bit, RS;
//char character;
void LCD_RawSend(lcd_8bit, RS)
{
lcd_high4bit = ((lcd_8bit & 0xf0) >>4);
lcd_low4bit = (lcd_8bit & 0x0f);
PORTA = (lcd_high4bit << 0) | ( RS << 4);
_delay_us(100);
PORTA |= (1<<5);
_delay_us(100);
PORTA &= ~(1<<5);
PORTA = (lcd_low4bit << 0) | ( RS << 4);
_delay_us(100);
PORTA |= (1<<5);
_delay_us(100);
PORTA &= ~(1<<5);
_delay_us(100);
}
void LCD_Clear()
{
LCD_RawSend(0x01, 0); //clear display
_delay_ms(1);
LCD_RawSend(0x02, 0); //home
_delay_ms(1);
}
void LCD_Init()
{
LCD_RawSend(0x33, 0); //set to 4-bit mode
LCD_RawSend(0x32, 0); //set 4-bit mode (repeat)
LCD_RawSend(0x2c, 0); //2-line, 5x11
LCD_RawSend(0x06, 0); //move left, no display shift
LCD_RawSend(0x0f, 0); //display on, cursor on, cursor blink on.
LCD_Clear();
}
int main()
{
DDRA = 0xff;
DDRD = 0xff;
PORTD = 0xff;
_delay_ms(30);
LCD_Init();
//character = 0x41 ;
//LCD_RawSend(character, 0x10);
while (1)
{
}
return 0;
}
Thanks in advance guys!
Exulian