Example #1
0
int main (void)
{
	
	LCD_init();
	LCD_init();
	LCD_print("START");
	
	

	for (;;)
	{
		//_delay_ms(1000);							/* Delay 1000ms for things to settle down */
		
		//if (pf_mount(&Fs)) 
		//{	
		//	continue;	/* Initialize FS */
		//}
		
		
		//if (pf_opendir(&Dir,"music")) break;		/* Open /music folder (for task1) */
		//if (pf_opendir(&Dir,"speech")) break;		/* Open /speech folder (for task2) */
			
		while(1) 
		{
			//task1();
			//task2();
			LCD_print("test");
		}
	}
	
	return 1;
}
Example #2
0
/*  display_start - start display on LCD
*/
void display_start(frame_buffer_t *frame_buffer)
{
	unsigned char *fb = frame_buffer->fb;
	int column_max = frame_buffer->column_max;

	LCD_init();

	fb_write_char(0,5,"NOKIA 5110", fb, column_max);
 	sprintf(title, "Description: chenchachan - Copyright (c) 2013, chenchacha");
 	fb_write_char(1,0,title, fb, column_max); 

/* 	fb_negation_dollop(0,0,83,47,fb,column_max);
 */
/* 	display_boxes(frame_buffer); */ 

	LCD_draw_frame_buffer(0,0,fb, column_max);

	LCD_draw_dollop(0,0,83,47);
#if 0
	LCD_draw_point(30,25);
	/* write a boxes */
	LCD_draw_dollop(25,48,0,0);
	LCD_draw_dollop(25,25,0,84);
	LCD_draw_dollop(48,48,0,84);
	LCD_draw_dollop(25,48,84,84);
#endif
}		/* -----  end of function display_start  ----- */
Example #3
0
int main(void)
{
LCD_init();
LCD_clear();
while(1)
{
uchar i;
LCD_write_english_string(3,0,"WXJ_PCR");
LCD_write_english_string(0,2,"TIME=");
LCD_write_num(5,2,31,2);
LCD_write_english_string(7,2,":");
LCD_write_num(8,2,43,2);
LCD_write_english_string(0,4,"NOW TEMP=");
LCD_write_english_string(0,3,"AIM TEMP=");
LCD_write_num(9,3,97,2);
LCD_write_english_string(11,4,".");
LCD_write_english_string(0,5,"COUNT=");
LCD_write_num(6,5,13,2);
LCD_write_english_string(8,5,":");
LCD_write_num(9,5,35,2);
temp = get_tmp();
sendchangecmd();
for(i=0;i<40;i++)
{
display(temp);
}

}
}
Example #4
0
int main(void)
{             
  char c;			// odebrany znak
  UART_init();			// inicjalizacja portu szeregowego
  LCD_init();			// inicjalizacja wy�wietlacza LCD
  LCD_PL_chars_init();		// polskie znaki na wy�wietlaczu LCD
  KBD_init();			// inicjalizacja klawiatury
  LED7SEG_init();		// inicjalizacja wy�wietlacza
  sei();                       	// w��cz obs�ug� przerwa�

  while(1)			// p�tla niesko�czona
  {
    PCF8583_get_time(&godz,&min,&sek,&ssek);

    LED7SEG_putU08(sek);	// wy�wietlaj warto�� 

    if (UART_rxlen()>0)	// je�li odebrano znak
    {
      c=UART_getchar();
    	// tu mo�na wstawi� reakcje na komendy steruj�ce np. typu ESC[
      LCD_putchar(c);		// wy�wietl go na LCD
    }
    if (KBD_read())		// je�li naci�ni�to klawisz
    {
      if ((KBD_ascii>='A')&&(KBD_ascii<='D'))
        UART_putstr_P(CURSOR);	// sterowanie kursorem
      UART_putchar(KBD_ascii);	// wy�lij go na port szeregowy
      KBD_wait();		// czekaj na zwolnienie klawisza
    }
  }
}
/*
 * main.c
 */
