Пример #1
0
void display_init() {
	// Setting up ports.
	SYSCTL_RCGC2_R |= SYSCTL_DC4_GPIOB; // Enable GPIOB	
        //maybe delay2 here
        delay2(10000);
        SYSCTL_RCGC2_R |= SYSCTL_DC4_GPIOD; // Enable GPIOD
        delay2(10000);
	GPIO_PORTB_DIR_R |= 0x7f;
	GPIO_PORTD_DIR_R |= 0xe0;

	GPIO_PORTB_AFSEL_R &= 0xffffff80;
	GPIO_PORTD_AFSEL_R &= 0xffffff1f;	

	GPIO_PORTB_DEN_R |= 0x7f; // Enable port B		
    	GPIO_PORTD_DEN_R |= 0xe0; // Enable port D
        
    	// Function set commands separated by delay2s, as per cycle
    	//delay2(100);
        //SysCtldelay2(5*SysCtlClockGet()/(3*1000)); //5msec
        delay2(5000); //5msec
	function_set(0, 0);
        //SysCtldelay2(5*SysCtlClockGet()/(3*1000)); //5msec
	//delay2(10);
        delay2(5000); //5msec
	function_set(0, 0);
        //SysCtldelay2(2*SysCtlClockGet()/(3*10000)); //200usec
        delay2(200); //200usec
	//delay2(10);
	function_set(0, 0);
        function_set(1, 0); //two lines
        display_off();
        clear_display();
        entry_mode_set(1,0);
}
Пример #2
0
Файл: IIC.c Проект: hnulong/C51
void display(uchar bai,uchar shi,uchar ge)
{
        dula=1;
		P0=table[bai];
		dula=0;
		P0=0xff;
		wela=1;
		P0=0xfe;
		wela=0;
		delay2(1);

		dula=1;
		P0=table[shi];
		dula=0;
		P0=0xff;
		wela=1;
		P0=0xfd;
		wela=0;
		delay2(1);

		dula=1;
		P0=table[ge];
		dula=0;
		P0=0xff;
		wela=1;
		P0=0xfb;
		wela=0;
		delay2(1);
}
Пример #3
0
void main(void) {
	BYTE res;
	//UINT bytesread;
	//FIL	file1;

	DRESULT result;
	FRESULT fresult;
	
	SLAVE_STATUS = 0;
	GREEN_LEDS = 0xC3;

	ser_puts("@");
	delay2(10);
	
	ser_nl(); ser_puts(cnotice1); 
	ser_nl(); ser_puts(cnotice2);

	thrall(ptrfile, Buffer);
//	for(;;) {
//		philes_mount();
//		fresult = philes_opendir();
//		
//		if (fresult == FR_OK) {
//			philes_nextfile(ptrfile+10, 1);
//		}
//		ser_puts("=> "); ser_puts(ptrfile); ser_nl();
//
//		useimage(ptrfile, Buffer);
//		ser_puts("RELOAD");
//		delay2(100);
//	}
	print_result(result);
	ser_puts("\r\nWTF?");
}
        void lcd_data2(unsigned char disp)    // function to send data on LCD
																{
																	lcd_data_pin=disp;
																	EN=1;
																	RS=1;
																	RW=0;
																	delay2(1);
																	EN=0;
                                 }
Пример #5
0
void output_waveform(int freq_value, int arr[])
{
          int i;
          for (i = 0; i < 50; i++)
          {
              SPI_transfer(arr[i]);
              delay2(freq_value);
          }
}
Пример #6
0
int main()
{
	int i;
	int x,y;
	for(i=0;i<100000;i++) {
		x=rand();
		y=delay2(x);
		if (i<10 || 99990<i) printf("%8d x=%6d y=%6d\n",i,x,y);
	}
	return 0;
}
Пример #7
0
int main()
{
	uint8_t ledRotator = MIN_LED_POS; //initial LED position
	
	INIT(); //initialize LED ports
	
	while(1)
	{
		if(IS_SW_PRESSED()) //check if switch is pressed
		{
			//it's non-blocking 
            //so we move on after a short delay
            delay();
            ledRotator <<= 1;
            if(ledRotator == 0)
                ledRotator = MIN_LED_POS;
		}
        LED_PORT = ledRotator;
        delay2();
        LED_PORT = 0x00;
        delay2();
	}
}
Пример #8
0
// Toggles execution of whatever function loaded on ports
void toggleE() {
    GPIO_PORTD_DATA_R |= 0x20; //set e high
    delay2(1000); // 100usec Let operation complete
    GPIO_PORTD_DATA_R &= 0xffffffdf; //set e low
    //delay2(1000); //another delay2
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   }  
Пример #9
0
void main()

{
x=0;
counter = 0;
fw=0;
ew=0;
bz=0;


 TMOD=0x20; //Enable Timer 1

 TH1=0XFD;

 SCON=0x50;

 TR1=1; // Triggering Timer 1

 lcd_init();

lcd_cmd(0x81); //Place cursor to second position of first line 
lcd_cmd(0x01); //clear screen
lcd_string("SoS App");

 delay(200);
//recieve();
//SBUF=" ";
lcd_init();
lcd_cmd(0x81); //Place cursor to second position of first line 
//lcd_cmd(0x01); //clear screen
lcd_cmd(0xC1); //Place cursor to second position of second line
//lcd_string("UNIQUE ID:");
//recieve();
 while(1)

 {
 int l;


if (fw == 1 && counter == 0)
{
counter = 1;
bz = 1;
 for(l=0;l<12;l++)

 { 
 
 lcd_data(flood[l]);

 }

  // Mobile communication start
          		
          		serial_init();                                                                                                 //serial initialization
           // LED = 0x00; 
            printf("AT+CMGF=1%c",13);                                        
             delay2(20);  //Text Mode            | hex value of 13 is 0x0D (CR )
            printf("AT+CMGS=\"8939965828\"%c",13); delay2(20);           //Type your mobile number Eg : "9884467058"
           // led_left();                 //scroll left
                        delay1(20);
            printf("Sos-Warning:");                   
              delay2(20);  //Type text as u want
                printf(flood);                   
              delay2(20);  //Type text as u want
            printf("%c",0x1A);                                                             
            delay2(20);  //line feed command

          		// Mobile Communication end
}

if (ew == 1 && counter == 0)
{

counter = 1;
bz =1;
 for(l=0;l<17;l++)

 { 
 
 lcd_data(earthquake[l]);

 }
  // Mobile communication start
          		
          		serial_init();                                                                                                 //serial initialization
           // LED = 0x00; 
            printf("AT+CMGF=1%c",13);                                        
             delay2(20);  //Text Mode            | hex value of 13 is 0x0D (CR )
            printf("AT+CMGS=\"8939965828\"%c",13); delay2(20);           //Type your mobile number Eg : "9884467058"
           // led_left();                 //scroll left
                        delay1(20);
            printf("Sos-Warning:");                   
              delay2(20);  //Type text as u want
                printf(earthquake);                   
              delay2(20);  //Type text as u want
            printf("%c",0x1A);                                                             
            delay2(20);  //line feed command

          		// Mobile Communication end
}
 

 
}
 }