Пример #1
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;	
	
}
Пример #2
0
int main(void)
{
register_ctrl *const p_PIOB_SODR = (register_ctrl *) 0x400E1030U;	/* defines the address for setting the output pins of the B register */
register_ctrl *const p_PIOB_CODR = (register_ctrl *) 0x400E1034U;	/* defines the address for clearing the output pins of the B register  */

int i;				/* loop counter for the delay */	
volatile int j; 	/* Dummy volatile to prevent compiler optimising the variable away */
int delay_length_short = 100000;	/* variable determining the length of a delay */
int delay_length_long = 300000;
int delay_length_SOS = 500000;

PIOB_init(26);		/* initialises the digital B I/O-port */

for (;;)	/* repeat blink in infinity */
{				
	j=0;	/* makes sure j doesn't overflow */
	
	PIOB_SODR = pin(26);	/* sets a bit of I/O port B to a one */
	for (i=0; i<delay_length_short; i++)	/* The delay counter */
	{
		j++;	/* some easy predictable operation */
	}
	PIOB_CODR = pin(26);	/* clears a bit of I/O port B */
	
	for (i=0; i<delay_length_short; i++)	/* The delay counter */
	{
		j++;	/* some easy predictable operation */
	}
	
	PIOB_SODR = pin(26);	/* sets a bit of I/O port B to a one */
	for (i=0; i<delay_length_short; i++)	/* The delay counter */
	{
		j++;	/* some easy predictable operation */
	}
	PIOB_CODR = pin(26);	/* clears a bit of I/O port B */
	
	for (i=0; i<delay_length_short; i++)	/* The delay counter */
	{
		j++;	/* some easy predictable operation */
	}
	
	PIOB_SODR = pin(26);	/* sets a bit of I/O port B to a one */
	for (i=0; i<delay_length_short; i++)	/* The delay counter */
	{
		j++;	/* some easy predictable operation */
	}
	PIOB_CODR = pin(26);	/* clears a bit of I/O port B */
	
	for (i=0; i<delay_length_long; i++)	/* The delay counter */
	{
		j++;	/* some easy predictable operation */
	}
	
	PIOB_SODR = pin(26);	/* sets a bit of I/O port B to a one */
	for (i=0; i<delay_length_long; i++)	/* The delay counter */
	{
		j++;	/* some easy predictable operation */
	}
	PIOB_CODR = pin(26);	/* clears a bit of I/O port B */
	
	for (i=0; i<delay_length_short; i++)	/* The delay counter */
	{
		j++;	/* some easy predictable operation */
	}
	
	PIOB_SODR = pin(26);	/* sets a bit of I/O port B to a one */
	for (i=0; i<delay_length_long; i++)	/* The delay counter */
	{
		j++;	/* some easy predictable operation */
	}
	PIOB_CODR = pin(26);	/* clears a bit of I/O port B */
	
	for (i=0; i<delay_length_short; i++)	/* The delay counter */
	{
		j++;	/* some easy predictable operation */
	}
	
	PIOB_SODR = pin(26);	/* sets a bit of I/O port B to a one */
	for (i=0; i<delay_length_long; i++)	/* The delay counter */
	{
		j++;	/* some easy predictable operation */
	}
	PIOB_CODR = pin(26);	/* clears a bit of I/O port B */
	
	for (i=0; i<delay_length_long; i++)	/* The delay counter */
	{
		j++;	/* some easy predictable operation */
	}
	
	PIOB_SODR = pin(26);	/* sets a bit of I/O port B to a one */
	for (i=0; i<delay_length_short; i++)	/* The delay counter */
	{
		j++;	/* some easy predictable operation */
	}
	PIOB_CODR = pin(26);	/* clears a bit of I/O port B */
	
	for (i=0; i<delay_length_short; i++)	/* The delay counter */
	{
		j++;	/* some easy predictable operation */
	}
	
	PIOB_SODR = pin(26);	/* sets a bit of I/O port B to a one */
	for (i=0; i<delay_length_short; i++)	/* The delay counter */
	{
		j++;	/* some easy predictable operation */
	}
	PIOB_CODR = pin(26);	/* clears a bit of I/O port B */
	
	for (i=0; i<delay_length_short; i++)	/* The delay counter */
	{
		j++;	/* some easy predictable operation */
	}
	
	PIOB_SODR = pin(26);	/* sets a bit of I/O port B to a one */
	for (i=0; i<delay_length_short; i++)	/* The delay counter */
	{
		j++;	/* some easy predictable operation */
	}
	PIOB_CODR = pin(26);	/* clears a bit of I/O port B */
	
	for (i=0; i<delay_length_SOS; i++)	/* The delay counter */
	{
		j++;	/* some easy predictable operation */
	}
	
}

}	/* end of main() */