
#include "AD_Wandler.h"

#include "alps\alps.h"
#include "alps\fehlernr.h"

void main()
{

int16 Data;
int8 error;
int16 i16 = 0b1111000011110000;
int8 REG = 0b11110000;


setup_spi ( SPI_MASTER |SPI_H_TO_L |SPI_CLK_DIV_64 );	/* settings of the SPI port*/

output_high(LED_Rot);
error = connect_with_address();		//connecting the notebook with bluetooth
Fehler(error);			

delay_ms (500);

printf("Test von printf\n\r");
printf("AUSGABE von i16:%lu\n\r",i16);
printf("AUSGABE von REG:%x\n\r",REG);



	
		
		output_low(CS4);  	//selecing the AD7705 
		
		Spi_write (0x20);	/* Active Channel is Ain1(+)/Ain1(-), next operation as write to the clock register*/
		
		
		spi_write (0x14);	/* master clock disabled, 2.4576MHz Clock, set output rate to 50Hz*/
		
		Spi_write (0x21);	/* Active Channel is Ain1(+)/Ain1(-), next operation as read to the clock register*/
		
		
		REG = Spi_read (0);	/* reading the clock register*/
		
		printf("CKLreg=%x\n\r",REG); //printing the value of the Clockregisters
	

	while(1);
}
			
		