Search the web
Sign In
New User? Sign Up
68HC12
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Request for help with clock-cycle calculation   Message List  
Reply | Forward Message #16031 of 16526 |
Re: [68HC12] Request for help with clock-cycle calculation

"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
>
>
> ------------------------------------
>




Thu Jul 31, 2008 9:26 am

keffffek
Offline Offline
Send Email Send Email

Forward
Message #16031 of 16526 |
Expand Messages Author Sort by Date

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 ...
jambotronic
Offline Send Email
Jul 31, 2008
8:23 am

... what part is it? ... 2MHz AD clock AD prescaller setting is correct, assuming bus clock is 8MHz. You are not using PLL, right? But 18 AD cycles per...
Edward Karpicz
keffffek
Offline Send Email
Jul 31, 2008
9:26 am

Hi Edward and thank you for the reply. ... is 8MHz. You are not using PLL, right? But 18 AD cycles per conversion? Are you talking about old pre S12 part? If ...
jambotronic
Offline Send Email
Jul 31, 2008
1:43 pm

Hi Sandy ... To answer what from are those 9us. Your AD clock is 2MHz. Single channel conversion takes in your case 18 AD clock cycles. That's 9us ... Not no...
Edward Karpicz
keffffek
Offline Send Email
Jul 31, 2008
5:24 pm

Edward, sincerely, I appreciate your time and patience and thank you for giving the help you have; you have provided me with exactly what I was looking for. ...
jambotronic
Offline Send Email
Jul 31, 2008
9:09 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help