void main() {
	init_pins();
	init_button();
	init_adc();
	init_wdt();
	WDT_delay = CURRENT_DELAY;

 	BCSCTL1 = CALBC1_8MHZ;
	DCOCTL =  CALDCO_8MHZ;

	LCD_setup();
	_bis_SR_register(GIE);	// enable interrupts
	// initialize LCD and say hello a few times :-)
	LCD_init();

	LCD_send_string((char*)msg);

	while(1){
		LCD_put(0x80+40); // cursor to line 2, first position
		snprintf(hex, 20, HEX, (int)colourArray[1], (int)colourArray[2], (int)colourArray[0]);
		LCD_send_string(hex);
	}

	_bis_SR_register(LPM0_bits);

	//delay(0); // maximum delay



}
Example #6
0
void main (void)
{
	//init LCD
	LCD_init();
	//set TWBR = 32 for 100kHz SCL @ 8MHz
	TWI_init(32, 0);
	
	//write 0x55 @ 513 and print return value on LCD
	LCD_puthex(EE_write_byte(513, 0x55));
	//send stop
	TWI_stop();
	LCD_wait();
	LCD_putchar(' ');
	//wait for the EEPROM to finish the write operation
	TWI_wait(EE_ADDR);
	//read the write location again and print return code on LCD
	LCD_puthex(EE_read_byte(513));
	LCD_wait();
	LCD_putchar(' ');
	//print the value read from the EEPROM on the LCD
	LCD_puthex(TWDR);
	TWI_stop();
	//LCD should now show "0x00 0x00 0x55_"
	//where the _ is the blinking cursor.
}
Example #7
0
int main (void)
{

	DIO_init();

	LCD_init();
	LCD_gotoxy(1,1);
	printf("AVR ADC Tutorial");
	LCD_gotoxy(1,2);

	ADC_init();
	ADC_Configure_Reference(VREFERENCE_VALUE);
	ADC_Configure_PRESCALAR(PRESCALAR_VALUE);
	ADC_Enable();
	ADC_start();

	while(1)
	{
		LCD_gotoxy(1,2);
		adc_read=ADC_read_8bits(ADC0);
		printf("%d",adc_read);
		printf ("                  " );
		TO_DELAY(500);
	}

	return(0);

}
Example #8
0
int
main(void)
{
  uint16_t ui1;

  LCD_init();
  i2cInit();
  Timer_Init();
  KbdInit();

  LCD_busy
  LCD_CLRSCR

  LCD_WR_LINE(0, 0, "Starting!!!");
  for (ui1=0; ui1<0x3F; ui1++)
    LCD_busy;

  LCD_WR_LINE(0, 0, "Press any key!!!");
  LCD_WR_LINE(1, 0, "Shall displayed!");
  KBD_RESET_KEY;
  while (1) {
    KBD_GET_KEY;
    LCD_POS(1, 0);
    LCD_WR("Scan Code : ");
    LCD_PUT_UINT8X(KbdData);
    for (ui1=0; ui1<0xFF; ui1++)
      {}
    KBD_RESET_KEY;
  }

  return 0;
}
Example #9
0
int main(void)
{
	//---- PORT Initializations -----
	DDRB = 0xFF; PORTB = 0x00;
	DDRA = 0x00; PORTA = 0xFF;
	DDRC = 0xFF; PORTC = 0x00; //used for LCD display
	DDRD = 0xFF; PORTD = 0x00; //used for LCD display
	
	// --- Function Initializations ---
	TimerSet(5);
	TimerOn();
	PWM_on();
	initUSART();
	setCustomCharacters();
	LCD_init();

	//---if eeprom address was not initialized----
	if(eeprom_read_byte((uint8_t*)46) == 0xFF)
		eeprom_write_byte((uint8_t*)46 , 0);
		
	//----load old high score saved in EEPROM----
	currHighScore = eeprom_read_byte((uint8_t*)46);
	
	gameStatus = 0;
	soundStatus = 0;
	lcdTick();
	
	while(1){	
		mainTick();
		playSound();
		while(!TimerFlag);
		TimerFlag = 0;
	}
}
Example #10
0
int lcdDisplayTick(task* t){

	//actions	
	switch(t->state){
		case lcd_init:
			LCD_init();							//initialize LCD
			LCD_ClearScreen();					//clear screen of any artifacts
			break;
		case s1:
			//LCD_ClearScreen();					//clear screen of any artifacts
			LCD_DisplayString(1,motionSensorMsg);	//display motion sensor message
			break;
		default:
			break;
	}

	//transitions
	switch(t->state){
		case lcd_init:
			t->state = s1;
			break;
		case s1:
			t->state = s1;
			break;
		default:
			break;
	}
}
Example #11
0
void main()
{
	volatile char a, b, r;
	LCD_init();
  a = 3;
  b = 3;
	r = a * b;
	LCD_wr(r + ZERO);  // print 9
	LCD_wr(SPACE);
  
  a = 2;
  b = 3;
  r = a * b;
	LCD_wr(r + ZERO);  // print 6
	LCD_wr(SPACE);	

  a = 1;
  b = 3;
  r = a * b;
	LCD_wr(r + ZERO);  // print 3
	LCD_wr(SPACE);	
	
  a = 0;
  b = 3;
  r = a * b;
	LCD_wr(r + ZERO);  // print 0
	LCD_wr(SPACE);
}
void init(void) {
    pin_init();
    timer_init();
    LCD_init();
    // eventually should read and save to eeprom.
    Keypad_init_static();
}
Example #13
0
int main(){

#ifndef TESTING

#include "uart.h"
#include "mmc.h"

	// Initializam modulele hardware

	uart_init();
	SPI_init();
	MMC_init();
	BTN_init();
	LCD_init();
#endif
	/* Gaseste prima partitie FAT32 de pe card*/
	init_partition(buffer);

	/**
	  * Gaseste datele despre sistemul de fisiere :
	  * nr de tabele FAT, cluster-ul directorului Root, etc.
	  */
	initFAT32(buffer);
	print_volid(buffer);

	LCD_str( "  ", 0);
	LCD_str( "  ", 0);
	LCD_str( "  Welcome to", 0);
	LCD_str( " MMC Explorer", 0);
	_delay_ms(2500);
	LCD_clear();
	printdirs(openroot());
	return EXIT_SUCCESS;
}
Example #14
0
int main( void )
{
  LCD_init();
  LCD_write("Hello World");
  LCD_command(LCD_LINE2 | 5); // move cursor  to row 2, position 5 
  LCD_write("is here");
}
Example #15
0
void main(){
	Output_low(LCD_RW); //Che do ghi 
	LCD_init(); //Khoi tao LCD

	lcd_putcmd(0x01);
	delay_ms(100);
	printf(lcd_putchar,"Nhiet do: ");
	while (true){
		i2c_start();   //Tao dieu kien start de giao tiep
		//Dia chi thiet bi I2C(tra trang 9 cua Datasheet) sau khi da them bit 0 vao
		//0x48 (1001000 them bit 0 vao 10010000 = 0x90
		i2c_write(0x90); 
		i2c_write(0x00); //Gui lenh yeu cau doc nhiet do
		i2c_start();   //Tao lai dieu kien start
		//Dia chi thiet bi I2C(tra trang 9 cua Datasheet) sau khi da them bit 1 vao
		//0x48 (1001000 them bit 1 vao 10010001 = 0x91
		i2c_write(0x91); //Thiet bi chu yeu cau duoc doc du lieu cua thiet bi to
		temp = i2c_read(0); //Gui lenh doc gia tri nhiet do
		i2c_stop();      //Tao dieu kien Stop, ket thuc giao tiep
		LCD_SetPosition(0x09);
		printf(lcd_putchar,"%u",temp); //Hien thi nhiet do doc duoc len LCD 
		lcd_putchar(223);
		printf(lcd_putchar,"C");
		delay_ms(1000);
	}
}
Example #16
0
void main(void) {
//  volatile 
  volatile char ch = 48; //0x30
//  volatile 
  volatile unsigned char i = 0;
  volatile unsigned char j = 0;
  
  LCD_init();
  for (ch = 48; ch<=57; ch++)
  {
    LCD_wr(ch);
    for (i=0;i<255;i++) 
      for (j=0;j<255;j++) 
      {
        __asm
          LOAD sF, sF
          LOAD sF, sF
          LOAD sF, sF
          LOAD sF, sF
          LOAD sF, sF
          LOAD sF, sF
          LOAD sF, sF
          LOAD sF, sF
          LOAD sF, sF
          LOAD sF, sF
          LOAD sF, sF
          LOAD sF, sF
          LOAD sF, sF
          LOAD sF, sF
        __endasm;
      }
      
  }
}
Example #17
0
int main(void)
//   Input    : -
//   Output   : -
//   Function : main function. Runs the init function and then loops


