Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

XMega PWM Question

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
enniom

Bascom Member



Joined: 20 Oct 2009
Posts: 474

PostPosted: Wed Aug 13, 2014 12:34 am    Post subject: XMega PWM Question Reply with quote

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 = &HFFFF                                          
Tcd1_cca = 1000                                          
Tcd1_ccb = 1000

do
loop
end
 


(BASCOM-AVR version : 2.0.7.7 )
Back to top
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 1827

blank.gif
PostPosted: Wed Aug 13, 2014 8:57 am    Post subject: Reply with quote

A simulation in AVR-Studio shows no irregularities, I'd suggest to check the hardware, i.e. toggle PD5.
Back to top
View user's profile
enniom

Bascom Member



Joined: 20 Oct 2009
Posts: 474

PostPosted: Wed Aug 13, 2014 2:57 pm    Post subject: Reply with quote

MWS,

As usual, you were correct. Thanks for taking the time to help.
Back to top
View user's profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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