Exemple #1
0
void setup() {
    configPins();
    initDisplay();
    detectInputMode();
    menuInit();
    i2cInit();
}
Exemple #2
0
int main(void) {
	WDTCTL = WDTPW | WDTHOLD;	// Stop watchdog time
	configClocks();
	configPins();
	configTimerA0();
	configTimerA1();
	configADC10();
	initSPI();
	initMessage();

	_enable_interrupts();		// enable global interrupts

	while (1) {
		//pack our new message
		GPIOUpdate();
		currentUpdate();
		messagePackServoValues(servoValue);
	}
}
int16_t main(void)
{
	//TODO discharge calculations
	int i = LTC3;
	int j;
	char voltages[19];
	int selfCheck = 0;

	configPins();
	configClock();
	

	//Comment out next 5 lines if debugging
	selfCheck += initLTC();
	selfCheck += initADC();//initADC();
	if(selfCheck == 2){
		setRelay(RELAY_ON);
	}

    while(1)
    {	
		//comment out next 4 lines if debugging
		for(i = LTC1; i < LTC_ALL; i++){
			LTC_readVoltages(i);
		}
		checkADC();


		//uncomment next 0 lines if debugging RS-485
		
		//unComment next 3 lines if debugging LTC
		//LTC_writeConfig(LTC_ALL, 0);
		//LTC_readVoltages(i);
		//LTC_analyzeVolts(i);

		//uncomment out next 3 lines if debugging ADC
//		j = ADCReadRaw(TEMP1_CHANNEL);
//		j++;
//		j--;
	}
}
int main()
{
    uint32_t Counter=0;
    initClockHSI16();
    configPins(); 
    initUART(9600);
    initRTC();
    initADC();    
    enable_interrupts();
    while(1)
    {
        
        resume_from_low_power(); // Interrupt woke up CPU - restore systems to full wakefulness
        // Awake now, do some control or other task.  
        GPIOB_ODR |= BIT3;  // Turn on LED
        testADC();          // read ADC channel 0 and output result to USART2
        drain(); // wait for any pending serial transmissions to end otherwise will exit sleep prematurely
        GPIOB_ODR &= ~BIT3; // Turn off LED
        low_power_mode();   // off to sleep to save power  
        
    } 
    return 0;
}