Previous

Next

Bottom

Contents

Glossary

Index

 

Persistor CF1 User's Manual

Configurable Timer Module Demonstration

July 1998

Revision 1.01

 Persistor Instruments Inc.
© 1998 All rights reserved.

Description

In the Application Notes section you will find a Metrowerks project folder entitled "CTM SQW Gen." This program is a fairly complex example that covers many, but not all, of the topics involved in using the Configurable Time Module. The CTM is a fairly complex part of the 68338 and it is highly recommended that you read the CTM manual (in your HTML documentation folder in your MotoCross Support folder) so that you can garner at least a broad understanding of how it works. This example consists of two source files and one additional header file. The file cf1main.c exists as a wrapper to demonstrate the underlying code. When the program runs it will prompt you for a pin number. Please enter one of the pins in the counter time module. See the CF1's hardware manual section to determine which pins are configurable timer module pins. Once you have selected a pin, the CF1 begins by outputting a 1Hz square wave on the designated pin. Every time you press a key, the frequency of the wave increases by 10Hz. The only way this will be meaningful is if you are watching the designated pin with an oscilloscope. When you have had enough press "."(no quotes) to stop the program.

Details

The underlying functions perform various tasks needed to setup, configure and start the Configurable Timer Module. The main function that you would interact with to use this functionality is StartSqWaveGen. StartSqWaveGen takes the following parameters:

pinNumber is the physical pin number, not the pin designation, but the number on connector C. Another function in the example handles the mapping of pin numbers to internal pin and submodule designations.

freq is the frequency in Hz you desire to output on the pin you selected. The CF1 should be able to produce any frequency from 1 Hz to the system clock/4 on any pin and system clock/2 on Single Action Submodule pins.

rescale tells the function whether or not to rescale the internal clocks of the CTM to provide optimum resolution for the frequency you specified. If you are using the CTM for other operation, then this is not recommended but StartSqWaveGen may not be able to output your desired frequency on the desired pin if you choose not to rescale, depending on the default or other current settings of the CTM when it is called.

While explaining the inner workings of the CTM is far beyond this example, once you have a good understanding of the CTM from reading its manual, all of this examples functionality should fall into place. The CTM is a very versatile submodule and to imply that the neatest thing it can do is generate square waves would be to short change its broad range of functionality, but this example does a good job of presenting examples of interactions with most of the different modules and should give you a good jumping off point for dealing with the CTM.

Previous

Next

Top

Contents

Glossary

Index

Tel: 508-759-6434

Fax: 508-759-6436

Copyright (C) 1998 Persistor Instruments Inc. - All Rights Reserved