View previous topic :: View next topic |
Author |
Message |
kamol
Joined: 02 Dec 2007 Posts: 33
|
Posted: Mon Jan 30, 2012 8:02 am Post subject: PWM PLL and Dead-time |
|
|
Hello members,
does any one success with PLL and Dead-time controll of PWM will Attiny?
any one can post sample?
thanks
Kamol |
|
Back to top |
|
|
kamol
Joined: 02 Dec 2007 Posts: 33
|
Posted: Tue Jan 31, 2012 4:39 am Post subject: |
|
|
waiting for someone response |
|
Back to top |
|
|
kamol
Joined: 02 Dec 2007 Posts: 33
|
Posted: Wed Feb 01, 2012 4:27 am Post subject: |
|
|
thinking it is not posssible with bascom. am i right? |
|
Back to top |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Wed Feb 01, 2012 10:41 pm Post subject: |
|
|
PWM is a single phase off-on signal, as I understand it. There is no "dead time", unlike with say a motor controlled by a 2 phase H bridge, where you turn off the drive from phase 1 ( say the upper FETs ), and allow a 'dead time' before switching on the drive from phase 2 ( the lower FETS ).
But certainly you can manufacture a PWM signal to control a 2 phase H bridge in software, and include some 'dead time' between the two phases. Any processor can do that, but not usually in hardware. Programming in Bascom can be used to do this, but probably only at relatively low PWM speeds, and you need access to the individual PWM clock signals.
The PLL in some AtTiny chips allows to run the PWM clock much faster than the processor clock, allowing for higher frequency PWM, or better timing resolution. Nothing to do with the actual sequencing of the signals themselves.
And of course if you run the PWM clock faster than the processor clock, then the processor cannot control the individual pulses, whether you use Bascom or any other software.
You need to study the actual chip datasheets from Atmel to know if they make a version which allows a mode with dead time in the hardware. Certainly they make several chips dedicated to motor control. If there is such a chip, with an AVR core, then Bascom can be used to set up the registers to output whatever the hardware will allow. _________________ Adrian Jansen
Computer language is a framework for creativity |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Thu Feb 02, 2012 1:00 am Post subject: |
|
|
Adrian,
in fact there exist such as a dead time generator in ATiny25/45/85.
Quote: | Dead Time Generator
The Dead Time Generator is provided for the Timer/Counter1 PWM output pairs to allow driving external power control switches safely. |
The answer is, Bascom provides no special commands, i.e. an extension to a config timerx, to control the dead time, but of course it can be done easily by controlling DTPS1, DT1A & DT1B.
I agree to your statement, the TO has to study carefully the data sheet. |
|
Back to top |
|
|
kamol
Joined: 02 Dec 2007 Posts: 33
|
Posted: Thu Feb 02, 2012 11:28 am Post subject: |
|
|
I have tried to enable dead time with following code with various combination, but get "assignment error".
have anyone ever success with enabling dead time with attiny?
$regfile = "ATtiny45.DAT"
$crystal = 4000000
$hwstack = 40
$swstack = 40
$framesize = 40
Tccr1 = Bits(pwm1a)
Tccr1 = Bits(com1a0)
Tccr1 = Bits(cs11)
Ocr1a = 100
Ocr1b = 0
Pllcsr = Bits(plle)
Waitms 100
Pllcsr = Bits(pcke)
'Dtps1 = Bits(dtps11)
'Dtps1 = Bits(dtps10)
' Dt1a = Bits(dt1ah3)
' Dt1a = Bits(dt1ah2)
' Dt1a = Bits(dt1ah1)
' Dt1a = Bits(dt1ah0)
' Dt1a = Bits(dt1al3)
' Dt1a = Bits(dt1al2)
' Dt1a = Bits(dt1al1)
' Dt1a = Bits(dt1al0)
Dtps0 = &B0000010
'Dtps1 = &B0000010
'Dtvl0 = 0
'Dtvl1 = 1
'Dtvl2 = 2
'Dtvl3 = 3
'Dtvh0 = 4
'Dtvh1 = 5
'Dtvh2 = 6
'Dtvh3 = 7 |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Thu Feb 02, 2012 12:13 pm Post subject: |
|
|
kamol wrote: | I have tried to enable dead time with following code with various combination, but get "assignment error".
Code: | Tccr1 = Bits(pwm1a)
Tccr1 = Bits(com1a0)
Tccr1 = Bits(cs11) |
|
First, I'd suggest to work on your programming skills, the shown code is senseless.
Second, it may be that register- and bit-names of the datasheet and the .dat-file differ, that simply happens through updated datasheets. You always can look up the right register- or bit-name, as .dat-files are simple text-files.
A look into ATiny45.dat shows: dtps1 -> dtps, dtps10 -> dtps0, dtps11 -> dtps1. |
|
Back to top |
|
|
|