Esempio n. 1
0
int main(int argc, const char *argv[])
{
	unsigned char i;
	LCDInit(LS_NONE);
	LCDClear();

	// Initialize usart
	init_usart(BAUDRATE, TRANSMIT_RATE, DATA_BITS, STOP_BITS, PARITY_BITS);

	char recipe_name[RECIPE_NAME_LENGTH];

    eeprom_read_block((void*)&recipe_name, (const void*)0x00, RECIPE_NAME_LENGTH);
    
	LCDWriteString("Recipe Name:");
	LCDWriteStringXY(0,1,recipe_name);

	for(i=0;i<25;i++) _delay_loop_2(0);
	
	// Clear second row
	LCDWriteStringXY(0,1,"                ");
    eeprom_read_block((void*)&recipe_name, (const void*)0x76, RECIPE_NAME_LENGTH);

	LCDWriteString("Recipe Name:");
	LCDWriteStringXY(0,1,recipe_name);

	return 0;
}
Esempio n. 2
0
int main(void) {

	// Initialise the clock to have a /1 prescaler and use the external crystal clock source for accuracy.
	CLK_DeInit();
	CLK_SYSCLKConfig(CLK_PRESCALER_CPUDIV1);
	CLK_ClockSwitchConfig(CLK_SWITCHMODE_AUTO, CLK_SOURCE_HSE, DISABLE, CLK_CURRENTCLOCKSTATE_DISABLE);
	
	// Reset ("de-initialise") GPIO port D.
	GPIO_DeInit(GPIOD);
	// Initialise pin 0 of port D by setting it as:
	// - an output pin,
	// - using a push-pull driver,
	// - at a low logic level (0V), and
	// - 10MHz.
	GPIO_Init(GPIOD, GPIO_PIN_0, GPIO_MODE_OUT_PP_LOW_FAST);
	
	LCDInit(); // Init the LCD
	DecodeInit(); // Init the GPS decoding
	DrawScreen(); // Setup Screen and Buffer
	
	// Infinite loop.
	for(;;) {
		// Blink Debug LED
		GPIO_WriteReverse(GPIOD, GPIO_PIN_0);
		
		DrawDemo();	
	}
}
Esempio n. 3
0
void main(void)
{
    //Initialize the LCD module
    LCDInit(LS_NONE);

    //Initialize the ADC module
    ADCInit();

    //Clear the LCD
    LCDClear();

    LCDWriteString("Thermometer");

    while(1)
    {
        //Read the temperature using LM35
        float t = LM35ReadTemp();

        //Print it on the LCD
        LCDWriteIntXY(0,1,t,3);

        //Print the degree symbol and C
        LCDWriteString("%0C");

        //Wait 200ms before taking next reading
        __delay_ms(200);
    }

}
Esempio n. 4
0
//LCDShow:在HD44780显示屏上显示数据----------------------------------------*
//功  能:在HD44780显示屏显示str所指向的32个数据                            *
//参  数:str=待显示的数组                                                  *
//返  回:无                                                                *
//内部调用函数:LCD_Command                                                 *
//-------------------------------------------------------------------------*
void LCDShow(INT8U str[])
{
    INT8U i;
    //1. LCD初始化
    LCDInit();
    //2. 显示第1行16个字符
    //2.1设置显示首地址
    LCDCtrl &= ~(1 << LCDRS);    //RS,R/W = 00(写的是指令)
    LCDCtrl &= ~(1 << LCDRW);
    LCD_Command(0x80);           //后7位为DD RAM地址(0x00)
    //2.2写16个数据到DD RAM
    LCDCtrl |=   1 << LCDRS;     //RS,R/W = 10(写的是数据)
    LCDCtrl &= ~(1 << LCDRW);
    //将要显示在第1行上的16个数据逐个写入DD RAM中
    for (i = 0;i < 16;i++)
    {
        LCD_Command(str[i]);
    }
    //3. 显示第2行16个字符
   	//3.1设置显示首地址
   	LCDCtrl &= ~(1 << LCDRS);    //RS,R/W = 00(写的是指令)
    LCDCtrl &= ~(1 << LCDRW);
    LCD_Command(0xC0);           //后7位为DD RAM地址(0x40)
    //3.2再写16个数据到DD RAM
    LCDCtrl |=   1 << LCDRS;     //RS,R/W = 10(写的是数据)
    LCDCtrl &= ~(1 << LCDRW);
    //将要显示在第2行上的16个数据逐个写入DD RAM中
    for (i = 16;i < 32;i++)
    {
        LCD_Command(str[i]);
    }
}
Esempio n. 5
0
int main(int argc, const char *argv[])
{
	LCDInit(LS_NONE);
	LCDClear();

	// while(1)
	// {
		//Clear the screen
		// LCDClear();


		//Simple string printing
		LCDWriteString("GET A STRING!");

		//A string on line 2
		// LCDWriteStringXY(0,1," Senior Project");
		// int i;
		//Wait
		// for(i=0;i<100;i++) _delay_loop_2(0);

		//Clear the screen
		// LCDClear();
	// }

	return 0;
}
Esempio n. 6
0
bool InitDisarmFSM ( uint8_t Priority )
{
  ES_Event ThisEvent;
	
	PortFunctionInit(); //initialize pins PA2-5, PB2-3, PD7, PF0 as GPIO
	initTapeSensors();  //initialize tape sensor
	initPhototransistor(); //initialize phototransisor
	initMotors();				//initialize motors
	initializeServos(); //initialize servo motors
	LEDShiftRegInit();  //initialize LED shift register
	LCDInit();					//initialize LCD display
	InitAdafruitAudioPortLines();	//initialize audio 
	initArmedLine();
	
  MyPriority = Priority;
  CurrentState = Armed;
  ThisEvent.EventType = ES_INIT;
  if (ES_PostToService( MyPriority, ThisEvent) == true)
  {
      return true;
  }else
	// if initialization failed
  {
      return false;
  }
}
Esempio n. 7
0
static screen_t *
screen_init(const int _din, const int _sclk, const int _dc, const int _rst, const int _cs, const int contrast)
{
	screen_t *scretp;

	if (wiringPiSetup() == -1) {
		syslog(LOG_LOCAL0|LOG_ERR, "wiringPi-Error");
		return (NULL);
	}
	if (pcf8591Setup(200, 0x48) == -1) {
		syslog(LOG_LOCAL0|LOG_ERR, "wiringPi-Error");
		return (NULL);
  	}
  
	/* init and clear lcd */
	LCDInit(_sclk, _din, _dc, _cs, _rst, contrast);
	LCDclear();
  
	/* show logo */
	LCDshowLogo();

	if ((scretp = calloc(1, sizeof(screen_t))) == NULL) {
		return (NULL);
	}
	scretp->sc_contrast = contrast;
	snprintf(scretp->sc_line1_buf, sizeof(scretp->sc_line1_buf), "Pilab");
	cur_time(scretp->sc_line2_buf, sizeof(scretp->sc_line2_buf));
	return (scretp);
}
Esempio n. 8
0
File: DHT11.C Progetto: hnulong/C51
void main()
{
	uchar len,i;
	uchar xdata Tvalue[6],Hvalue[6];
	SerialInit();
	LCDInit();
	while(1)
	{ 
	    RH();
		SerialPutString(buff);
		sprintf(Tvalue,"%2.2f",temperature);
		sprintf(Hvalue,"%2.2f%%",humidity);
		LCDWriteCom(0x01);//ÇåÆÁ
		LCDWriteCom(0x80);
		len=strlen(info1);
		//дÊý¾Ýµ½LCD1602
		for(i=0;i<len;i++)
			LCDWriteData(info1[i]);
		len=strlen(Tvalue);
		for(i=0;i<len;i++)
			LCDWriteData(Tvalue[i]);
		LCDWriteData((uchar)223);
		LCDWriteData('C');
		LCDWriteCom(0x80+0x43);
		len=strlen(info2);
		for(i=0;i<len;i++)
			LCDWriteData(info2[i]);
		len=strlen(Hvalue);
		for(i=0;i<len;i++)
			LCDWriteData(Hvalue[i]);
	   //
	   Delay(10000);
	}

}
Esempio n. 9
0
void main(void)
{
    /* Initialize I/O and Peripherals for application */
    InitApp(); //at end of user.c

    led_counter=0;
    spk_bit=0;  //what are the spk_bits ???
    led_bit=0;

    LCDInit();
    LCDClear();
    gotoXY(1,11);   //(1,11) is about halfway down
    LCDString("PIC 16LF1786");
    
    while(1)
    {
        /* TODO <INSERT USER APPLICATION CODE HERE> */
	if(spk_bit==1)
	{
	    if((spk_enable==1)&&(spk_enable2==1))
	    LATBbits.LATB6=1;  //B6 is the clk in for uploading program to PIC
	}else LATBbits.LATB6=0; 
    }

}
Esempio n. 10
0
int main(void)
{

	initTimeOut();
	initQueue();
	UART_init();
	LCDInit();
	clearMem(WHITE);
	LCDStart();

	refresh();
	while (1) {
		if (msg_flag) {
			if(RxBuffer[0] == 1){
				printNewMsg();
				START_TIMEOUT;
			} else if(RxBuffer[0] == 2){
				uint8_t h = RxBuffer[1]-1;
				uint8_t m = RxBuffer[2]-1;
				uint8_t s = RxBuffer[3]-1; //since it's probably a bad idea to have a data value that's the same as the string terminator
				RTCinit(h,m,s);
				rtc_time_flag = 1;
			}
			msg_flag = 0;
			RxBuffer[0] = 0;
		}if (rtc_time_flag) {
			printTime();
			rtc_time_flag = 0;
		}

	}

}
Esempio n. 11
0
int main(void){
	LCDInit();

	while(1){

	}
}
int main(void)
{
	//Library initialization
	initBjDevLib();
	
	//third-party LCD library initialization
	//third-party LCD library initialization
	LCDInit(LS_ULINE);
	LcdHideCursor();
	
	//register pedal change position callback
	//you can use callback, which will invoke only then pedals was turn or check pedal position manually,
	//compare it with previous value and process changes
	expRegisterPedalChangePositionCallback(expPedalsCallback);
	
	LCDWriteStringXY(0, 0,"Pedal 1 : ");
	LCDWriteStringXY(0, 1,"Pedal 2 : ");
	
	//manual read current pedal position
	pedalPositions[0] = expGetPedalPosition(EXP_PEDAL1);
	pedalPositions[1] = expGetPedalPosition(EXP_PEDAL2);
	
	//print current pedal positions
	updateScreen();

	while(1)
    {
		//continuously reading all pedals and run callback, if any changes detected
		expProcess();
    }
}
/*---------------------------------------------------------------------------*
 * Routine:  RX63N_DirectDrive_Configure
 *---------------------------------------------------------------------------*
 * Description:
 *      Configure and setup the LCD screen with the given settings
 * Inputs:
 *      void *aWorkspace          -- LCD Controller's workspace
 *      T_LCDControllerSettings *aSettings -- Pointer to settings to use
 * Outputs:
 *      T_uezError                 -- Error code
 *---------------------------------------------------------------------------*/
