Trouble combining code for I/O and PWM (TPM1) - DEMO9S08AW60E

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Trouble combining code for I/O and PWM (TPM1) - DEMO9S08AW60E

1,953 次查看
Venom2000
Contributor I
Hello everyone,
I've received some help here before and greatly appreciated all of it. I think this is my last question before I'll be all set.
 
I'm using a Freescale Demo board: DEMO9S08AW60E (HCS08)
 
1. Currently I have two input ports being used (PTA2, PTA4) and two output ports (PTA3,PTA5). The input ports are taking in 5V then triggering a short delay (using a basic counter). After the delay, the 5V is then outputted to the other ports (depending on which input port was activated with the initial input).
 
2. I also have a TMP1 setup to output a 100kHz signal.
 
When I setup a program for each of these separately they work fine (the PWM signal or the I/O's). I found that if I change the "overflow interrupt" in Device Initialization on the TPM1 then either the I/O's or the PWM work, but never together. If the "overflow interrupt" flag is set to "enable" then the PWM output of 100kHz works fine. If the "overflow interrupt" flag is set to "disable" then the PWM no longer outputs, but the I/O (w/delays) work fine.
Any ideas?
 
Thanks,
 
-Chris 
 
 
Added p/n to subject.


Message Edited by NLFSJ on 2007-11-29 11:55 AM
标签 (1)
0 项奖励
回复
2 回复数

991 次查看
Witztronics
Contributor IV
Chris,

We have demo code on our website that uses the AW16.

http://witztronics.com/product_info.php?cPath=22_1&products_id=39

It's not exacty what you are doing, but it monitors port pins and lights leds accordingly and uses the PWM as a DAC output.  It seems with a little modification, it could do what you are trying to accomplish.

Hope it helps.
0 项奖励
回复

991 次查看
bigmac
Specialist III
Hello Chris,
 
If you have configured the TPM channel for PWM operation (assuming edge aligned), my understanding is that the PWM operation should occur whether or not the overflow interrupt is enabled.  If you are counting timer overflows to generate your delay, the period between each count will be very short (10us), assuming you are using the same TPM module for both.
 
Do you happen to be using Processor Expert?  If so, I guess it is possible there is some sort of conflict here, perhaps with the TPM1MOD setting.  Have you tried using TPM1 module for PWM, and TPM2 module for the delays?
 
Regards,
Mac
 
0 项奖励
回复