{
    //Initialization
    disable_global_int();
    SysTick_init();
    GPIO_init();
    swtimers_init();
    RTCS_init();

    UART0_init(19200, 8, 1, 0);
    enable_global_int();
    LCD_init();
    queue_init(&display_lcd_queue);
    queue_init(&uart0_rx_queue);
    numpad_init();

    open_queue(Q_LCD);
    open_queue(Q_INPUT);

    start_task( TASK_RTC, RTC_task);
    start_task( TASK_DISPLAY, display_task);
    start_task( TASK_LCD, LCD_task);
    start_task( TASK_NUMPAD, numpad_task);
    start_task( TASK_UI, ui_task);
    start_task( TASK_UART0, UART0_task);

    schedule();

    return (0);
}
Example #18
0
//**************************************************************
// ****** MAIN FUNCTION FOR MIDI PROJECT ***********************
//**************************************************************
//Controller: ATmega644 (Clock: 8 Mhz-internal)
//Compiler: AVR-GCC (Ubuntu cross-compiler avr-g++ -v4.8.2)
//**************************************************************


#define F_CPU 8000000UL
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "SPI_routines.h"
#include "SD_routines.h"
#include "FAT32.h"
#include "LCD_driver.h"
#include "menucontrol.h"

const unsigned char sdcardtesting[] PROGMEM ="  SD Card Testing..  ";
const unsigned char sdcardnotdectect[] PROGMEM ="SD card not detected..";
const unsigned char initilfail[] PROGMEM ="Card Initialization failed..";
const unsigned char sdv1_1[] PROGMEM ="Standard Capacity Card";
const unsigned char sdv1_2[] PROGMEM ="(Ver 1.x) Detected!";
const unsigned char sdhc_1[] PROGMEM ="High Capacity Card";
const unsigned char sdhc_2[] PROGMEM ="Detected!";
const unsigned char sdv2_1[] PROGMEM ="Standard Capacity Card";
const unsigned char sdv2_2[] PROGMEM ="(Ver 2.x) Detected!";
const unsigned char unknown_1[] PROGMEM ="Unknown SD Card Detected";
const unsigned char unknown_2[] PROGMEM ="Press OK key to continue";
const unsigned char fat32notfound[] PROGMEM ="FAT32 not found!";

