#include "OB6710.h"
#include "ACMP1.h"

extern void ACMP1_Test_Channel(void);
extern bit g_Acmp1Interrupt;
extern void ACMP1_Set_Input(unsigned char pChannel, unsigned char nChannel, unsigned char Level);

unsigned char Buff, P_Channel, N_Channel;

void main(void)
{
	ACMP1_Test_Channel();
	while(1);
}

void ACMP1_Test_Channel(void)
{
	P0M0 = 0x00;
	P0M1 = 0xff;
	P1M0 = 0x00;
	P1M1 = 0x03;
	P2M0 = 0x00;
	P2M1 = 0x00;
	P3M0 = 0x00;
	P3M1 = 0x00;
	
	ACMPHYS = 0x11;
	N_Channel = 1;
	P_Channel = 0;
  DACVAL1 = 125; // voltage = 2V
	DACCON = DACCON | 0x02;
	
	ACMP1_Open(P_Channel, N_Channel,  d_HYS_RANGE_30);	

	while(1)
	{
		Buff = ACMP1_OutputStatus();	
		if(Buff == 0x00)
			P2_6 = 0;
		else
			P2_6 = 1;
	}
}
	

