"jambotronic" wrote:
>I am a newcomer to the board and I would like to ask for some
> assistance on the following:
>
> I have a 16 MHz Elektronikladen 68HC12 Compact collecting data from
what part is it?
> all 8 of its onboard analogue channels and have set
> ATDCTL4 = 0x01 (2 MHz AD clock, 18 cycles per conversion, 8 bit
> mode).
>
2MHz AD clock AD prescaller setting is correct, assuming bus clock is 8MHz.
You are not using PLL, right?
But 18 AD cycles per conversion? Are you talking about old pre S12 part? If
so then that's right, 9us single channel conversion.
> The Serial Link connecting the controller to the host PC is
> operating at a baud rate of 19200 bps and I am outputting ASCI to
> the terminal window with the value of 6 (tabulated) of the 8 AD
> channels.
>
> I am graphing the result in time and I would like to calculate how
> many times each analogue channel is updated to the screen per
> second. My problem is that I do not know which specifications of the
> microcontroller to base the calculations on, and if one of the
> aforementioned frequencies is a limiting factor (by that I mean, are
> the comms fast enough to report EVERY ADC reading, etc). Also, I
> realise that the execution times of the other instructions within my
> code will be a factor, but the loop is extremely simple; the ADC
> port is being polled in a continuous loop:
>
Of course serial link speed is a limiting factor. In normal 8-N-1 mode one
byte takes ten 1/19200 periods. 8 data bits, one start bit and one stop bit.
That's 521us /byte.
>
> 1. Check condition of data collect bit on another port (assume to
> always be set to "ADC-data collect")
>
> 2. Write 6 of the 8 ADC bit vaules to variables
>
> 3. Output these values to the terminal window with a Tab character
> between each
Tab character? It looks like you are converting your readings to strings
first. This may take some time, especially if you are using some kind of
printf. Converting byte to string may give 1 to 3 characters. Plus Tab and
you have 2 to 4 characters per AD channel. That's 4*521us =~2ms to send one
channel over SCI. Sending all 8 channels takes about 16ms refresh period or
about 62Hz refresh rate.
Edward
>
> 4. Goto 1
>
>
> Many thanks in advance and I appreciate any advice offered.
>
>
> Sandy
>
>
> ------------------------------------
>