Hi!
I am sending a little part of my code. It looks good to me; it is working fine, but I would like to have some oppinion about it. There might be some things to be improved. Thank you.
Antal.
The code:
…
while(1)
{
SD16CTL = SD16REFON + SD16SSEL_1; // 1.2V ref, SMCLK
SD16INCTL0 = SD16INCH_0 ; // A0+/-
SD16CCTL0 = SD16UNI + SD16IE; // 256OSR, unipolar, interrupt enable
SD16AE = SD16AE0; // P1.0 A0+, A0- = VSS
SD16CCTL0 |= SD16SC; // Set bit to start conversion
while ((SD16CCTL0 & SD16IFG)==0);{}; // wait for result
SD16CCTL0 &=~SD16IE;
I=SD16MEM0/256;
SD16INCTL0 = SD16INCH_2 ; // A2+/-
SD16CCTL0 = SD16UNI + SD16IE; // 256OSR, unipolar, interrupt enable
SD16AE = SD16AE4; // P1.4 A2+,P1.6 A3+ A1- = VSS
SD16CCTL0 |= SD16SC; // Set bit to start conversion
while ((SD16CCTL0 & SD16IFG)==0);{}; // wait for result
SD16CCTL0 &=~SD16IE;
Usp=SD16MEM0/256;
SD16INCTL0 = SD16INCH_3; // A1+/-
SD16CCTL0 = SD16UNI + SD16IE; // 256OSR, unipolar, interrupt enable
SD16AE = SD16AE6; // P1.1 A1+, A1- = VSS
SD16CCTL0 |= SD16SC; // Set bit to start conversion
while ((SD16CCTL0 & SD16IFG)==0){}; // wait for result
SD16CCTL0 &=~SD16IE;
Ucap=SD16MEM0/256;