Répondre au commentaire

user warning: Unknown column 'i18n.language' in 'where clause' query: SELECT DISTINCT b.* FROM blocks b LEFT JOIN blocks_roles r ON b.module = r.module AND b.delta = r.delta LEFT JOIN i18n_blocks i18n ON (b.module = i18n.module AND b.delta = i18n.delta) WHERE (i18n.language ='fr' OR i18n.language ='' OR i18n.language IS NULL) AND ( b.theme = 'garland' AND b.status = 1 AND (r.rid IN (1) OR r.rid IS NULL) )ORDER BY b.region, b.weight, b.module in /var/alternc/html/o/orangeseeds/usr/drupal-6/modules/block/block.module on line 456.

Double PWM (Atmega644 pour effet stéréo)

Ce bout de code permet de générer du son en stéréo en utilisant deux sorties PWM d'un ATMEGA644.


#include < avr/io.h >

#define piezo PB3
#define piezo2 PB4

void InitTimer(void)
{
// ************ init timer **********

DDRB |= (1 << piezo); // OC0A on PB3
DDRB |= (1 << piezo2); // OC0B on PB4

TCCR0A |= ((1 << WGM00)|(1 << WGM01)|
(1 << COM0A1)|(1 << COM0A0)|
(1 << COM0B1)|(1 << COM0B0));

TCCR0B |= (1 << CS00);

}

int main() {

InitTimer();

for(;;)
{
OCR0A = 35; // PWM High speed PB3
OCR0B = 100; // PWM High speed PB4
}

}

Répondre

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.