Forum - MCS Electronics
View previous topic :: View next topic
Author
Message
enniom Joined: 20 Oct 2009 Posts: 537
Posted: Wed Aug 13, 2014 12:34 am Post subject: XMega PWM Question
Hello Forum,
Using XMEGA192 and would like 2 PWM outputs on PORTD.4 and PORTD.5
The code below works for PWM-A but not for -B.
Any suggestions? I have not been able to find the method in reading the datasheet.
Code: $regfile = "xm192a3def.dat"
$hwstack = 1200
$swstack = 1200
$framesize = 1200
$crystal = 32000000
'$noramclear
Config Osc = Enabled , 32mhzosc = Enabled , 32khzosc = Enabled
Config Sysclock = 32mhz '--> 32MHz
Bitwait Osc_status.1 , Set 'Check if RC2MRDY is ready '
Osc_pllctrl = &B10_0_00100
Set Osc_ctrl.4 'Enable PLL
Config Sysclock = Pll , Prescalea = 1 , Prescalebc = 1 _1 'use PLL
Config Portd.4 = Output
Config Portd.5 = Output
Config Tcd1 = Pwm , Prescale = 64 , Comparea = Enabled , Compareb = Enabled , Resolution = 16
Tcd1_per = &H FFFF
Tcd1_cca = 1000
Tcd1_ccb = 1000
do
loop
end
(BASCOM-AVR version : 2.0.7.7 )
Back to top
MWS Joined: 22 Aug 2009 Posts: 2262
Posted: Wed Aug 13, 2014 8:57 am Post subject:
A simulation in AVR-Studio shows no irregularities, I'd suggest to check the hardware, i.e. toggle PD5.
Back to top
enniom Joined: 20 Oct 2009 Posts: 537
Posted: Wed Aug 13, 2014 2:57 pm Post subject:
MWS,
As usual, you were correct. Thanks for taking the time to help.
Back to top
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum