Ejemplo n.º 1
0
uint8_t lcd_waitbusy() {
    __IO uint8_t c;
    //wait until the DB7 signal is gone
    while( (c=lcd_read(0)) & (1<<LCD_BUSY));

    Delay(16);

    //return address counter
    return lcd_read(0);
}
Ejemplo n.º 2
0
/*************************************************************************
loops while lcd is busy, returns address counter
*************************************************************************/
static uint8_t lcd_waitbusy(void)

{
    register uint8_t c;
    
    /* wait until busy flag is cleared */
    while ( (c=lcd_read(0)) & (1<<LCD_BUSY)) {}
    
    /* the address counter is updated 4us after the busy flag is cleared */
    delay(2);

    /* now read the address counter */
    return (lcd_read(0));  // return address counter
    
}/* lcd_waitbusy */
Ejemplo n.º 3
0
void lcd_plotpixel(unsigned char rx, unsigned char ry)
{
	unsigned char data;
	_lcd_waitbusy();
	// select the correct side
	if (rx & 64)
		lcd_selectside(RIGHT);
	else
		lcd_selectside(LEFT);
	 
	lcd_setpage( ry >> 3);
	lcd_setxaddr( rx & 0b00111111);
	data = lcd_read(); // dummy read needed here
	data = lcd_read();
	lcd_setxaddr( rx & 0b00111111);
	lcd_write (data | (1 << (ry & 0b111)));
}
Ejemplo n.º 4
0
static void lcd_waitbusy(void)
{
	register uint8_t c;
	unsigned int ul1=0;
	// Wait Until Busy Flag is Cleared
	while ( ((c=lcd_read(0)) & (1<<LCD_BUSY)) && ul1<((F_CPU/16384>=16)?F_CPU/16384:16))
		ul1++;
}
Ejemplo n.º 5
0
Archivo: lcd.c Proyecto: leckardt/glcd
uint8_t lcd_state_read(uint8_t chip)
{
	wait_while_busy(chip);
	uint8_t temp_state;
	HIGH(RW_PORT, RW_PIN);
	LOW(RS_PORT, RS_PIN);
	temp_state = lcd_read();
	return temp_state;
}
Ejemplo n.º 6
0
Archivo: lcd.c Proyecto: leckardt/glcd
uint8_t lcd_data_read(uint8_t chip)
{
	wait_while_busy(chip);
	uint8_t data;
	HIGH(RW_PORT, RW_PIN);//read
	HIGH(RS_PORT, RS_PIN);//data
	data = lcd_read();
	return data;
}
Ejemplo n.º 7
0
static uint16_t LCD_ReadDat(){
	cs::set( 0 ); 
	rs::set( 1 );
   wr::set( 1 ); 
	rd::set( 0 ); 
	int temp = lcd_read();	                                  
	rd::set( 1 ); 
	cs::set( 1 );
	return temp;   
}
Ejemplo n.º 8
0
Archivo: lcd.c Proyecto: epffpe/Atmel
static inline unsigned short rd_dat (void) {
  unsigned short val = 0;

  LCD_RS(1)
  LCD_WR(1)
  //LCD_RD(0);
  val = lcd_read();
  //LCD_RD(1);
  return val;
}
// wait for busy flag to go away
void lcd_busy_wait(void) {
	lcd_set_instruction();
	lcd_set_port_read();
	lcd_set_read();
	lcd_set_enable_on();
	LCD_DELAY;

	while (lcd_read() & LCD_GET_BF) {
		lcd_set_enable_off();
		LCD_DELAY;
		LCD_DELAY;
		lcd_set_enable_on();
		LCD_DELAY;
		LCD_DELAY;
	}

	lcd_set_enable_off();
}
// generic get
uint8_t lcd_get(uint8_t type) {
	uint8_t data;

	lcd_busy_wait();
	lcd_set_port_read();
	lcd_write(0xFF);

	if (type) {
		lcd_set_data();
	} else {
		lcd_set_instruction();
	}

	lcd_set_read();
	lcd_set_enable_on();
	LCD_DELAY;
	LCD_DELAY;
	data = lcd_read();
	lcd_set_enable_off();

	return data;
}
Ejemplo n.º 11
0
/* waits until busy flag is not set, i.e. the next instruction can be sent */
static void waitbusy(void)
{
	while (lcd_read(0) & BF_MASK)
		;
}
Ejemplo n.º 12
0
uint8_t lcd_getc(void)
{
	return lcd_read(1);
}
Ejemplo n.º 13
0
uint8_t lcd_status() {
    return lcd_read(LCD_RS_COMMAND);
} 
Ejemplo n.º 14
0
void lcd_sendstat(u8_t *x){
    for(int i = 0; x[i] != '\0'; i++){
    	RS(1); // Rs = 1
	    lcd_read(x[i]);
	}	
}
Ejemplo n.º 15
0
void lcd_senddata(unsigned char cmd){
	RS(1); // Rs = 1
    lcd_read(cmd);
}
Ejemplo n.º 16
0
void lcd_sendcmd(unsigned char cmd){
	RS(0); // Rs = 0
    lcd_read(cmd);
}
Ejemplo n.º 17
0
static uint8_t lcd_read_cmd( void )
{
    RS_DISABLE;
    return lcd_read();
}
Ejemplo n.º 18
0
static uint8_t lcd_read_data( void )
{
    RS_ENABLE;
    return lcd_read();
}