Exemplo n.º 1
0
//FIRST DIES AT 5000 Hz
//------------------------------------------------------------------------------------
// MAIN Routine
//------------------------------------------------------------------------------------
void main(void)
{
	char high=0;
	char low = 0;
	WDTCN = 0xDE;						// Disable the watchdog timer
	WDTCN = 0xAD;						// Note: = "DEAD"!
	
	SYSCLK_INIT();						// Initialize the oscillator
	PORT_INIT();						// Initialize the Crossbar and GPIO
	UART0_INIT();						// Initialize UART0
	ADC_Init();							// Initialize ADC0
	DAC_Init();							// Initialize DAC0
	MAC_Init();							// Initialize MAC0

	SFRPAGE = UART0_PAGE;				// Direct output to UART0

	//initialize ADC converter

	//select 00 on AD0CM mux
	ADC0CN &= ~0x0C;
	//clear AD0INT
	AD0INT = 0;
	//AD0BUSY = 1 to start conversion
	AD0BUSY = 1;

	//while AD0INT != 0
	while(AD0INT != 0);


	printf("\033[2J");					//clear screen
	printf("We will not sow. \n\r");		//running

	while(1)
	{
		//printf("Still running. \n\r");
		olderIn = oldIn;
		oldIn = input;
		input = do_ADC();

		oldOut = output;
		output = do_MAC();

		do_DAC();

	//	printf("I: %d  I1: %d  I2: %d  O: %d  O2: %d \n\r", input, oldIn, olderIn, output, oldOut); 
	}

}
Exemplo n.º 2
0
void cpu_6502_ADC_abx(struct _6510_cpu* cpu, char mem[][9]){
  int eadr = abx_adr_mode(cpu, mem);
  do_ADC(cpu, mem[eadr]);


}