Ejemplo n.º 1
0
int main()
{
	// default peripheral freq. is CPUCoreFrequency / 2 (cf. system.c)
	#if defined(__32MX220F032D__)||defined(__32MX250F128B__)||defined(__32MX220F032B__)
	SystemConfig(40000000);	// default clock frequency is 40Mhz
	#else
	SystemConfig(80000000);	// default clock frequency is 80Mhz
	#endif

	IOsetSpecial();
	IOsetDigital();
	IOsetRemap();

	#ifdef __ANALOG__
	analog_init();
	#endif

	#ifdef __MILLIS__
	millis_init();
	#endif

	#ifdef __PWM__
	PWM_init();
	#endif    

	#ifdef __USBCDC
	CDC_init();
	#endif    

	#ifdef __RTCC__
	RTCC_init();
	#endif    
	
	setup();

	while (1)
	{
		#ifdef __USBCDC
			#if defined(__32MX220F032D__)||defined(__32MX250F128B__)||defined(__32MX220F032B__)
				USB_Service( );
			#else
				CDCTxService();
			#endif
		#endif
 
		loop();
	}

	return(0);    
}
Ejemplo n.º 2
0
int main()
{
	#if defined(PIC32_PINGUINO) || defined(PIC32_PINGUINO_OTG)
	TRISDbits.TRISD9=1;		// because PORTB is shared with SDA on Olimex board
	TRISDbits.TRISD10=1;		// because PORTB is shared with SCL on Olimex board
	#endif	

	SystemConfig(80000000);	// default clock frequency is 80Mhz
									// default peripheral freq. is 40MHz (cf. system.c)

	// All pins of PORTB as digital IOs
#ifdef __32MX220F032D__
	ANSELA = 0;
	ANSELB = 0;
	ANSELC = 0;
#else
	AD1PCFG = 0xFFFF;
#endif
	
	#ifdef __ANALOG__
	analog_init();
	#endif

	#ifdef __MILLIS__
	millis_init();
	#endif

	#ifdef __PWM__
	PWM_init();
	#endif    

	#ifdef __USBCDC
	CDC_init();
	#endif    

	#ifdef __RTCC__
	RTCC_init();
	#endif    
	
	setup();

	while (1)
	{
		#ifdef __USBCDC
		CDCTxService();
		#endif    
		loop();
	}

	return(0);    
}