Outils pour utilisateurs

Outils du site


arduino_haute_frequence

Ceci est une ancienne révision du document !


Arduino à Haute Fréquence avec des interruptions

Ressources

Nombre de PIN avec Interrupt

La UNO n'a que 2 attachinterrupt.

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

#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

  1. setting MISO as OUTPUT for slave to send data
  2. enable slave mode by setting the SPCR register
  3. 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.

How to get a response from a slave

Envoyez et recevez tout type de données

arduino_haute_frequence.1662402481.txt.gz · Dernière modification : 2022/09/05 18:28 de serge