示例#1
0
char lcd_getc() {
   char value;

    //lcd_gotoxy(x,y);
    while ( bit_test(lcd_read_byte(),7) ); // wait until busy flag is low
    lcd_rs=1;
    value = lcd_read_byte();
    lcd_rs=0;
    return(value);
}
示例#2
0
char lcd_getc(BYTE x, BYTE y)
{
   char value;

   lcd_gotoxy(x,y);
   while ( bit_test(lcd_read_byte(),7) ); // wait until busy flag is low
   lcd_output_rs(1);
   value = lcd_read_byte();
   lcd_output_rs(0);
   
   return(value);
}
示例#3
0
int8 lcd_getc(int8 x, int8 y){
	int8 value;

	lcd_gotoxy(x,y);

	while((lcd_read_byte()&0x80)==0x80);

	RSPIN=1;
	value = lcd_read_byte();
	RSPIN=0;

	return(value);
}
示例#4
0
char lcd_getc(char x, char y) 
{ 
	char value; 
	
	lcd_gotoxy(x,y); 
	
	// Wait until busy flag is low. 
	while(bit_test(lcd_read_byte(),7));  
	
	output_high(LCD_RS); 
	value = lcd_read_byte(); 
	output_low(lcd_RS); 
	
	return(value); 
} 
示例#5
0
//---------------------------------------- 
// Send a byte to the LCD. 
void lcd_send_byte(char address, char n) 
{ 
	output_low(LCD_RS); 
	
	#ifdef USE_LCD_RW 
	while(bit_test(lcd_read_byte(),7)) ; 
	#else 
	delay_us(60);  
	#endif 
	
	if(address) 
	   output_high(LCD_RS); 
	else 
	   output_low(LCD_RS); 
	      
	 delay_cycles(1); 
	
	#ifdef USE_LCD_RW 
	output_low(LCD_RW); 
	delay_cycles(1); 
	#endif 
	
	output_low(LCD_E); 
	
	lcd_send_nibble(n >> 4); 
	lcd_send_nibble(n & 0xf); 
} 
示例#6
0
int lcd_set_pixel( struct lcd_pixel * pix )
{
	int y=0;
	int val;
	int bit=0;
	int v;

	if ( pix->y >= (LCD_ROWS*8) ) {
		return -EINVAL;
	}

	if ( pix->x >= LCD_COLS ) {
		return -EINVAL;
	}

	if (pix->y) {
		y = (pix->y/8);
	}

	bit = pix->y - (y*8);

	// set dram pointer
	lcd_set_pos( y, pix->x );
	lcd_read_dummy();

	val = lcd_read_byte();

	v = pix->v;

	// invertieren
	if ( v == 2 ) {
		v = (((~val)>>bit)&1);
	}
示例#7
0
static inline int check_busy_flag()
{
	CLR_RS;
	SET_RW;
	DATA_IN;
	return lcd_read_byte() & (1<<7);
}
示例#8
0
void lcd_send_byte(int8 address, int8 n){

	RSPIN=0;

#ifdef USE_RW
	while((lcd_read_byte()&0x80)==0x80);
#else
	_delay_100us();
#endif

	TRIS_DATA_PIN_4=0;
	TRIS_DATA_PIN_5=0;
	TRIS_DATA_PIN_6=0;
	TRIS_DATA_PIN_7=0;

	if(address)
		RSPIN=1;
	else
		RSPIN=0;

	Nop();

#ifdef USE_RW
	RWPIN=0;
	Nop();
#endif

	lcd_send_nibble(n >> 4);
	lcd_send_nibble(n & 0xf);
}
示例#9
0
char lcd_getc( byte x, byte y) {
   char value;

    lcd_gotoxy(x,y);
    lcd.rs=1;
    value = lcd_read_byte();
    lcd.rs=0;
    return(value);
}
示例#10
0
static void lcd_wait_busy(void)
{
	uint8_t bt;
	LCD_CTRL_PORT &= ~(1 << LCD_CTRL_RS);
	_delay_us(10);
	do {
		bt = lcd_read_byte();
	} while (bt & 0x80 == 0x80);
}
示例#11
0
void lcd_send_byte(BYTE address, BYTE n)
{
   lcd_output_rs(0);
   while ( bit_test(lcd_read_byte(),7) ) ;
   lcd_output_rs(address);
   delay_cycles(1);
   lcd_output_rw(0);
   delay_cycles(1);
   lcd_output_enable(0);
   lcd_send_nibble(n >> 4);
   lcd_send_nibble(n & 0xf);
}
void lcd_send_byte( BYTE address, BYTE n ) {

      lcd.rs = 0;
      while ( bit_test(lcd_read_byte(),7) ) ;
      lcd.rs = address;
      delay_cycles(1);
      lcd.rw = 0;
      delay_cycles(1);
      lcd.enable = 0;
      lcd_send_nibble(n >> 4);
      lcd_send_nibble(n & 0xf);
}
示例#13
0
void dsp_strength_bar( int8 end_signal_char_index,
						int8 width, int8 value ) 
{
	int8 mark_pos = value/STRENGTH_VALUES_PER_CHAR;
	int8 mark_glyph = value-(mark_pos*STRENGTH_VALUES_PER_CHAR);
	
	lcd_output_rs(0);
	int8 current_address = lcd_read_byte() & 0x7F;
	
	dsp_create_signal_character( end_signal_char_index, mark_glyph );
	
	lcd_send_byte( 0, 0x80|current_address );	//Restore DDRAM address
	
	int8 i;
	for( i=0; i<mark_pos; ++i ) {
		lcd_putc(CHAR_FULL_STRENGTH);
	}
	if ( mark_pos != width ) {
		lcd_putc(end_signal_char_index);
	}
	for( i=mark_pos+1; i<width; ++i ) {
		lcd_putc(' ');
	}
}
示例#14
0
/*
 * Display a range bar with:
 *	- 3 possibles values per position in mid characters
 *	- 2 possibles values per position in start and end characters
 * Note: Only one range line is allowed.
 */
void dsp_range_line( int8 start_char_index, 
					int8 mid_char_index, 
					int8 end_char_index, 
					int8 width, int16 value, 
					int16 max_value ) 
{
	int8 range_positions = (3*(width-2)) + 2 + 2;
	int8 mark = math_change_range(value, max_value, range_positions);
	
	int8 start_glyph;
	int8 end_glyph;
	int8 mark_glyph;
	int8 mark_pos;
	if ( mark < 2 ) {							//Mark at start range
		mark_pos = 0;
		mark_glyph = 0xFF;
		start_glyph = mark;
		end_glyph = 2;
	}
	else if ( mark > (range_positions-2) ) {	//Mark at end range
		mark_pos = 0;
		mark_glyph = 0xFF;
		start_glyph = 2;
		end_glyph = (range_positions-mark);
	}
	else if ( mark == (range_positions-2) ) {	//Mark just before end range
		mark_pos = 0;
		mark_glyph = 0xFF;
		start_glyph = 2;
		end_glyph = 1;
	}
	else {										//Mark at mid range
		mark -= 2;
		mark_pos = mark/3;
		mark_glyph = mark-(mark_pos*3);
		start_glyph = 2;
		end_glyph = 2;
	}
	
	lcd_output_rs(0);
	int8 current_address = lcd_read_byte() & 0x7F;
	
				// Set glyphs
	dsp_write_mid_glyph( start_char_index, 
								CHAR_START_RANGE_MID_GLYPH[start_glyph] );
	dsp_write_mid_glyph( end_char_index, 
								CHAR_END_RANGE_MID_GLYPH[end_glyph] );
	if ( mark_glyph != 0xFF ) {
		dsp_write_mid_glyph( mid_char_index, 
									CHAR_RANGE_POSITION_GLYPH[mark_glyph] );
	}
	
	lcd_send_byte( 0, 0x80|current_address );	//Restore DDRAM address
	
				// Write range line
	int8 i;
	lcd_putc(start_char_index);
	for( i=0; i<mark_pos; ++i ) {
		lcd_putc('-');
	}
	lcd_putc( (mark_glyph==0xFF) ? '-' : mid_char_index);
	for( i=mark_pos+1; i<(width-2); ++i ) {
		lcd_putc('-');
	}
	lcd_putc(end_char_index);
}