« SE3 PSE Binome2023-7 » : différence entre les versions
Aller à la navigation
Aller à la recherche
(→Photos) |
(→Photos) |
||
Ligne 2 : | Ligne 2 : | ||
== Photos == | == Photos == | ||
[[Fichier:PCB DJADJOUBEH.png|vignette|Photo du PCB | [[Fichier:PCB DJADJOUBEH.png|vignette|Center|Photo du PCB]] | ||
[[Fichier:SCHEMATIQUE DJADJOUBEH.png|vignette|Photo de la Schématique | [[Fichier:SCHEMATIQUE DJADJOUBEH.png|vignette|Center|Photo de la Schématique]] | ||
[[Fichier:SE3-pad.zip|vignette]] | [[Fichier:SE3-pad.zip|vignette]] | ||
Version du 11 mars 2024 à 17:01
Manette
Photos
Programmation AVR
Allumage de LEDS
Code 1
#include<avr/io.h> #include<stdio.h> #include<stdlib.h> void config(unsigned int bit, unsigned char port, unsigned int io) { if (io == 1) { if (port == 'B') DDRB |= (io<<bit); if (port == 'C') DDRC |= (io<<bit); if (port == 'D') DDRD |= (io<<bit); } else if (io == 0) { if (port == 'B') DDRB &= ~(1<<bit); if (port == 'C') DDRC &= ~(1<<bit); if (port == 'D') DDRD &= ~(1<<bit); } } void put_bit(unsigned int bit, unsigned char port, unsigned int io) { if (io == 1) { if (port == 'B') PORTB |= (io<<bit); if (port == 'C') PORTC |= (io<<bit); if (port == 'D') PORTD |= (io<<bit); } else if (io == 0) { if (port == 'B') PORTB &= ~(1<<bit); if (port == 'C') PORTC &= ~(1<<bit); if (port == 'D') PORTD &= ~(1<<bit); } } int get_bit(unsigned int bit, unsigned char port) { if (port == 'B') return 1 & (PINB>>bit); if (port == 'C') return 1 & (PINC>>bit); if (port == 'D') return 1 & (PIND>>bit); return -1; } int main(void) { //Setup config(2,'C',1); config(4,'C',1); put_bit(2,'C',1); put_bit(4,'C',1); while (1); return 0; }