Cho Sau Ngai

HC908GP32 - How to use the ATD at 20KHz

Discussion created by Cho Sau Ngai on Mar 22, 2007
Latest reply on Mar 24, 2007 by Mark Hotchkiss

Hi all,
Anyone can teach me how to use the ATD at 20KHz sampling rate.
void ATDInit(void) {
//UINT8 atdc;
//10 bits unsigned no prescler
ATD1C = 0x80; // /* ATD1 Control Register; 0x00000050 */
ATD1SC = 0x60; // /* ATD1 Status and Control Register; 0x00000051 */
ATD1PE = 0x01;

i use the internal clock only which should be 4Mhz. I know the conversion frequency is 0.5MHz - 2MHz right?
So in order to achieve 20KHz, what can do, use a timer??

thank you very much!

Alban Edit: FSL Part Number in Subject line + split/moved to appropriate location.

Message Edited by Alban on 2007-03-23 09:56 PM