AnsweredAssumed Answered

ATD Module in MC1321x

Question asked by Erwin Beck on Jan 16, 2020

The MC13211/212/213 Reference Manual states that the Analog to Digital (ATD) Module is part of MC1321x.

Examining C/C+ CodeWarrior Development Studio, I find "ADC_Interface.h" in PLM -> Interface folder, but only an empty ADC folder in PLM -> Source folder.

How can I import the ADC Interrupt and the ADC task into CodeWarrior?

Thank you

 

Erwin Beck

 

My CodeWarrior program is the imported BeeKit solution (HCS08 MAC Codebase 2.6.1) for the Freescale MC1321x-SRB board

 

Update:

It uses the hardware ATD and TPM modules of MC1321x to keep the speed of a motor constant under changing load conditions, by controlling the on/off PWM duty cycle based on ATD measurements of the Back ElectroMotive Force (EMF).

These two modules show up in PLM -> Interface as "ADC_Interface.h" and "TMR_Interface.h", defining TaskPriority and function prototypes.

On the other hand, PML -> Source lists the (empty) ADC folder and the TMR folder with "Timer.h" and "Timer.c".

This is what "Timer.c" does: ISR sends "TS_SendEvent(gTimerTaskID, mTMR_Event_c)" to the TMR task.

My program would just work marvellously under the magic of the Freescale Platform Task Scheduler and TS_SendEvent() messages.

Now if BeeKit went to all the trouble to include "ADC_Interface.h", "ADC.h" and "ADC.c" would certainly exist somewhere in the Freescale universe.

Thank you for your help.

 

Update:

Sometimes it helps to examine history:

Wednesday, September 8, 2004

San Diego-based Figure 8 Wireless has signed a partnership agreement with Freescale Semiconductor to provide its ZigBee protocol software on Freescale semiconductors. The partnership calls for Figure 8's Wireless ZigBee protocol software to ship with the Freescale MC13192 RF data modem and associated controller.

Based on this package Freescale offered BeeStack, and also the simplified IEEE 802.15.4 Stack limited to star networks.

This is reflected in BeeKit by the "HCS08 BeeStack codebase" and the "HCS08 MAC codebase".

 

As I have described above I created my first BeeKit solution for the MC1321x-SRB board, using HCS08 MAC codebase.

And by import created my first CodeWarrior project, running under IEEE 802.15.4 Stack.

In view of the common origin as described above, I had the curiosity to ask myself what would happen if I used HCS08 BeeStack codebase instead, and this is what came about:

- created my second BeeKit solution for MC1321x-SRB board, this time with HCS08 BeeStack codebase 

- by import created my second CodeWarrior project, running under BeeStack. But this was not my intention, was just   curious what I would find in PLM:

- found three files "ADC_Interface.h", "ADC.h" and "ADC.c", just what I was looking for!

- this is what "ADC.c" does: ISR sends "TS_SendEvent(gADC_TaskID, gADC_ConversionComplete_c)" to the ADC task

- moved the three files to my first CodeWarrior project

- successfully built first project

- successfuly flashed MC1321x-SRB board

 

Now I am ready to program "motor control under changing load", and this is going to be a lot of fun. But why the IEEE 802.15.4 Stack? This allows for controlling a model train locomotive through the air, forward and reverse, changing speed, turning on lights etc.

But even more important is the Timer task for dynamically controlling the PWM signals, working together with the ADC task for measuring EMF which is proportional to speed.

As the locomotive runs up a grade, speed and consequently EMF drop, and my program has to increase the PWM duty cycle in real time.

Erwin Beck

Outcomes