Exemple #1
0
int main()
{
//	unsigned char onechar = 'a';
	
	PLL_Init();
	PortA_Init();
	PortC_Init();
	SysTick_Init();
	Nokia5110_Init();
	
// Зеленый светодиод выкл, PC9. Синий сетодиод вкл, PC8. Положительная логика
	GPIOC_BSRR = 0x2000100;
  Nokia5110_Clear(); 
	
	while(1){
		if((GPIOA_IDR & 0x1)){ // Проверяем нажатие  кнопки, PA0. Положительная логика
			GPIOC_BSRR = 0x1000200; // Синий LED off. Зеленый LED on
			SysTick_Wait10ms(20); // задержка 200 мс
			GPIOC_BSRR = 0x3000000; // Синий LED off. Зеленый LED off
			SysTick_Wait10ms(20); // задержка 200 мс
			Nokia5110_OutString("Hello,World!");
		}	
		else
			GPIOC_BSRR = 0x2000100; // Синий светодиод вкл. Зеленый сетодиод выкл
	}
}
// 3. Subroutines Section
// MAIN: Mandatory for a C Program to be executable
int main(void){
	
  PLL_Init();   
	
	
  	// 80 MHz
 
	
  EnableInterrupts();
	
	/*Initialize ports , ADC and timers*/
	ADC0_InitSWTriggerSeq3_Ch1();
	PortA_Init();
	
	//SysLoad(T);
	SysFun();
  while(1){   
		/*Your code goes here*/
		 value=ADC0_InSeq3();
		 //PWMindex=(ADCvalue);
		 p=((value+1)*390)+800000;
	//for(i=0;i<4;i++){

	 
GPIO_PORTA_DATA_R|=0x20;
SysLoad(p);	
GPIO_PORTA_DATA_R&=~0x20 ;
SysLoad(T-p);	
	//}
	
	
  }
}
Exemple #3
0
int main(void) {  PLL_Init();   
	SysFun();  // 80 MHz 
	PortA_Init() ; // initialize output and interrupts  
	EnableInterrupts(); 
	/*Initialize ports and timers*/  
	while(1){ 
unsigned long i,j;

for(i=80000; i<=160000; i+=16000)            /*on time starts from 1msec to 2msec with a increment of 0.2msec risein on tim */
		{
			for(j=0;j<4;j++)
			{
				GPIO_PORTA_DATA_R |= (0x40); 
				SysLoad(i); 
				GPIO_PORTA_DATA_R &= ~(0x40); 
				SysLoad(1600000-i);
			}
		}
for(i=160000; i>=80000; i-=16000)
		{
			for(j=0;j<4;j++)
			{
				GPIO_PORTA_DATA_R |= (0x40); 
				SysLoad(i); 
				GPIO_PORTA_DATA_R &= ~(0x40); 
				SysLoad(1600000-i);
			}
		}
  }
}
Exemple #4
0
void encoderInit(int32_t *newArray) {
    position = newArray;

    PortA_Init();
    PortB_Init();
    PortD_Init();
    PortE_Init();
}
int main(void)
{
 PLL_Init();
 PortA_Init();
 SysInit();
 SysLoad(40000);
 
 while(1){}
}
int main(void){
  PLL_Init();   
	PortA_Init();
	SysInit();
  SysLoad(40000); 
	
	while(1){
	}
	// initialize output and interrupts
  //EnableInterrupts();
  /*Initialize necessary ports and timers here*/
	
	 
  
}
Exemple #7
0
int main(void)
{
	unsigned long T=1600000 ;
	int i,j;
	PLL_Init();
	SysHandler();
	PortA_Init();
	SysInit();
	SysLoad(T);

	while(1)
	{
for(j=80000; j <160000 ; j=j+8000){
	for(i=0;i<4;i++){

	 
GPIO_PORTA_DATA_R|=0x20;
SysLoad(j);	
GPIO_PORTA_DATA_R&=~0x20 ;
SysLoad(T-j);	
	}
}
}
	}