示例#1
0
unsigned int vfd_readport()
{
 vfd_putc(0x1B);
 vfd_putc(0x52);
 vfd_delay(200);
 return vfd_readbyte();
}
示例#2
0
void vfd_keyboardscan()
{
 vfd_putc(0x1B);
 vfd_putc(0x55);
 vfd_putc(0x1B);
 vfd_putc(0x4B);
}
void vfd_docmd4(int8 command, char x1, char y1, char x2, char y2)
{
 vfd_putc(command);
 vfd_putc(x1);
 vfd_putc(y1);
 vfd_putc(x2);
 vfd_putc(y2);
}
示例#4
0
int main(void){
	
	_delay_ms(250);

	Vfd_ctrl vfdisplay;
	
	vfdisplay.vfd_wr_port = &PORTC;
	vfdisplay.vfd_wr_ddr = &DDRC;
	vfdisplay.vfd_wr_pin_mask = _BV(PC0);
	vfdisplay.vfd_a0_port = &PORTC;
	vfdisplay.vfd_a0_ddr = &DDRC;
	vfdisplay.vfd_a0_pin_mask = _BV(PC1);
	vfdisplay.vfd_cs_port = &PORTC;
	vfdisplay.vfd_cs_ddr = &DDRC;
	vfdisplay.vfd_cs_pin_mask = _BV(PC3);
	vfdisplay.vfd_busy_port = &PORTC;
	vfdisplay.vfd_busy_ddr = &DDRC;
	vfdisplay.vfd_busy_pin = &PINC;
	vfdisplay.vfd_busy_pin_mask = _BV(PC2);
	vfdisplay.vfd_reset_port = &PORTC;
	vfdisplay.vfd_reset_ddr = &DDRC;
	vfdisplay.vfd_reset_pin_mask = _BV(PC4);
	vfdisplay.vfd_data_port = &PORTD;
	vfdisplay.vfd_data_ddr = &DDRD;
	
	vfd_init(vfdisplay);
	vfd_putc(vfdisplay,VFD_CMD_DC5);
	
	char currentTime[] = "13:37";
	char sunriseTime[] = "14:63";
	char sunsetTime[] = "42:42";

    while(1){
		
		vfd_putcmd(vfdisplay,0x00);
		
		vfd_puts(vfdisplay,"Time: ");
		vfd_puts(vfdisplay,currentTime);
		vfd_puts(vfdisplay," Sunrise: ");
		vfd_puts(vfdisplay,sunriseTime);
		vfd_puts(vfdisplay," Sunset: ");
		vfd_puts(vfdisplay,sunsetTime);
		
		vfd_putcmd(vfdisplay,0x28);
		
		for (uint8_t i = 0; i < 40; i++){
			vfd_putc(vfdisplay,0x7F);
		}
		

		
		_delay_ms(250);
		
	}
	
}
示例#5
0
void vfd_setgraphics_macro(char id, char length, char data[])
{
  unsigned short int iy;
  vfd_putc(0x1B);
  vfd_putc(0x55);
  vfd_putc(0x1B);
  vfd_putc(id);
  vfd_putc(length+4);
  vfd_putc(VFD_CMD_SET_MODE);
  vfd_putc(VFD_CMD_MODE_HORIZ_VERT);
  vfd_putc(VFD_CMD_GRAPHIC_WRITE);
  vfd_putc(length);
  for (iy=0;iy<length;iy++) vfd_putc(data[iy]);
}
void vfd_init()
{
 output_high(VFD_SS);
 vfd_putc(0x60); // use BCD mode
 vfd_putc(0x31); // 1
 vfd_putc(0x42); // B
 vfd_putc(0x60); // use BCD mode 
 vfd_putc(0x34); // 4  
 vfd_putc(0x32); // 2 --> 0x1B 0x42 = BCD mode off
 // now we're in binary mode
 vfd_putc(0x19); // reset & clear
 vfd_putc(0x1A);         // set write mode
 vfd_putc(vfd_modebits); // set write mode
}
示例#7
0
int vfd_printf(const char *format, ...)
{
 char printbuffer[VFD_PRINTBUFFERSIZE];
 unsigned short int size;
 unsigned short int i;
 va_list ap;
 va_start(ap, format);
 size = vsnprintf(printbuffer,VFD_PRINTBUFFERSIZE,format,ap);
 for (i=0;printbuffer[i]!=0;i++) vfd_putc(printbuffer[i]);
 return size;
}
示例#8
0
void vfd_update_progressbar(
unsigned short int value)
{
  vfd_docmd4(VFD_CMD_AREA_SET,vfd_pg_x1+1,vfd_pg_y1+1,vfd_pg_x1 + 1 + (int)( vfd_pg_unit * (float)value),vfd_pg_y2 - 1);
  if (vfd_pg_percentfont) {
   vfd_putc(vfd_pg_percentfont);
   vfd_setmode(0x03);
   vfd_setcursor(vfd_pg_percentx,vfd_pg_y2-1);
   vfd_printf("%2u%%",(100 * value) / vfd_pg_maxvalue );
   vfd_setmode(0x00);
  }
}
示例#9
0
void vfd_init()
{
 IOSET = 1 << VFD_SS;
 IOSET = 1 << VFD_RES;
 vfd_putc(0x60); // use BCD mode
 vfd_putc(0x31); // 1
 vfd_putc(0x42); // B
 vfd_putc(0x60); // use BCD mode 
 vfd_putc(0x34); // 4  
 vfd_putc(0x32); // 2 --> 0x1B 0x42 = BCD mode off
 // now we're in binary mode
 vfd_putc(0x19); // reset & clear
 //vfd_putc(0x1A);         // set write mode
 //vfd_putc(vfd_modebits); // set write mode
}
void vfd_setcursor(char x, char y)
{
 vfd_putc(0x10);
 vfd_putc(x);
 vfd_putc(y);
}
void vfd_init()
{
 vfd_putc(0x19);
 vfd_putc(0x1B);
 vfd_putc(0x42);
}
void vfd_setbrightness(char value)
{
 vfd_putc(0x1B);
 vfd_putc(value + 0xF8);
}
示例#13
0
void vfd_setmode(char value)
{
 vfd_modebits = value;
 vfd_putc(0x1A);
 vfd_putc(vfd_modebits);
}
示例#14
0
void vfd_off()
{
 vfd_putc(0x1B);
 vfd_putc(0x46);
}
示例#15
0
void vfd_putstring(char *data)
{
   char start = 0;
   while (data[start]) vfd_putc(data[start++]);
}
void vfd_cls()
{
 vfd_putc(0x19);
}
示例#17
0
void vfd_on()
{
 vfd_putc(0x1B);
 vfd_putc(0x50);
}
void vfd_cursoroff()
{
 vfd_modebits ^= 0b00110000;
 vfd_putc(0x1A);
 vfd_putc(vfd_modebits);
}
void vfd_gotoxy(char x, char y)
{
 vfd_putc(0x10);
 vfd_putc(x);
 vfd_putc(y);
}