Go Down

Topic: TLC59711 DMX Slow refresh Rate  (Read 912 times) previous topic - next topic

ianscott-arduino

Hey guys

I have a arduino nano connected to a TLC59711 driver with a DMX input.

The code currently works but it responds very slowly (updates outputs values around every 1sec), what it should do at the moment is the first red led should be fade with the first channel, it does but its really jerky.


If anyone could help that would be awesome.


Code: [Select]

#include "Adafruit_TLC59711.h"
#include <SPI.h>
#include <Conceptinetics.h>
#define DMX_SLAVE_CHANNELS   10
DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS );

// How many boards do you have chained?
#define NUM_TLC59711  1

#define data   11
#define clock  13

Adafruit_TLC59711 tlc = Adafruit_TLC59711(NUM_TLC59711, clock, data);
//Adafruit_TLC59711 tlc = Adafruit_TLC59711(NUM_TLC59711);

void setup() {

   dmx_slave.enable (); 
   dmx_slave.setStartAddress (1);
 
  pinMode(7, OUTPUT);
  tlc.begin();
  tlc.write();
 
}

void loop() {

  tlc.setLED(0, dmx_slave.getChannelValue (1)*255, 0, 0);
  tlc.write();
}




PaulRB

#1
May 07, 2016, 10:58 am Last Edit: May 07, 2016, 11:03 am by PaulRB
Hello, i know very little about dmx, but i can't see anything in your code that would cause it be so slow. So i wonder if the dmx controller is only sending updates once per second? You can prove this by separating the calls to tlc.setLED(), tlc.write() and dmx_slave.getChannelValue() and printing the value of millis() before and after each call to see which is taking the longer time.

Paul

PaulRB

#2
May 07, 2016, 01:06 pm Last Edit: May 07, 2016, 01:14 pm by PaulRB
...as soon as I add the TLC59711 library and incorporate it in my DMX code it does the 1second(ish) delays. I also tested the dmx code with a simple dmx -->analogWrite to a LED and the dimming of the LED works but is delayed.

Theres something with the addition of the library I can't figure out.
I don't understand why you blame the tlc library when you say the problem occurs when you don't use it but just use analogWrite(). What am i missing?

You could wire up 3 identical leds. Switch one on before calling getChannelValue(), then switch it off and switch the second led on before calling setLED(), switch second off & third on before tlc.write() and off after. Which led glows brightest?

Go Up