Bonjour à tous !
J'essaie de piloter un Tlc en DMX; pour la partie DMX j'utilise la librairie DMX four universes :
http://www.deskontrol.net/blog/arduino-four-universes-dmx-512-library/
et pour la partie TLC :
http://code.google.com/p/tlc5940arduino/
Le code que j'ai écris fonctionne ... pendant quelques minutes! Au bout d'un moment les leds commencent à scintiller puis il n'y a plus de graduation mais du off/on.
Le câblage ne semble pas en cause car les codes d'exemple (TLC ou DMX) fonctionnent parfaitement.
Voici le code:
#include <lib_dmx.h>
#include "Tlc5940.h"
int address = 1;
#define DMX512 (0) // (250 kbaud - 2 to 512 channels) Standard USITT DMX-512
void setup()
{
/////////////////////////////////////////////////////////////////////////////
/* Call Tlc.init() to setup the tlc.
You can optionally pass an initial PWM value (0 - 4095) for all channels.*/
Tlc.init(0);
////////////////////////////////////////////////////////////////////////////
//SetUp DMX
ArduinoDmx0.set_control_pin(2); // Arduino output pin for MAX485 input/output control (connect to MAX485 pins 2-3)
ArduinoDmx0.set_rx_address(address); // set rx0 dmx start address
ArduinoDmx0.set_rx_channels(16); // number of rx channels
// *** NEW *** attach RX service routine here, fired when all channels in one universe are received.
ArduinoDmx0.attachRXInterrupt (frame_received);
ArduinoDmx0.init_rx(DMX512); // starts universe 0 as rx, NEW Parameter DMX mode
}
void loop()
{
}
void frame_received(uint8_t universe) // Custom ISR: fired when all channels in one universe are received
{
if (universe == 0) // USART0
{
Tlc.clear();
/* Tlc.clear() sets all the grayscale values to zero, but does not send
them to the TLCs. To actually send the data, call Tlc.update() */
for(int i=0;i<16;i++)
{
Tlc.set( i, (ArduinoDmx0.RxBuffer[i])*16);
}
/* Tlc.update() sends the data to the TLCs. This is when the LEDs will
actually change. */
Tlc.update();
}
}
Si quelqu’un a une piste...
Merci d'avance,
Jacques.