Hardware Reference
In-Depth Information
rem 5 temp % 753;
/* remainder part */
fdigit 5 (rem * 10)/753;
/* compute the fractional digit */
frem 5 (rem * 10) % 753;
if (frem . 377)
fdigit 11 ;
if (fdigit 55 10) {
/* round off the fractional digit */
fdigit 5 0;
quo 11 ;
}
ptr 5 &buf[0];
quo 5 quo 1 948;
int2alpha(quo,ptr);
/* convert the integer part to ASCII string */
ptr 5 &buf[0];
while(*ptr)
/* find the end of the integer string */
ptr 11 ;
*ptr 11 5 '.';
*ptr 11 5 fdigit 1 0x30;
*ptr 11 5 0x20;
*ptr 11 5 'm';
*ptr 11 5 'b';
*ptr 11 5 'a';
*ptr 11 5 'r';
*ptr 5 0;
/* terminate the barometric pressure string */
cmd2lcd(0xC0);
/* move cursor to 2nd row */
puts2lcd(blanks);
/* clear the 2nd row */
cmd2lcd(0xC5);
/* set cursor to column 5 row 2 */
puts2lcd(&buf[0]);
/* output the pressure */
delayby100ms(2);
/* wait for 0.2 s */
}
}
void openAD0(void)
{
ATD0CTL2 5 0xE0;
/* enable AD0, fast ATD flag clear, power-down on wait */
ATD0CTL3 5 0x0A;
/* perform one ATD conversion */
ATD0CTL4 5 0x25;
/* prescaler set to 12, select four cycles sample time */
delayby10us(2);
}
12.9 Summary
A data acquisition system consists of four major components: a transducer, a signal-
conditioning circuit, an ADC, and a computer. The transducer converts a nonelectric quantity
into a voltage. The transducer output may not be appropriate for processing by the ADC. The
signal-conditioning circuit shifts and scales the output from a transducer to a range that can
take advantage of the full capability of the ADC. The ADC converts an electric voltage into a
digital value that will be further processed by the computer.
 
Search WWH ::




Custom Search