//***********************************************************************************/
//call this routine to initialize LCD and SPI for SD card							 /
//***********************************************************************************/
void init_devices(void)
{
  cli();  //all interrupts disabled
  LCD_init();
  spi_init();
  MCUCR = 0x00;
 TIMSK1 = 0x00; //timer interrupt sources
}
Example #19
0
void LCD_Welcome(void) {
    unsigned char i;

    LCD_init();

    LCD_write_string_rom(" Welcome to  JH       1.1.      ");
    //LCD_write_string_rom("      1.0.      ");
}
Example #20
0
File: main.c Project: bgbock/rdmp
 int main (void)
  {
  init_hw();
  LCD_init();
  SR_DAT_IN;
  while (1)
  	{
	uart_sendchar('A');
	uart_sendstr("0123456789abcdef");
 // 	dly_ms(40);
  	if (rcvd_flag)
  		{
  		rcvd_flag=0;
  		uart_sendstr("R:");
  		if (f_gsm_ok)
  			{
  			f_gsm_ok=0;
  			uart_sendstr("G_OK");
  			}
  		if (f_gsm_nc)
  			{
  			f_gsm_nc=0;
  			uart_sendstr("G_NC");
  			}
  		if (f_gsm_cr)
  			{
  			f_gsm_cr=0;
  			uart_sendstr("G_CR");
  			}
  		if (f_gsm_ring)
  			{
  			f_gsm_ring=0;
  			uart_sendstr("G_RI");
  			}
  		uart_sendstr("\r\n");
  		}


  	keys = read_keys();

  	if (keys==0x01) 		update_lcd("K1");
  	else if (keys==0x02) 	update_lcd("K2");
  	else if (keys==0x04) 	update_lcd("K3");
  	else if (keys==0x08) 	update_lcd("K4");
  	else if (keys==0x10) 	update_lcd("K5");
  	else if (keys==0x20) 	update_lcd("K6");
  	else if (keys==0x40) 	update_lcd("K7");
  	else if (keys==0x00) 	update_lcd("0123456789ABCDEF");
  	else update_lcd("Kx");
/*
	if (keys_handling(&key))
		{
		keys = key;
		}
*/
  	}
  }
