void align_cw(void)
{
	PORTG=0x00;
	clockwise=1;
	counterwise=0;
	PORTG&=~(1<<0);
	PORTC=0x01;

	unsigned char degree;
	degree_set_new=eeprom_read_byte(25);
    if(degree_set_new<12)      // keeping 120 in mind
	{
		for(degree=0;degree<50;degree++)
		{
		PORTC=0xff;
		_delay_us(555);
		PORTG|=(1<<4);
		_delay_us(5);
		PORTG&=~(1<<4);
		}
	degree_set_new++;
	eeprom_write_byte(25,degree_set_new);
	}
	lcd_gotoxy2(5);
	lcd_string("    ");
	lcd_gotoxy2(0);
	lcd_string("CW=");
	lcd_num(eeprom_read_byte(25));

}
Exemplo n.º 2
0
static void print_time(uint8_t blink)
{
	char digits[6];
	uint8_t i;
	uint32_t f;

	lcd_setcursor(0,2);
	lcd_string("t=");

	f = time;

	digits[0] = f/1e3; f -= digits[0]*1e3;
	digits[1] = f/1e2; f -= digits[1]*1e2;
	digits[2] = f/1e1; f -= digits[2]*1e1;
	digits[3] = f/1e0; f -= digits[3]*1e0;
	digits[4] = 0;

	for(i=0;i<4;i++)
		digits[i] += 48;

	if(blink)
	{
		if(selectionState == state_select_time_4)
			digits[0] = ' ';
		if(selectionState == state_select_time_3)
			digits[1] = ' ';
		if(selectionState == state_select_time_2)
			digits[2] = ' ';
		if(selectionState == state_select_time_1)
			digits[3] = ' ';
	}
	lcd_string(digits);
}
Exemplo n.º 3
0
/*
 * This method is called continouusly, i.e. in a while(1) loop. This is
 * where the exciting stuff happens. Well, "exciting" depends on your
 * point of view and level of experience, I guess.
 */
void loop() {
	// Place the cursor in the second line of the display and output the current
	// sensor values. Note that I didn't bother to translate those values to
	// an actual light level and temperature - I only scaled the light sensor's
	// output so it looked nicer on the display.
	// I use hex codes instead of decimal because it's more 31337.
	lcd_setcursor(0,2);
	int ldrValue = map(getAnalogValue(SEN_LDR_PIN), 0x050, 0x3ff, 0x000, 0xfff);
	int trmValue = getAnalogValue(SEN_TRM_PIN);

	sprintf(buffer, "LDR %03x  TRM %03x", ldrValue, trmValue);
	lcd_string(buffer);

	// Show the sensor readings for some time ...
	_delay_ms(TIME_AWAKE);

	// ... then say that we're sleepy ...
	lcd_home();
	lcd_string("Sleep ...");
	_delay_ms(TIME_BEFORE_SLEEP);

	// ... switch off the LCD and put the processor in deep sleep mode.
	lcd_light_state(0);

	set_sleep_mode(SLEEP_MODE_PWR_DOWN);
	sleep_mode();

	// When the button is pressed, the program will resume right here after
	// the interrupt handler has been executed. A good moment for reactivating
	// the LCD.
	lcd_home();
	lcd_string("Wake up! ");
	lcd_light_state(1);
}
Exemplo n.º 4
0
main()
{
unsigned char temp;
unsigned char a[10];
	unsigned char i=0;

	uart_init();
lcd_init();

	do
	{		
		temp=uart_rx();
		uart_tx(temp);
		a[i++]=temp;
		lcd_cmd(0x01);
		lcd_data(temp);
		lcd_cmd(0x85);
		lcd_int(temp);
		lcd_cmd(0x89);
		lcd_string("0x");
		lcd_hex(temp);
		delay_ms(1000);
	}while(temp!=13);
	a[--i]='\0';
	lcd_cmd(0xc0);
	lcd_string(a);
	delay_ms(5000);
}
//Main Function
int main(void)
{
lcd_port_config();

lcd_init();
	unsigned char x;
	
	PIR();
	
	while(1)
	{
		
		x = PINL &0xFF;
		
		if(x) //switch is not pressed
		{
			
			lcd_cursor(1,1);
			lcd_string("Human Detected    ");
		}
		else
		{
			lcd_cursor(1,1);
			lcd_string("Empty Space    ");
		}
		
	}
}
Exemplo n.º 6
0
void main()
{
unsigned char c;
DDRC=0xff;
lcd_init();
while(1)
{

for(c=0x8f;c>0x80;c--)
{
lcd_command(c);
lcd_string("PUNIT JAIN");
_delay_ms(500);
lcd_command(0x01);
_delay_ms(25);
}
for(c=0x89;c>=0x80;c--)
{
lcd_command(0x04);
lcd_command(c);
lcd_string("NIAJ TINUP");
_delay_ms(500);
lcd_command(0x01);
_delay_ms(25);
}


}

}
void main()
{
	unsigned char tag1[] = "4100A352E959";	// This is the valid tag the system is looking for
	unsigned char *str;
	rf_init_devices();

	while(1)
	{
		_delay_ms(50);
		rf_display();		// read the tag, store it and display
		str = rf_return();		// get the read tag details into another string
		lcd_cursor(1,1);
		lcd_string(str);
		_delay_ms(100);
	
		if(!strcmp(str,tag1))		// compare the required tag with the tag which is read
		{
			lcd_cursor(2,1);
			lcd_string(" Valid Tag");
		}	
		else
		{
			lcd_cursor(2,1);
			lcd_string(" invalid tag");
		}	

		_delay_ms(100);
		lcd_wr_command(0x01);
	}
	
	return 0;
	
}
void align_ccw(void)
	{
		clockwise=0;
	counterwise=1;
	PORTG=0x00;
	PORTG|=(1<<0);

	unsigned char degree;
	PORTC=0x02;
	degree_set_new=eeprom_read_byte(25);
    if(degree_set_new>1)     
	{	

		for(degree=0;degree<50;degree++)
		{
		PORTC=0xff;
		_delay_us(555);
		PORTG|=(1<<4);
		_delay_us(5);
		PORTG&=~(1<<4);
		}
	degree_set_new--;
	eeprom_write_byte(25,degree_set_new);
	}
	lcd_gotoxy1(5);
	lcd_string("    ");
	lcd_gotoxy1(0);
	lcd_string("CCW=");
	lcd_num(degree_set_new);
	}
