Regolazione più fine del duty cycle

Sezione dedicata al sistema di sviluppo BASCOM-AVR per i micro AVR
At90s, Attiny, Atmega e Xmega

Regolazione più fine del duty cycle

Postby tnnbascom » 20 May 2019, 10:56

Salve,
come posso fare, ad avere degli incrementi di valore di duty cycle minori ? (Cioè una regolazione più fine del duty cycle...)

Il codice che sto usando è il seguente:

Code: Select all
$regfile = "m1284Pdef.dat"
$crystal = 16000000
$baud = 19200
$hwstack = 48
$swstack = 24
$framesize = 48

Dim Dutycycle_tmp As Byte

Tccr2a = &B00100011
Tccr2b = &B00001010                                         'Prescaler 8

Ocr2a = Dutycycle_tmp

Pwm2b = 40                                                  '40KHZ
tnnbascom
 
Posts: 87
Joined: 27 Mar 2013, 15:06

Re: Regolazione più fine del duty cycle

Postby tnnbascom » 21 May 2019, 09:26

Mi scuso questo è il codice corretto con frequenza fissa 40Khz:

Code: Select all
Tccr2a = &B00100011
Tccr2b = &B00001010                                         'Prescaler 8
Ocr2a = 49                                                  '40KHZ
Pwm2b = Pwr_pwm_tmp


e impostando PWR_PWM_TMP=24, ho questo segnale:

TEK0001.jpg
TEK0001.jpg (37.86 KiB) Viewed 3061 times


Ho quindi 48 step...

come posso aumentare il numero di passi?
tnnbascom
 
Posts: 87
Joined: 27 Mar 2013, 15:06

Re: Regolazione più fine del duty cycle

Postby Steeve42 » 07 Feb 2020, 22:03

tnnbascom wrote:Salve,
come posso fare, ad avere degli incrementi di valore di duty cycle minori ? (Cioè una regolazione più fine del duty cycle...)
paris shuttle airport transfers
Il codice che sto usando è il seguente:

Code: Select all
$regfile = "m1284Pdef.dat"
$crystal = 16000000
$baud = 19200
$hwstack = 48
$swstack = 24
$framesize = 48

Dim Dutycycle_tmp As Byte

Tccr2a = &B00100011
Tccr2b = &B00001010                                         'Prescaler 8

Ocr2a = Dutycycle_tmp

Pwm2b = 40                                                  '40KHZ

What's this?
Steeve42
 
Posts: 1
Joined: 07 Feb 2020, 03:04


Return to BASCOM-AVR

Who is online

Users browsing this forum: No registered users and 3 guests

cron