Example #21
0
/*!
 * \brief Function Hw_init sets basic HW configuration
 */
void Hw_init(void)
{      
	SHIFT_DDR |= _BV(SHIFT_LED_SET_DDR);	/* parallel write -> output pin */
	SHIFT_DDR |= _BV(SHIFT_CLK_DDR);	/* serial clock -> output pin */
	SHIFT_DDR |= _BV(SHIFT_OUT_DDR);	/* serial data stream -> output pin */ 
	SHIFT_DDR |= _BV(SHIFT_LCD_SET_DDR);	/* parallel write -> output pin */

        LCD_init();                             /* Init LCD display */
}
Example #22
0
int lcdDisplayTick(task* t){

	//actions	
	switch(t->state){
		case lcd_init:
			LCD_init();							//initialize LCD
			LCD_ClearScreen();					//clear screen of any artifacts
			break;
		case s1:
			//LCD_ClearScreen();					//clear screen of any artifacts
			//LCD_DisplayString(1,motionSensorMsg);	//display motion sensor message
			
				LCD_Cursor(14);
				
				if(fanMode)
				{
				    LCD_WriteData(1);
			    }
			    else if(led_fan && !kill && enable && temp)
			    {
			        LCD_WriteData(2);
			    }
			    else
			    {
			        LCD_WriteData(' ');
			    }
			    
				LCD_Cursor(12);
			    
			    if(enable)
			    {
			        LCD_WriteData(3);
			    }
			    else
			    {
			        LCD_WriteData(4);
			    }
			
			break;
		default:
			break;
	}

	//transitions
	switch(t->state){
		case lcd_init:
			t->state = s1;
			break;
		case s1:
			t->state = s1;
			break;
		default:
			break;
	}
	
	return 0;
}
void main() {

    LCD_port_init();
    LCD_init();
    place_lcd_cursor(0,0);
    LCD_writeChar('h');


    //InitTimer0();
   // TRISDbits.RD3 = 1;

    while(1)
    {
        /*
        for(int i = 0; i < 8; i++)
        {
            binaryCount[i] = '0';
            intCount[i] = ' ';
        }

        char temp = display;
        int j = 7;
        while(temp > 0)
        {
            intCount[j] = temp % 10 + 0b00110000;
            temp /= 10;
            j--;
        }

        temp = display;
        j = 7;
        while(temp > 0)
        {
            binaryCount[j] = temp % 2 + 0b00110000;
            temp /= 2;
            j--;
        }


        if(PORTDbits.RD3 == 0)
        {
           display = TMR0;
           Delay100ms();
           while(PORTDbits.RD3 == 0);
           Delay100ms();
        }

           place_lcd_cursor(0,1);
           LCD_write(intCount);
           place_lcd_cursor(0,0);
           LCD_write(binaryCount);

         Delay100ms();
         */
    }
}
void APP_init()
{
	/* Initialize LCD Driver */
	LCD_init();
	LCD_clear(); /*clear LCD at the beginning */
	LCD_sendString("Temp = ");
	LCD_goToRowColumn(0,10);
	LCD_sendData('C');
	SENSOR_init();
}
Example #25
0
int main(void)
{
    /* Call board init functions. */
    Board_initGeneral();
    Board_initGPIO();
    // Board_initI2C();
    // Board_initSDSPI();
    // Board_initSPI();
    // Board_initUART();
    // Board_initWatchdog();

    Clock_Params clockParams;
    Clock_Handle myClock;
    Error_Block eb;
    Task_Handle task0;

    Task_Params taskParams;
    Task_Params_init(&taskParams);

    int j;
    for(j=0; j<17; j++) {
    	buff1[j] = ' ';
    	buff2[j] = ' ';
    }
    Error_init(&eb);
    Clock_Params_init(&clockParams);
    clockParams.period = 100;
    clockParams.startFlag = TRUE;
    myClock = Clock_create(LCD_print, 10, &clockParams, &eb);
    if(myClock == 0)
    {
    	System_abort("F****n clock");
    }

    LCD_init();

    task0 = Task_create(heartBeatFxn, &taskParams, &eb);
   // sample_screen();F
    /* Turn on user LED */
    GPIO_write(Board_LED0, Board_LED_ON);



    System_printf("Starting the example\nSystem provider is set to SysMin. "
                  "Halt the target to view any SysMin contents in ROV.\n");

    //GPIO_write(4,1);
    /* SysMin will only print to the console when you call flush or exit */
    System_flush();

    /* Start BIOS */
    BIOS_start();

    return (0);
}
Example #26
0
int xmitTest(void){
    // initialize strings
    char* myname;
    myname = "Ashley Towne";
    serial_init(9600);

    // initialize LCD
    LCD_init();
    LCD_display_on();
    set_output_device(2); // select LCD as output

    // output to LCD
    LCD_clear();
    LCD_setpos(0,0);
    printf("%s",myname);
    LCD_setpos(1,0);

    // output to terminal
    set_output_device(1); // select UART as output device
    printf("This goes to terminal\n"); // write to the screen
    printf("%s\n", myname);
    // loop
    int foo = 0;
    unsigned char mystr;
    int ctr = 0;
    while(ctr<10)
    {
        ctr = ctr + 1;
        if (foo==0){mystr='0';}
        else if(foo==1){mystr = '1';}
        else if(foo==2){mystr = '2';}
        else if(foo==3){mystr = '3';}
        else if(foo==4){mystr = '4';}
        else if(foo==5){mystr = '5';}
        else if(foo==6){mystr = '6';}
        else if(foo==7){mystr = '7';}
        else if(foo==8){mystr = '8';}
        else if(foo==9){
            mystr = '9';
            foo = -1;
        }

        set_output_device(2);
        putu((char)(100+foo));
        set_output_device(1);
        LCD_char((char)(100+foo));

        foo = foo + 1;
    }

    putu('z');
    LCD_char('z');
    putu(EOF);
    return 1;
}
Example #27
0
void LCD_test()
{	char ch[]="LCD_test success";
	int i;
	 	LCD_init();
	
	for(i=0;i<16;i++)
	{
		Write_dat(ch[i]);
	}
	while(1);
}
Example #28
0
void LCD_setup(void) {
    WDTCTL = WDTPW + WDTHOLD;
    __delay_cycles(3000);
    _NOP();
    LCD_init();
    LCD_backlightInit();
    LCD_setAllPixels(0);
    LCD_clear();
    
    _NOP();
}
Example #29
0
 void SYS_Config(void)
 {
 
 	LCD_init();	//init LCD 12864
	ConfigHWled();	   //init LED indecate
  	ConfigHWSpiport(); 	//CONFIG FROM THE SPI1 COMMUCATION TO ADE7878 CHIP.
  	Config_ADE7878_IRQ(); //CONFIG FROM THE ADE7878'S "IRQ" TO OUR ...
 	Usart_Init();		//init USART3 PORT
	//Timer_Init();		//init TIME0
	  // while(1);

 }
Example #30
0
void main(void)
{ 
PSB = 0;
 LCD_init();  
 LCD_Setaddress(2,3);
 print("mawei");   
 LCD_Putstring(3,3,a);
// LCD_write_dat(0x35);  
 LCD_draw_clr();
 print_sinx(); 
    while(1);
}