You are on page 1of 11

. // Time-Base Phase Register EPwm2Regs. // Set duty 50% initially void main(){ #define period 1000 EPwm2Regs. PWM frequency = 1 EPwm2Regs.CTRMODE = TB_COUNT_UP. // Time-Base Counter Register EPwm2Regs.PRDLD = TB_IMMEDIATE.all = 0. Asymmetric PWM Output Uint16 duty_cycle_A=500. // Set timer period. // Set duty 50% initially Uint16 duty_cycle_B=500.TBCTL.TBPHS. // Set Immediate load EPwm2Regs.bit.TBPRD = period.TBCTL.bit.TBCTR = 0.

CAU = AQ_CLEAR.AQCTLA.bit. // Clear PWM2A on event A.// Setup shadow register load on ZERO EPwm2Regs.ZRO = AQ_SET.CMPCTL. EPwm2Regs.CMPCTL.CBU = AQ_SET.AQCTLA.bit.AQCTLB. // Set Compare values EPwm2Regs. EPwm2Regs. up count . EPwm2Regs.AQCTLB.bit.bit.LOADBMODE = CC_CTR_ZERO.ZRO = AQ_CLEAR.half. // Set duty 50% initially EPwm2Regs.bit.SHDWBMODE = CC_SHADOW. // Set duty 50% initially // Set actions EPwm2Regs. up count EPwm2Regs.SHDWAMODE = CC_SHADOW.CMPA.CMPCTL.CMPA = duty_cycle_A.bit. // Set PWM2B on Zero EPwm2Regs.bit.bit. // Set PWM2A on Zero EPwm2Regs.LOADAMODE = CC_CTR_ZERO. // Clear PWM2B on event B.CMPCTL.CMPB = duty_cycle_B.

CMPA.) { EPwm2Regs.CMPA = duty_cycle_A.for(.half. } . EPwm2Regs..CMPB = duty_cycle_B.

// duty cycle 50% . // duty cycle 50% Uint16 duty_cycle_B=500.Uint16 duty_cycle_A=500.

Uint16 duty_cycle_A=100. // duty cycle 90% . // duty cycle 10% Uint16 duty_cycle_B=900.

// duty cycle 10% .Uint16 duty_cycle_A=100. // duty cycle 10% Uint16 duty_cycle_B=100.

EPwm2Regs.CMPA. //duty_cycle_B = 100 } .CMPA.half.CMPA =period*3.half.CMPA. EPwm2Regs.CMPA =period*1. EPwm2Regs.half..CMPA =period*7. EPwm2Regs.) { EPwm2Regs.CMPB = duty_cycle_B.for(.CMPA =period*5.half.CMPA.

all = period. { EPwm2Regs.CMPA =period*5..PRD. void delay() delay().CMPA =period*1.bit.half.TSS=1. CpuTimer0Regs.RegsAddr = &CpuTimer0Regs.bit.TIF==0).CMPA.TCR.bit. CpuTimer0.half.CpuTimer0Regs. } delay().CMPA =period*3. delay().half. EPwm2Regs.CMPA =period*7.CpuTimer0Regs.CMPA.) { EPwm2Regs.TIF=0. while(CpuTimer0Regs.TCR. CpuTimer0Regs.TCR. delay(). EPwm2Regs.TSS = 0. .CMPA.bit.CMPA.half.TCR.for(.

Comparison between piccolo controlstick and piccolo LaunchPad Source http://www.com/tool/Launchxl- F28069m .ti.

097749 Kg .N Features Piccolo Piccolo controlpad O controlstickF28069 F28069M 1 Input/output 32 80 pins 2 Clock speed 80 MHz 90 MHz 3 Embedded 256KB of Flash 256KB of Flash Memory 4 Interfacing Small USB memory stick USB cable medium 5 Flash memory 256 KB  256KB 6 bits  32bit 32 bit 7 weight . Comparison between piccolo controlstick and piccolo LaunchPad S.154987Kg 8 ADC pins 12 Bit 12 Bit 9 Encoder single dual 10 RAM 100 KB 96KB .