Exemplo n.º 9
0
main()
{
lcd_init();
lcd_cmd(0x80);
lcd_string("Abhyuday");
lcd_cmd(0xc0);
lcd_string("Rinkesh");
while(1);
}
Exemplo n.º 10
0
void unit_aversive(void)
{
  int16_t a, x, y;

  aversive_goto_xy_abs(&aversive_device, 100, 100);
  wait_done(&aversive_device);
  aversive_get_pos(&aversive_device, &a, &x, &y);
  lcd_string(3, 0, uint16_to_string((uint16_t)x));
  lcd_string(3, 30, uint16_to_string((uint16_t)y));
}
Exemplo n.º 11
0
main()
{
unsigned char ret;
unsigned char buf[8];
unsigned char i=0;
unsigned char l1=strlen(pass);
unsigned char l2;
lcd_init();
lcd_cmd(0x80);
lcd_string("password:"******"Invalid");
delay_ms(5000);
}
else
{
//ret=strcmp(pass,buf);
ret=my_comp(pass,buf,l2);
if(ret==0)
{
	lcd_cmd(0x01);
	lcd_string("Valid");
	delay_ms(5000);
}
else
	{
	lcd_cmd(0x01);
	lcd_string("Invalid");
	delay_ms(5000);
	}
}
}
Exemplo n.º 12
0
void main()
{
	U8 i;
	lcd_writecd(CMD,0x0c);
	lcd_string(0x87,"Welcome");
	lcd_string(0x97,"Good Luck!");
	while(1)
	{
		lcd_writecd(CMD,0x18);
		delay_1ms(1000);
	}
}
//Main Function
int main(void)
{
	
	init_devices();
	lcd_set_4bit();
	lcd_init();
	while(1)
	{
		lcd_cursor(1,3);
		lcd_string("FIRE BIRD 5");
		lcd_cursor(2,1);
		lcd_string("NEX ROBOTICS IND");
	}
}
void lcd_clear()
{
char dummy[25];
strcpy(dummy,"                   ");
lcd_string(dummy);
lcd_cursor(1,1);
}
Exemplo n.º 15
0
int main(void)
{
	unsigned char Mystring[20];

	Serial_Init();
	
	lcd_init();

	print_string("\nSTART MAIN TIMER TEST");

	Timer0_Init();
	sei();

	while(1)
	{
		if(Update_flag)
		{
			sprintf(Mystring,"%02d %02d %02d",(unsigned char)HRS_var,(unsigned char)MIN_var,(unsigned char)SEC_var);
			print_string("\n\r");
			print_string(Mystring);
			lcd_gotoxy1(0);
			lcd_string(Mystring);
			Update_flag = 0;
		}
	}
}
Exemplo n.º 16
0
//-------------------------------------------------------****MAIN FUNCTION ****------------------------------------------------
int main()
{
	
	init_devices();
	lcd_set_4bit();
	lcd_init();
    lcd_cursor(1,1);
	lcd_string("START");
	_delay_ms(rand());
//--*** GRIPPER INITAL POSITION ***---
	S2 = 0x73;
	cli();
	timer0_init();
	TIMSK |= (1 << OCIE0) | (1 << TOIE0); // timer 0 compare match and overflow interrupt enable 
	sei();
	pickup();
	
	while(1)
	{
	if( bot_id_set == 1)
	{	
	
		init_devices2();
		init_grid();
		dispersion();
		localize();
		region_division();
		break;
	}
	
 }
 }
