Example #1
0
void init() 
{
	TCCR1A |= (1 << WGM11); 
	TCCR1B |= (1 << WGM12) | (1 << WGM13); 

	TCCR3A |= (1 << WGM31); 
	TCCR3B |= (1 <<WGM32) | (1 <<WGM33); 

	TCCR1A |= (1 << COM1A1) | (1 <<COM1A0) | (1 <<COM1B1) | (1 <<COM1B0) | (1 << COM1C1) | (1 <<COM1C0);  
	TCCR3A |= (1 << COM3A1) | (1 << COM3A0) | (1 << COM3B1) | (1 << COM3B0); 

	TCCR1B |= (1 << CS11); 
	TCCR3B |= (1 << CS31); 
	
	ICR3 = 40000; 
	ICR1 = 40000; 

	//set PWM pins as output 
	DDRB |= (1 << 5) | (1 << 6) | (1 << 7);  
	DDRE |= (1 << 3) | (1 << 4); 

	LCDinit(); 
	LCDclr();  
	LCDcursorOFF(); 
	LCDstring("GRIP MODE", 9); 
} 
Example #2
0
//Initialize the LCD
void InitLCD(void){
  LCDinit();  //initialize the display
  LCDcursorOFF();
  LCDclr();        //clear the display
  LCDGotoXY(0,0);
  CopyStringtoLCD(LCDHello, 0, 0);
  CopyStringtoLCD(LCDHello2, 0, 1);
}
Example #3
0
//Initialize the LCD
void initLCD(){
	LCDinit();	//initialize the display
	LCDcursorOFF();
	LCDclr();				//clear the display
	LCDGotoXY(0,0);
	const uint8_t LCDHelloTop[] PROGMEM = "Water Cooler v9000\0";
	const uint8_t LCDHelloBot[] PROGMEM = "\0";
	CopyStringtoLCD(LCDHelloTop, 0, 0);
	CopyStringtoLCD(LCDHelloBot, 0, 1);
}
Example #4
0
File: avr.c Project: olcai/sommar
void lcd_init(void)
{
  /* setup LCD on portB and display greeting */
  LCDinit(); 
  LCDclr();
  LCDGotoXY(0,0);
  LCDcursorOFF(); 

  LCDstring((uint8_t*)"System online", 13);
  LCDGotoXY(0,1);
  if(config.flags.mode == CONFIG_MODE_BASE)
    LCDstring((uint8_t*)"base", 4);
  else
    LCDstring((uint8_t*)"node", 4);
}
Example #5
0
void panic(const char* msg)
{
    unsigned char panic_msg[] = "KERNEL PANIC!";
    cli();
    PORTC=0xFF;
    LCDinit(); 
    LCDclr();
    LCDGotoXY(0,0);
    LCDcursorOFF(); 
    LCDstring(panic_msg, sizeof(panic_msg)-1);
    LCDGotoXY(0,1);
    while(*msg)
	LCDsendChar(*(msg++));
    while(1)
    {
        PORTC = ~PORTC;
        _delay_ms(500);
    }
}
Example #6
0
//initialize the LCD
void initLCD(){
  LCDinit();  //initialize the display
  LCDcursorOFF();
  LCDclr();        //clear the display
}
int main(void)
{
	//var
	uint8_t answer;
	uint8_t http_respon_data[64];

	//init pa sbg in
	DDRA = 0;
	PORTA = 0xff;

	//init lcd
	LCDinit();

	LCDclr();
	LCDcursorOFF();
	LCDhome();
	
	//init uart
	sim900_init_uart(38400);
	
	//enable isr
	sei();

	LCDGotoXY(0, 0);
	fprintf(&LCDInputOutputStream, "setup modem = %d", sim900_setup(SETUP_WAIT_INFINITE));
	_delay_ms(1000);
	
	while(1)
	{
		//krm sms pa0
		if (bit_is_clear(PINA, PA0))
		{
			_delay_ms(100);
			loop_until_bit_is_set(PINA, PA0);
			
			LCDclr();
			LCDhome();
			fprintf(&LCDInputOutputStream, "open gprs = %d", sim900_gprs_open_connection(
			(const uint8_t*)"internet", (const uint8_t*)" ", (const uint8_t*)" "));
		}
		
		//open gprs
		if (bit_is_clear(PINA, PA1))
		{
			_delay_ms(100);
			loop_until_bit_is_set(PINA, PA1);

			//answer = sim900_gprs_open_bearer((const uint8_t*)"internet", (const uint8_t*)" ", (const uint8_t*)" ");
			//answer = sim900_gprs_open_bearer("internet", " ", " ");
			//answer = sim900_gprs_is_opened();
			//answer = sim900_gprs_closed();
			//answer = sim900_http_get((const uint8_t*)
			//"http://ex4-tech.id.or.id/sim900/data.php", (const uint8_t*)"c=1", 64,
			//http_respon_data);
			answer = sim900_http_send_data(
			HTTP_POST,
			(const uint8_t*)"http://ex4-tech.id.or.id/sim900/data.php",
			(const uint8_t*)"c=1",
			64,
			http_respon_data);
			LCDclr();
			LCDhome();
			fprintf(&LCDInputOutputStream, "post = %d", answer);
			LCDGotoXY(0, 1);
			fprintf(&LCDInputOutputStream, "%s", http_respon_data);
			_delay_ms(5000);
		}


		if (bit_is_clear(PINA, PA2))
		{
			_delay_ms(100);
			loop_until_bit_is_set(PINA, PA2);

			answer = sim900_gprs_close_connection();
			LCDclr();
			LCDhome();
			fprintf(&LCDInputOutputStream, "close gprs = %d", answer);
		}
	}
}
Example #8
0
// --- Initialize the LCD ----------------------------
void InitLCD(void) {
    LCDinit();  //initialize the display
    LCDcursorOFF();
    LCDclr();        //clear the display
    LCDGotoXY(0,0);
}