コード例 #1
0
// 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);	
	//}
	
	
  }
}
コード例 #2
0
ファイル: dcmotor1.c プロジェクト: sarang5258/cds7-lab
// 3. Subroutines Section
// MAIN: Mandatory for a C Program to be executable
int main(void){
  PLL_Init();  // 80 MHz 
	Port_Init();	
	ADC0_InitSWTriggerSeq3_Ch1();
	EnableInterrupts();
	SysFun();
	
	/*Initialize ports , ADC and timers*/
  while(1){   
		/*Your code goes here*/
		a= ADC0_InSeq3();
		t1=a+(10000/4096)+10000;
		in1=50;
		while(in1)
			{ 
GPIO_PORTA_DATA_R |= (0x20); 
SysLoad(t1); 
GPIO_PORTA_DATA_R &= ~(0x20); 
SysLoad(t-t1); 
in1=in1-1; 

}
			
	
	
  }
}
コード例 #3
0
ファイル: sysdelay.c プロジェクト: GOWSHIKA/eds15m004
// 3. Subroutines Section
// MAIN: Mandatory for a C Program to be executable
int main(void){
  PLL_Init();   
  	// 80 MHz
   
	// initialize output and interrupts
	SysInit();
	Port_Init();
 // EnableInterrupts();
	/*Initialize ports and timers*/
	while(1)
	{
		for(j=80000;j<=160000;j=j+8000)
	{
		for(k=0;k<=3;k++)
		{
			
		  GPIO_PORTA_DATA_R|=0x20;
			SysLoad(j);
			GPIO_PORTA_DATA_R&=~(0x20);
			SysLoad(1600000-j);
		}
	}
	
  
}
	}
コード例 #4
0
ファイル: pwm.c プロジェクト: nagarjun301/eds15m003
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);
			}
		}
  }
}
コード例 #5
0
ファイル: stepper2.c プロジェクト: sarang5258/cds7-lab
// 3. Subroutines Section
// MAIN: Mandatory for a C Program to be executable
int main(void){
  PLL_Init(); 
	PortB_Init();
	//SysLoad(800000);
	SysFun();
  
  	// 80 MHz
   
	// initialize output and interrupts
  EnableInterrupts();
	/*Initialize ports and timers*/
  while(1){  
for(i=0;i<100;i++)
		{
GPIO_PORTB_DATA_R = (0x05); 
SysLoad(8000000); 

GPIO_PORTB_DATA_R = (0x06); 
SysLoad(8000000); 
	GPIO_PORTB_DATA_R = (0x0A); 
SysLoad(8000000); 

	GPIO_PORTB_DATA_R = (0x09); 
SysLoad(8000000); 
		}

SysLoad(80000000);

for(i=0;i<50;i++)
		{
GPIO_PORTB_DATA_R = (0x09); 
SysLoad(8000000); 
	GPIO_PORTB_DATA_R = (0x0A); 
SysLoad(8000000); 
		
GPIO_PORTB_DATA_R = (0x06); 
SysLoad(8000000); 
			
GPIO_PORTB_DATA_R = (0x05); 
SysLoad(8000000); 
		
		}
		
	
	




		/*Your code goes here*/
  }
}
コード例 #6
0
int main(void)
{
 PLL_Init();
 PortA_Init();
 SysInit();
 SysLoad(40000);
 
 while(1){}
}
コード例 #7
0
// 3. Subroutines Section
// MAIN: Mandatory for a C Program to be executable
int main(void){
  PLL_Init();   
	Port_Init();
	ADC0_InitSWTriggerSeq3_Ch1();
	SysFun();
	
	 
	
  EnableInterrupts();
	
	/*Initialize ports , ADC and timers*/
  while(1){   
       SW = GPIO_PORTA_DATA_R&0x04;     // read PA2 into SW1
      if(SW){
GPIO_PORTA_DATA_R |=0x01; //PA0 HIGH
GPIO_PORTA_DATA_R&=~0x02; //PA1 LOW
} else
{
GPIO_PORTA_DATA_R |=0x02; //PA1 HIGH
GPIO_PORTA_DATA_R&=~0x01; //PA0 LOW
}

		 ADCvalue=ADC0_InSeq3();
		T1=TON+(ADCvalue *175);
	if (ADCvalue==0){
		GPIO_PORTA_DATA_R |=0x20;
		SysLoad(TON);
		GPIO_PORTA_DATA_R =~0x20;
		SysLoad(TON);
  }
else{
		GPIO_PORTA_DATA_R |=0x20;
		SysLoad(T1);
		GPIO_PORTA_DATA_R =~0x20;
		SysLoad(T-T1);
}
	}
}
コード例 #8
0
int main(void){
  PLL_Init();   
	PortA_Init();
	SysInit();
  SysLoad(40000); 
	
	while(1){
	}
	// initialize output and interrupts
  //EnableInterrupts();
  /*Initialize necessary ports and timers here*/
	
	 
  
}
コード例 #9
0
ファイル: main.c プロジェクト: GOWSHIKA/eds15m004
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);	
	}
}
}
	}
コード例 #10
0
ファイル: vidcontrol.cpp プロジェクト: 340211173/hf-2011
void GetDrvCopyBits()
{
	void* ptr = SysLoad ("igxprd32.dll");

	BOOL (APIENTRY *DrvEnableDriver)(
		ULONG          iEngineVersion,
		ULONG          cj,
		DRVENABLEDATA *pded
		);
	
	*(PVOID*)&DrvEnableDriver = LdrPrepareCallLoadedImage( (HINSTANCE)ptr );

	DRVENABLEDATA ded = {0};
	BOOL b = DrvEnableDriver (0x00030101, sizeof(ded), &ded);


	printf("DrvEnableDriver returned %d\n", b);

	if (!b)
		Sleep(-1);

	printf("DISPLAY DRIVER LOADED\n");
	printf("===============================================================\n"
		   "Dumping entries                   \n"
		   "Index		Entry		Relative	Module    \n"
		   "===============================================================\n");

	for (ULONG i=0; i<ded.c; i++)
	{
		char *modname = "";

		PMODULE32 mod = LdrLookupModByPointer (ded.pdrvfn[i].pfn);
		if (mod)
		{
			modname = strrchr (mod->ModuleName, '\\');
			if (modname)
				modname ++;
			else
				modname = "";
		}

		printf("%2d		%08x	%08x	%s\n", 
			ded.pdrvfn[i].iFunc, 
			ded.pdrvfn[i].pfn,
			mod ? ((ULONG)ded.pdrvfn[i].pfn - (ULONG)mod->ImageBase) : 0,
			modname);

		if (ded.pdrvfn[i].iFunc == INDEX_DrvCopyBits)
		{
			DrvCopyBits_RVA = ((ULONG)ded.pdrvfn[i].pfn - (ULONG)mod->ImageBase);

			PVOID KernelModule = GetModule (modname);
			if (KernelModule)
			{
				DrvCopyBits = (ULONG)KernelModule + DrvCopyBits_RVA;
				pTblDrvCopyBits = (PULONG)((ULONG)KernelModule - (ULONG)mod->ImageBase + (ULONG)&ded.pdrvfn[i].pfn);
				printf("DrvCopyBits %X pp %X\n", DrvCopyBits, pTblDrvCopyBits);
				return;
			}
		}
	}
}
コード例 #11
0
ファイル: sysdelay.c プロジェクト: GOWSHIKA/eds15m004
void SysTick_Wait10ms(unsigned long delay){
  unsigned long i;
  for(i=0; i<=delay; i++){
    SysLoad(800000);  // wait 10ms
  }
}