9905 views|0 replies

4

Posts

0

Resources
The OP
 

Using DSP timer to realize square wave output [Copy link]

1. Initialize the timer value to half a period value.
ConfigCpuTimer(&CpuTimer2, 100, 10);
StartCpuTimer2();
2. The interrupt procedure is as follows:
interrupt void CpuTim2Int(void)
{
Uint32 i;

if (State==1) //Level reverse state is level value
State=0;
else {
State=1;
xxx++; //xxx is the number of pulses, stop after sending 300000 pulsesif
(xxx==300000) {
xxx=0;
StopCpuTimer2();
}
CpuTimer2Regs.PRD.all=i/2; //i is the pulse period value
GpioDataRegs.GPATOGGLE.bit.GPIOA0=1;//pto2

}

This post is from DSP and ARM Processors
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list