T_uezError RX63N_DirectDrive_Configure(
            void *aWorkspace,
            T_LCDControllerSettings *aSettings)
{
    LCDInit(aSettings);
	
    return UEZ_ERROR_NONE;
}
Esempio n. 14
0
void init_lcd(void)
{
	LCDInit(LS_NONE);
	LCDClear();

	LCDWriteString("    Mr. Pour    ");
	LCDWriteStringXY(0,1," Senior Project");
}
Esempio n. 15
0
int main (void)
{
	// Insert system clock initialization code here (sysclk_init()).
	
	board_init();
	sysclk_init();

	// Insert application code here, after the board has been initialized.
	
	//Initiera delay
	delay_init();	
	
	
	
	//Initiera LCD
	LCDInit();
	
	//Initiera AD-omvandlare
	adc_setup();
	
	//Starta upp LCD
	setupLCD();
	
	
	//Initiera interupt
	configure_tc();
	
	int delay_time = 200000;	/* variable determining the length of a delay */
	
	PIOB_init(27);
	for (;;)	/* repeat blink in infinity */
	{

		letterS(delay_time);
		
		paus(delay_time * 3);
		
		letterO(delay_time);
		
		paus(delay_time * 3);
		
		letterS(delay_time);

		paus(delay_time * 5);
		
		clearDisplay();
		delay(delay_time);
		
		printNumber(result);
		
		
		
	}
	
	return 0;	
	
}
Esempio n. 16
0
int main()
{
    LCDInit();

    for (;;)
    {
        __asm__("nop");
    }
    return 0;
}
Esempio n. 17
0
int main()
{
  // Setup GPIO
  wiringOliSetup();
  printf("LCD Init...\n");
  // LCD at address 0x27, with 4 rows and 20 columns
  LCDInit(0x27, 4, 20);
  LCDPrintString(0, 0, "Test");
  LCDPrintString(1, 0, "This is second line");
  return(0);
}
Esempio n. 18
0
void main()
{
     unsigned char i;

   //Initialize LCD module
   LCDInit(LS_BLINK|LS_ULINE);

   //Clear the screen
   LCDClear();

   //Simple string printing
   LCDWriteString("Congrats ");

   //A string on line 2
   LCDWriteStringXY(0,1,"Loading ");

   //Print some numbers
   for (i=0;i<99;i+=1)
   {
      LCDWriteIntXY(9,1,i,3);
      LCDWriteStringXY(12,1,"% ");
      _delay_loop_2(0);
      _delay_loop_2(0);
      _delay_loop_2(0);
      _delay_loop_2(0);

   }

   //Clear the screen
   LCDClear();

   //Some more text

   LCDWriteString("Hello world");
   LCDWriteStringXY(0,1,"By YourName Here");    // <--- Write ur NAME HERE !!!!!!!!!!!

   //Wait
   for(i=0;i<100;i++) _delay_loop_2(0);

   //Some More ......
   LCDClear();
   LCDWriteString("    eXtreme");
   LCDWriteStringXY(0,1,"  Electronics");

	//Wait
   for(i=0;i<100;i++) _delay_loop_2(0);

   //Custom Chars ......
   LCDClear();
   LCDWriteString("Custom Char !!!");
   LCDWriteStringXY(0,1,"%0%1%2%3%4%5%6%7");

}
Esempio n. 19
0
/*************************************************
  Function:		HarewareInit
  Description:  
  Input:		
  Output:		
  Return:		
  Others:
*************************************************/
void HarewareInit(void)
{
    SetPowerChange(1);
	EA = 0;
	PortInit();
	UartInit();
	TimerInit();
	LCDInit();
    KeyBoardInit();
    DS1302Init();
	EA = 1;
}
Esempio n. 20
0
void main(void) 
{

    OSCTUNEbits.PLLEN = 1;
    LCDInit();
    LCDClear();
    InitPins();
    ConfigPeriph();
    ConfigInterrupts();

    while (1) {
	    received = ReadSerial();
	    LCDClear();
            switch(received) {
                case 'a':
                         received2 = ReadSerial();  
                         sprintf(output,"Received char:%c",received2); 
			/*
			 *  FIXME : PIC18 doesn't transmit back to RPi
			 *  python script hangs on serial.read(1)
			 *  Same behavior with cat -A /dev/ttyACM0 
			 *
			 * 
			 * _delay(2); // 2 cycle delay
			 *while(!PIR1bits.TX1IF);
			 *sprintf(output,"TRANSMIT");
			 *LCDWriteLine(output,0);
			 *TXREG1=received2;
                         *
			 */
			 break ;
                case 'b':
                         potentiometer = ReadPot();
                         sprintf(output,"Pot value: %d", potentiometer);
                         LATD =~ LATD;
                         break;
                  
                case 'c':
			   received2=ReadSerial();
			   sprintf(output,"Set LED to 0x%X",received2);
                           LATD = received2;
                           break;
                default:
                    sprintf(output, ">>UNKNOWN %c",received);
                    break;
             
            }
        LCDWriteLine(output,0);
	
	
    }
}
Esempio n. 21
0
void main(void) {
  /* put your own code here */
  EnableInterrupts;
  LCDInit();
  LCDPutString("XLNX");



int8_t a;

  for(;;) {} /* wait forever */
  /* please make sure that you never leave this function */
}
void main()
{
    unsigned char i;
   for(i=0;i<10;i++) _delay_loop_2(0);
   
    while(1)
   {

   //Initialize LCD module
   LCDInit(LS_BLINK|LS_ULINE);
  
   for(i=0;i<10;i++) _delay_loop_2(0);
   //Clear the screen
   LCDClear();

   //Simple string printing
   LCDWriteStringXY(0,0,"Welcome to CELAB");
   //LCDWriteString("Congrats ");

   //A string on line 2
   LCDWriteStringXY(0,1,"Loading ");

   //Print some numbers
   for (i=0;i<99;i+=1)
   {
      LCDWriteIntXY(9,1,i,3);
      LCDWriteStringXY(12,1,"%");
      _delay_loop_2(0);

   }

   //Clear the screen
   LCDClear();

   //Some more text

   LCDWriteString("Hello world");
   LCDWriteStringXY(0,1,"ComputronicsLab");    // <--- Write ur NAME HERE !!!!!!!!!!!

   //Wait
  for(i=0;i<50;i++) _delay_loop_2(0);

   //Some More ......
   LCDClear();
   LCDWriteString("Computronics");
   LCDWriteStringXY(0,1,"Lab");
   for(i=0;i<50;i++) _delay_loop_2(0);
   }

}
Esempio n. 23
0
void  Main (void){
	INT16U freq;
	S3C_SysInit();

	OSInit();	
	
	LCDInit();
	LCDString(0x00,"     Bitman\n  Spartan 117");
	delay(10);
	
	for(freq = 10;freq < 300;freq += 10){
		S3C_SetPWMBuzzer(freq,freq/2);
		delay(1);
	}
	
	
	LCDClear();
	delay(8);
	LCDString(0,"   Bitman Lab\n   Log System.");
	S3C_SetPWMBuzzer(650,10);
	S3C_StartPWMBuzzer();
	delay(3);
	S3C_StopPWMBuzzer();
	delay(1);
	S3C_StartPWMBuzzer();
	delay(3);
	S3C_StopPWMBuzzer();
	delay(10);
	
	
	
	
	
	Sem_UART0Tx = OSSemCreate(1);
	Sem_UART1Tx = OSSemCreate(1);

	Mbox_UART0Rx = OSMboxCreate((void *)0);
	Mbox_UART0Tx = OSMboxCreate((void *)0);
	Mbox_LEDMAN  = OSMboxCreate((void *)0);
	Mbox_BEEPMAN = OSMboxCreate((void *)0);
	Mbox_LCDMAN  = OSMboxCreate((void *)0);
	
	
	iOPcode = TYPE_DEFAULT;


	OSTaskCreate(TaskStart,(void *)0,&Stk_TaskStart[99],10);
	OSStart();
}
Esempio n. 24
0
int main(void)
{
	int timer = 0;
	int x;
	int y;

	char str1[16];
	char str2[16];
	
	clear_bit(DDRD,5);
	clear_bit(DDRD,4);
	
	set_bit(DDRB,7);
	
	set_bit(PORTD,5);
	set_bit(PORTD,4);
	set_bit(PORTB,7);

	LCDInit();
	ADCInit();

	sei();

	LCDClear();

    while(1)
    {

		timer ++;

		if (timer >= 1000) {

			timer = 0;

			if(!check_bit(PIND,5))
			{

			}

			if(!check_bit(PIND,4))
			{

			}			

		}

	}

}
Esempio n. 25
0
int main(void) {
    /*****************
     * boot sequence *
     *****************/
    
    bootARM();           	// ARM boot sequence
    vs1002Mute();           // mute volume during start up

    // start of code
    ledRedOn();         // red LED indicates powering up
    LCDInit();          // initialize LCD
    LCDClear(black);   

    return 0;
}
Esempio n. 26
0
/***********************************************************************************************************************
* Function Name: main
* Description  : This function implements main function.
* Arguments    : None
* Return Value : None
***********************************************************************************************************************/
void main(void)
{
    R_MAIN_UserInit();
    /* Start user code. Do not edit comment generated here */

  LCDInit();              

  LCDTest2();

  while (1U)
  {
    ;
  }
    /* End user code. Do not edit comment generated here */
}
Esempio n. 27
0
void main(void) {
   
    ADCInit();//Start Analog to digital converter
    MotorInit();//Start the motor controller
    TimerPWMInit();//Start the generation of PWM signal using timers
    LCDInit(LS_NONE); //Initialize the LCD Module
    parallelInit();//Initialize the reception from the Arduino over the parallel port
    SetMotorLeft(0);//Start motor left at speed 0
    SetMotorRight(0);//Start motor right at speed 0

    /* Endless loop*/
    while(1) {
        ADCInitiateConversion();//One analog read.
        Go();//Take decissions to avoid obstacles. And send orders to obstacles.
    }
}
Esempio n. 28
0
File: PM2.5.c Progetto: hnulong/C51
void main()
{
    //uchar i;
    //EX1=1;
    //IT1=1;
    LCDInit();
    SerialInit();
    len=strlen(value);
    for(i=0; i<len; i++)
        LCDWriteData(value[i]);
    //sendsms();
    //DialVoiceCall();
    //
    while(1)
    {
        ConnectGPRS(0.3,0.4,0.8);
        //delay(3000);
        //LCDWriteCom(0x01);//清屏
        /*
        LCDWriteCom(0x80);
        if(pulse==1)
        {
        	TL0=0;
        	while(pulse);
        	TR0=1;
        	while(!pulse);
        	TR0=0;
        	count=TL0;
        	P1=count;
        	duration=(unsigned long)count;
        	lowpulseoccupancy = lowpulseoccupancy+duration;
        	ratio = lowpulseoccupancy/(sampletime_ms*10.0);  // Integer percentage 0=>100
            concentration = 1.1*pow(ratio,3)-3.8*pow(ratio,2)+520*ratio+0.62; // using spec sheet curve
            //Serial.print("yeelink:");
            //Serial.println(concentration);
            //ConnectGPRS(concentration,(float)DHT11.temperature,(float)DHT11.humidity);
        	memset(value,0x00,20);
        	sprintf(value,"%s%f","yeelink:",concentration);
        	len=strlen(value);
        	for(i=0;i<len;i++)
        		LCDWriteData(value[i]);
            lowpulseoccupancy = 0;
        //	delay(3000);
        }
        */
    }
}
int main(void){
for(l=0;l<21;l++)
bufferx[l]=buffery[l]=bufferz[l]=0;

RCC_Management();
NVIC_Management();

SysTick_SetReload(9000);//calibration gia to eswteriko roloi tou Cortex M-3(max HCLK/8)
SysTick_ITConfig(ENABLE);//energopoihsh twn interrupts

MMA_Management();

LCDInit();//arxikopoihsh ths LCD(emepriexetai h arxikopoihsh ths SPI thyras)
LCDContrast(0x45);

TIM1_Management();

}
Esempio n. 30
0
int main(void)
{	
	DisableGlobalInterrupts();
	{
		SystemClockInit();
		PMICInit();
		LCDInit();
		USBModuleInit();
	}
	EnableGlobalInterrupts();
	
	for ( ; ; )
	{
		// keep looping forever (we are interrupt driven)
	}
	
	return 0;
}