#include #include #define NUM_SAMPLES 1000 /* change the number of data samples */ #define MAX_REG_LENGTH 2 /* this says that the max length of a register is 2 bytes */ Writetoreg (int); Read (int,char); char *datapointer = store; char store[NUM_SAMPLES*MAX_REG_LENGTH + 30]; void main() { char a; DDRB |= 0x08; /* PB3 is an output */ PORTB |= 0x08; /* /CS set to high */ Writetoreg(0x10); /* set the gain to 1, standby off and set the next operation as write to the setup register */ Writetoreg(0x68); /* set bipolar mode, buffer off, no filter sync, confirm clock as 2.4576MHz, set output rate to 60Hz and do a self calibration */ while(PORTB & 0x04); /* wait for /DRDY to go low ---- /DRDY is PB3 */ for(a=0;a