View previous topic :: View next topic |
Author |
Message |
bbonilla
Joined: 08 Feb 2006 Posts: 9 Location: Arizona
|
Posted: Fri Nov 17, 2017 1:00 am Post subject: XmegaE5 timer config for pwm motor control |
|
|
Hello I need help with a small sample on how to configure the timers to produce a Pwm output for controlling a motor.
I need 16bits and a freq of 7-15 KHz would be fine.
I can can’t get any of of my timer configs to work on the E5.
This is what I want to duplicate, it works on my other projects, this will not compile at all.
Config Tcc0 = Pwm , Prescale = 8 , Comparea = Enabled , Resolution = 16 , Compareb = Enabled , Resolution = 16 , _
Comparec = Enabled , Resolution = 16 , Compared = Enabled , Resolution = 16
Tcc0_per = &HFFFF
I get the following errors:
Error : 46 Line : 52 Assignment error, unknown variable (DIM) [TCC0_CTRLA: 0 &H04: 112] , in File : D:\MyProjects\ReleasedProjects\BlockMotorController\BlockMotorController.bas
Error : 46 Line : 52 Assignment error, unknown variable (DIM) [TCC0_CTRLB: 0 &HF3: 112] , in File : D:\MyProjects\ReleasedProjects\BlockMotorController\BlockMotorController.bas
Error : 46 Line : 52 Assignment error, unknown variable (DIM) [TCC0_CTRLE: 0 &H02: 112] , in File : D:\MyProjects\ReleasedProjects\BlockMotorController\BlockMotorController.bas
Please help
Thank you in advanced
BB
(BASCOM-AVR version : 2.0.7.8 )
Last edited by bbonilla on Sun Nov 19, 2017 9:35 pm; edited 2 times in total |
|
Back to top |
|
|
db3
Joined: 18 Jan 2005 Posts: 7
|
Posted: Sun Nov 19, 2017 6:30 pm Post subject: Re: XmegaE5 timer config for pwm motor control |
|
|
Put a space between the comma and the underscore on the first line. (Space plus underscore for line continuation) |
|
Back to top |
|
|
bbonilla
Joined: 08 Feb 2006 Posts: 9 Location: Arizona
|
Posted: Sun Nov 19, 2017 9:35 pm Post subject: Re: XmegaE5 timer config for pwm motor control |
|
|
db3 wrote: | Put a space between the comma and the underscore on the first line. (Space plus underscore for line continuation) |
Thank you for your interest in my problem, the error was introduced during to cut&paste from my program.
The error that I get are:
Error : 46 Line : 52 Assignment error, unknown variable (DIM) [TCC0_CTRLA: 0 &H04: 112] , in File : D:\MyProjects\ReleasedProjects\BlockMotorController\BlockMotorController.bas
Error : 46 Line : 52 Assignment error, unknown variable (DIM) [TCC0_CTRLB: 0 &HF3: 112] , in File : D:\MyProjects\ReleasedProjects\BlockMotorController\BlockMotorController.bas
Error : 46 Line : 52 Assignment error, unknown variable (DIM) [TCC0_CTRLE: 0 &H02: 112] , in File : D:\MyProjects\ReleasedProjects\BlockMotorController\BlockMotorController.bas
I think that there is no full support of the XMAX32E5 by Bascom.
I hope I'm wrong.
BB |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Sun Nov 19, 2017 10:23 pm Post subject: |
|
|
Please compare files xm32e5def.dat and some of near xm128A3Udef.dat and look for [CONFIG-TCC0] with function CTRL+F (control find)
Then You should contact/write to support because I know they work fast |
|
Back to top |
|
|
db3
Joined: 18 Jan 2005 Posts: 7
|
Posted: Sun Nov 19, 2017 11:31 pm Post subject: |
|
|
It compiled fine on the xm256A3U project I am working on.
Fails as yours using xm32e5def.dat file.
EDC nailed it - you need support, the file definitions are there and the same for TCC0.
Something further is wrong. |
|
Back to top |
|
|
db3
Joined: 18 Jan 2005 Posts: 7
|
Posted: Sun Nov 19, 2017 11:58 pm Post subject: |
|
|
Originally thought this was just a simple syntax error, should have known.
Failed to see first time, first 3 timers are commented out in dat file because...
If you look at the datasheet , the only timers available on the xm32E5 are
TCC4, TCC5, and TCD5.
Hopefully you can use one of those. |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Mon Nov 20, 2017 12:05 am Post subject: |
|
|
Oops I also forget about it despite reading E5 manual note
Good that @db3 check this again. This is the thing worth remember.
Like another E5 issue where you must clear interrupt flag by your software instead hardware clearing interrupts flags by simply execute jump to corresponding interrupt routine. |
|
Back to top |
|
|
bbonilla
Joined: 08 Feb 2006 Posts: 9 Location: Arizona
|
Posted: Sat Dec 09, 2017 11:06 pm Post subject: |
|
|
Thank all of you for your support, This is what it took to get the PWM's to work.
Tcc5_per = 4000 ' Rep Freq 8Khz
Tcc5_cca = 0 'OCA Pin 12
Tcc5_ccb = 0 'OCB Pin 11
Tcc5_ctrla = 1 ' Pre Scaler 8
Tcc5_ctrlb = &H03 ' PWM Mode
Tcc5_ctrld = 0
Tcc5_ctrlc = 0
Tcc5_ctrle = &H05 'CCA CCB
Pwm1 Alias Tcc5_cca
Pwm2 Alias Tcc5_ccb
This work well at 8Khz just like I needed. Thank you.
BB |
|
Back to top |
|
|
|