Example #1
0
//Code blocks in the preamble are labelled with the names
//of the libraries in which the used functions are defined.
//Look in these to discover fundamental definitions.
void main(void) {

	EALLOW;//an assembly language thing required to allow access to system control registers
	SysCtrlRegs.WDCR = 0x68;//disable watchdog
	//clock
		SysClkInit(FIFTY);//set the system clock to 50MHz
	//gpio
		Uint8 out[3] = {31, 34};//0 is !shdn on wifi
		GpioOutputsInit(out, 2);	//34 is a pin that goes high/low each second
	//interrupts				//31 is ld2: lights when wifi is sending
		IsrInit(TINT0, &timerISR);
		IsrInit(ADCINT2, &adcISR);
	//adc
		AdcInit();
		AdcSetClock(FOURTH);
		AdcSetupSOC(SOC3, ADCB6, SOFTWARE);
		AdcEnableIsr(SOC3, ADCINT2);
	//clock
		TimerInit(1.0);//set the timer to 1kHz and start. Relies on SysClkInit, so call that first.
	EDIS;//disallow access to system control registers

	while(1) {
		loopcnt++;
	}
}
Example #2
0
void main (void)
{
	TTaskHandle xdata A2DTaskHandle, HeaterStatusTaskHandle, HeaterControlTaskHandle;
 	TTaskHandle xdata EdenProtocolTaskHandle, OHDBMessageDecodeTaskHandle;

 	WDTCN = 0xde;               // disable watchdog timer
  	WDTCN = 0xad;

	XBR_Init(); // Initialize cross bars 

    SysClkInit();
	Uart0Init();
	Timer_0_Init();

	SchedulerInit();

	InitCoolingFans(); // Material and UV
 	XilinxWatchdogInit();
 	SpiA2D_Init();
	A2D_Init();
 	SpiInit();
	E2PROMInit();
	XilinxInit();
	OHDBPotenmtrInit();
	Roller_Init();
 	Bumper_Init();
	CommunicationLossTaskInit();
	EdenProtocolInit();
	MessageDecodeInitOHDB();
	HeadData_Init();
 
	EA |= ENABLE;
	
    HeaterControlInit();
	PrintDrv_Init();
	SendWakeUpNotification();
    HeadData_ReadDataFromAllE2PROMs();

	A2DTaskHandle               = SchedulerInstallTask(SpiA2D_Task);
	EdenProtocolTaskHandle      = SchedulerInstallTask(EdenProtocolDecodeTask);
	OHDBMessageDecodeTaskHandle = SchedulerInstallTask(OHDBMessageDecodeTask);
	HeaterStatusTaskHandle      = SchedulerInstallTask(HeaterStatusTask);
	HeaterControlTaskHandle     = SchedulerInstallTask(HeaterControlTask);

	HeaterSetTasksHandles(HeaterStatusTaskHandle, HeaterControlTaskHandle);

	SchedulerResumeTask(GetXilinxWatchdogTaskHandle(),0);
	SchedulerResumeTask(A2DTaskHandle,0);
	SchedulerResumeTask(HeaterStatusTaskHandle,0); 
	SchedulerResumeTask(EdenProtocolTaskHandle,0);
	SchedulerResumeTask(OHDBMessageDecodeTaskHandle,0);
		
 
  	while(1)
  	{ 
	  	SchedulerRun();	
  	} 
}