void black_line() {
L_velocity = VELOCITY_MAX; 
R_velocity = VELOCITY_MAX;
get_vector();
lcd_cursor(1,1);
lcd_string("Straight");
forward();
if (Center_white_line > THRESHOLD) {
if (Left_white_line > THRESHOLD)
L_velocity = VELOCITY_MIN;
else if (Right_white_line > THRESHOLD)
R_velocity = VELOCITY_MIN;
}
else {
if (Left_white_line > THRESHOLD)
L_velocity = 20;
else if (Right_white_line > THRESHOLD)
R_velocity = 20;
}
velocity(L_velocity, R_velocity);
if (Center_white_line < THRESHOLD && Left_white_line < THRESHOLD && Right_white_line < THRESHOLD) {
forward();
stop();
}
}
Exemplo n.º 18
0
Arquivo: test1.c Projeto: Devj92/test1
void pr_int(int a,int b,uint16_t c,int d) /* get negative values*/
{
	if (c>32767)
	{
		lcd_cursor(a,b);
		lcd_string("-");
		c = 65536 -c;
		lcd_print(a,b+1,c,d);
	} 
	else
	{
		lcd_cursor(a,b);
		lcd_string("+");
		lcd_print(a,b+1,c,d);
	}
}
Exemplo n.º 19
0
void lcd_print_int(int8_t line_no, int8_t pos_no, int8_t number)
{
	char s[3];
	sprintf(s,"%3d",number);
	lcd_cursor(line_no,pos_no);
	lcd_string(s);
}
Exemplo n.º 20
0
int main(void)
{
 unsigned char data,i;
 DDRC=0x00;
 PORTC=0x01;
 lcd_init();
 lcd_string("IR RECEIVER");
 
 while(1)
 {
  if((PINC&0x01)==0x01)
  {
   data=0;
   _delay_us(1500);
   for(i=0 ;i<=7 ;i++)
   {
    data>>=1;
	if((PINC&0x01)==0x01)
	{
      data|=0x80;	
	}
	_delay_us(2000);
	}
	lcd_gotoxy(1,0);
	lcd_showvalue(data);
	_delay_ms(500);
	}
	}
Exemplo n.º 21
0
void homem_inicio(void) {
    int a, b, c;

    a = 0;
    b = a + 1;
    c = a + 2;

    lcd_string((char *) "----------------", LCD_LINHA3);

    lcd_novo_char(0, stepA1);
    lcd_novo_char(1, stepA2);
    lcd_novo_char(2, stepA3);
    lcd_novo_char(3, stepA4);
    lcd_novo_char(4, stepA5);
    lcd_novo_char(5, stepA6);

    lcd_cursor_ddram(a, 1);
    lcd_putch(0);
    lcd_cursor_ddram(a, 0);
    lcd_putch(1);
    lcd_cursor_ddram(b, 1);
    lcd_putch(2);
    lcd_cursor_ddram(b, 0);
    lcd_putch(3);
    lcd_cursor_ddram(c, 1);
    lcd_putch(4);
    lcd_cursor_ddram(c, 0);
    lcd_putch(5);
}
int main(void)
{
	init_devices();
	lcd_set_4bit();
	lcd_init();
	lcd_cursor(1,5);
	lcd_string("HI");
	lcd_print(2,1,read,3);
	while(1)
	{ 
		//white line sensing
	    sensor_data_interpretation();

		flag=0;
		

		if(Center_white_line<0x28)
		{
			flag=1;
			forward();
			velocity(150,150);
		}

		if((Left_white_line>0x28) && (flag==0))
		{
			flag=1;
			forward();
			velocity(130,50);
		}

		if((Right_white_line>0x28) && (flag==0))
		{
			flag=1;
			forward();
			velocity(50,130);
		}

		if(Center_white_line>0x28 && Left_white_line>0x28 && Right_white_line>0x28)
		{
			forward();
			velocity(0,0);
		}
		if(count>=6)
		 break;
	}
	stop();
	read = 0;
	lcd_init();
	//Printing the stored value on lcd after the count value is reached 6.
	lcd_print(1,1 , store[0][0], 3);
	lcd_print(1,5 , store[0][1], 3);
	lcd_print(1,9 , store[0][2], 3);
	lcd_print(1,13 , store[0][3], 3);
	lcd_print(2,1 , store[0][4], 3);
	lcd_print(2,5 , store[0][5], 3);
	while(1);
	 
	
}
/*						  
* Function Name: main
* Input: None
* Output: int to inform the caller that the program exited correctly or incorrectly (C code standard)
* Logic: calls various functions given in the header file of lcd to display a string on lcd.
* Example Call: Called automatically by the Operating System
*
*/
void main (void)
{
lcd_init();	  //initializes the LCD
lcd_clear();  //clears screen of LCD
lcd_cursor(1,5);  //places cursor at 5th column of 2nd row
 lcd_string("YOUR NAME");  //writes your name on the screen of LCD
 while(1);
} //main ends here
Exemplo n.º 24
0
int main()
{
	lcd_init();
	lcd_clear();
	lcd_string("Testing");
	while(1);
	
}
Exemplo n.º 25
0
void print_value(void)
{
	char string[256];
	sprintf(string, "DEC %03d\nHEX %03x", wert, wert);
	lcd_clear(WHITE);	// Grafikspeicher auf dem MSP430 löschen
	lcd_string(BLACK, 15, 25, string);	// Textausgabe
	lcd_paint();	// Grafikspeicher auf das LCD Display ausgeben
}
Exemplo n.º 26
0
//Main Function
int main(void)
{

	unsigned char x;
	int flag=1;
	
	init_devices();			//Initialize all the devices
	lcd_set_4bit();			//Set the LCD in 4 bit mode
	
	while(1)
	{
		
		x = PINL & (1<< 6);			//Read the PL6 pin to read the PIR Sensor output
		lcd_init();					//Initialize the LCD
		if(x)						//Check if the PL6 pin is HIGH
		{
			PORTJ = 0xFF;			//Turn ON Bargraph LED
			
			
			
			if(flag ==1)			// A flag has been added to stop the screen from re-initializing every time in the while loop
			{
				lcd_init();
				lcd_cursor(1,1);
				
			}
			lcd_string("Human Detected");		//Display "Human Detected" on the LCD
			flag=0;
		}
		else
		{
			
			PORTJ = 0x00;			//Turn OFF Bargraph LED
			
			if(flag==0)
			{
				lcd_init();
				lcd_cursor(1,1);
			}
			lcd_string("Empty Space");			//Display "Empty Space" on the LCD
			flag=1;
		}
		
	}
}
Exemplo n.º 27
0
void homem_animacao(void) {
    lcd_clear();
    homem_inicio();
    homem_corre_esquerda();
    homem_vira_direita();
    homem_corre_direita();
    homem_vira_esquerda();
    lcd_string((char *) "FIM....", LCD_LINHA4);
}
Exemplo n.º 28
0
void lcd(char *str)
{
	
	lcd_wr_command(0x01);
	lcd_cursor(1,1);
	lcd_string(str);
	buzzer();
	_delay_ms(1000);
}
    /*!
	 non-blocking rolling lcd display
    */
void rollLCD(char str[])
{
	strcpy(_rollLCD,str);
	strcat(_rollLCD,"               ");
	lcd_clear();
	lcd_cursor(1,1);
	lcd_string(_rollLCD);
	_LCDpos=1;
	_rollLCDFlag=1;
}
Exemplo n.º 30
0
void key_process(U8 key)
{
	U8 i;
	if(key>=0&&key<10)
	{
		buf[counter]=key+'0';
		counter++;
		lcd_string(0x90,"                 ");
		lcd_string(0x96-(strlen(buf)-1)/2,buf);
		if(buff==0)
			offset=strlen(buf)/2;
	}
	else if(key>=13&&key<=16&stat==0)
	{
		lcd_string(0x80,"                ");
		lcd_string(0x80,buf);
		sscanf(buf,"%d",&a);
		for(i=0;i<8;i++)
			buf[i]=0;
		switch(key-12)
		{
			case 1: lcd_writecd(1,'+'); break;
			case 2: lcd_writecd(1,'-'); break;
			case 3: lcd_writecd(1,'*'); break;
			case 4: lcd_writecd(1,'/'); break;
		}
		symbol=key-12;
		stat=1;
		counter=0;
		buff=1;
	}
	else if(key==12&&stat==1)
	{
		lcd_string(0x80+offset+1,buf);
		lcd_writecd(1,'=');
		sscanf(buf,"%d",&b);
		for(i=0;i<8;i++)
			buf[i]=0;
		lcd_string(0x90,"                   ");
		switch(symbol)
		{
			case 1: result=a+b; break;
			case 2: result=a-b; break;
			case 3: result=a*b; break;
			case 4: result=a/b; break;
		}
		sprintf(buf,"%.0f",result);
		lcd_string((0x96-(strlen(buf)-1)/2),buf);
		a=0;b=0;
		for(i=0;i<8;i++)
			buf[i]=0;
		stat=0;
		offset=0;
		counter=0;
		buff=0;
	}
}