#include<eZ8.h>
#include <stdio.h>
#include <sio.h>
#include <adc.h>
unsigned int VINSUP; // Voltage from Supercapacitor
unsigned int VINREF; // Voltage from Battery
void main(void)
{
ADCCTL0 = 0xAE; // Conversion Enabled
// Reference Buffer Disabled
// Continuous Mode
ADCCTL1 = 0x01; //Single Ended Buffered Input with Unity Gain
PCDD = 0xF7; // PC3 as output and others as input
PCOUT = 0xFF; // Turn off all ports
while(1)
{
if ((PCIN & 0x01) == 0) // To check if PC0 is low or not
{
PCOUT = 0xF7;
}
else
{
PCOUT = 0xFF;
}
}