Ceci est une ancienne révision du document !
Table des matières
Arduino à Haute Fréquence avec des interruptions
Ressources
- arduinogetstarted.com la documentation Arduino sur les Interruptions.
Nombre de PIN avec Interrupt
Vulgarisation
Lorsque qu'une PIN est activée, le calculateur s'arrête pour traiter la demande sur la PIN. Une interruption est un membre VIP
Optical Encoder USDigital
4000 points soit 16Kz à 1 tour par seconde
- Encoder Library @ pjrc.com Programme écrit en assembleur, ce qui permet d'atteindre 130 kHz
#define ENCODER_OPTIMIZE_INTERRUPTS #include <Encoder.h> // Arduino Uno: seuls 2 et 3 sont INTERRUPTS Encoder myEnc(2, 3); void setup() { Serial.begin(115200); Serial.println("Basic Encoder Test:");} long oldPosition = -999; void loop() { long newPosition = myEnc.read(); if (newPosition != oldPosition) { oldPosition = newPosition; Serial.println(newPosition); }}
SPI entre Raspberry et Arduino
Avec arduino en mode slave
Ressources
Slave Mode with SPI.h
et avec des interrupt
SPI Slave Programming for Arduino @ arduino.stackexchange.com
SPI.h library by default only support Master mode, the SPI.begin() will automatically set slave select (ss) pin to HIGH whether you have pinMode(ss, OUTPUT) in your setup() code or not and set the Arduino as an SPI master.
As the SPI library does not contain the functionality for slave mode, in order to use Arduino as a Slave, you will need to do some customised setup, mainly on
- setting MISO as OUTPUT for slave to send data
- enable slave mode by setting the SPCR register
- enable interrupt when data is received.
Nick Gammon explique tout sur le SPI
Les scripts sont sur GitHub sergeLabo arduino_high_frequency avec la version python des master.
How to make an SPI slave
Montre le problème du 1er transfert.