Forum: Mikrocontroller und Digitale Elektronik Led Chip SD600 mit Bascom programmieren


von Martin M. (schiefer)


Angehängte Dateien:

Lesenswert?

Hallo,

Hab mir im Internet Led-Streifen mit Led-Controller (SD600) gekauft.
Nun kenn ich mich nicht unbedingt gut aus mit Datenblätter.
Handelt es sich bei dieser Ansteuerung um eine SPI-Schnittstelle?
Was ich bis verstanden habe ist:
Man überträgt zuerst jeweils ein Byte für grün,blau und rot - und das 
sooft wie Leds
am Streifen sind - und danach 25 Bit ??
Was bedeutet: Guard gap2 ?  25 Bit?
Was muss ich da machen?
Da komm ich nicht mehr klar!

Bis jetzt schaut mein Programm etwa so aus:
Din gibt es eigentlich nicht, ist mit irgendeinem Port definiert

$crystal=4000000
Config Spi=Soft , Din=Pind.3 , Dout=Pind.1,Ss=None , Clock=Pind.0
Dim red as Byte
Dim green as Byte
Dim blue as Byte
Dim x as Byte
Dim y as Byte

Spiinit

red=100:green=50:blue=0

For y=0 to 149     '150 Leds sind am Streifen
  y=Spimove(green)
  y=Spimove(blue)
  y=Spimove(red)
next

nop
End

Kann mir jemand weiterhelfen?
mfg
schiefer

von Thorsten (Gast)


Lesenswert?

Hi,

ist da wirklich für jede LED eine IC verbaut? Sicher kein billiger Spaß 
aber sicherlich nicht schlecht wenn jede LED einzeln steuerbar ist. Die 
25Bit sind dafür das der IC den neuen Frame erkennt, d.h er muss ja 
erkennen wann du neue Daten schickst. Leider ist Bascom nicht mein Fall 
aber generiere einfach 25 Clock Impulse ohne das du Daten schickst nach 
deine Schleife.

Schick mal den Link wo du das Teil gekauft hast.

Gruß

Thorsten

von Martin M. (schiefer)


Lesenswert?

Hallo Thorsten,

Danke für deine schnelle Antwort!
Für drei Leds gibts einen Controller.
Handelt es sich wirklich um eine SPI-Schnittstelle?
Weil wenn das so ist, weiss ich nicht wie man den Takt extra senden 
könnte!
Die Streifen habe ich direkt in Shanghai gekauft.

mfg
schiefer

von Thorsten (Gast)


Lesenswert?

Hi,

das wirst du sicherlich mit einer SPI Schnittstelle ansteuern können. 
Allerdings pass mit deiner Kabellänge auf ( vom Controller zum LED 
Streifen ) Ich würd mal sagen nicht mehr als 10cm! Oder stell deinen SPI 
sehr langsam ein!

Gruß

Th.

von Niklas Upphed (Gast)


Lesenswert?

Hi Guys

I started to look at the SD600 yesterday (only the data sheet, haven't 
got any sd600 hardware yet). I also find the 25 bit gap guard a bit 
strange.

I see three possible solutions to this problem

1. Manually add a single clock cycle.
1
while(1) // loop forever
2
{
3
  for(n=0; n<150; ++n) //150 Leds sind am Streifen
4
  { 
5
    writespi(green);
6
    writespi(blue);
7
    writespi(red);
8
  }
9
  GetManualControlOfSpiPins();
10
  SetSpiDataPinToZero();
11
  SendOneClockCycle();
12
  SetControlOfSpiPinsToSpiHardware()
13
14
  writespi(0xff);
15
  writespi(0xff);
16
  writespi(0xff);
17
}

The problem with this solution (if you get it to work) is that the SPI 
clock won't come in a steady pace. In the end of each inner loop you 
will have to make sure that the red byte is fully transmitted before you 
get manual control of the pins. Since the sd600's pwm clock is based on 
the data clock it can result in flicker.

2. Shift data bytes
1
while(1)
2
{
3
  for(s=0; s<8; ++s ) 
4
  {
5
    for(n=0; n<150; ++n) 
6
    { 
7
      writeSpiShifted(green, s);
8
      writeSpiShifted(blue, s);
9
      writeSpiShifted(red, s);
10
    }
11
    writeSpiShifted(0x7f, s);
12
    writeSpiShifted(0xff, s);
13
    writeSpiShifted(0xff, s);
14
  } 
15
}
16
17
18
uint8 lastByte;
19
void writeSpiShifted(uint8 byteToSend, uint8 shift)
20
{
21
  uint8 hi;
22
  uint8 lo;
23
  if(shift==0)
24
  {
25
    writespi(byteToSend);
26
  }
27
  else
28
  {
29
    hi = lastByte << 8-shift;
30
    lo = byteToSend >> shift;
31
    writespi( hi | lo ); //or together
32
  }
33
  lastByte=byteToSend;
34
}

This solution ought to work, but it is quite time consuming to do all 
this shifting for every byte sent. You can of course optimize the 
algorithm, but it will still be slow.

3. Send 32 bit gap guard

Rgb color values are allowed to be 0..254. 255 is reserved for the gap 
guard. IF (and this is a big if) the logic within sd600 resets it's 
pixel counter when it has received 24 1's preceded by at least one 0. 
Then you could just as well send a 32 bit gap guard (0x00ffffff)
1
while(1) // forever
2
{
3
  for(n=0; n<150; ++n)
4
  { 
5
    writespi(green);
6
    writespi(blue);
7
    writespi(red);
8
  }
9
10
  writespi(0x00);
11
  writespi(0xff);
12
  writespi(0xff);
13
  writespi(0xff);
14
}

This is by far the simplest solution of my three, but i relies on the 
stated prejudice about the logic. The only way to know if it works is to 
try it on real hardware. And then you only know that it works on that 
particular hardware.

/Niklas

(Sorry for the English. I can read German ok, but I never manage to form 
complete sentences.)

von Martin M. (schiefer)


Lesenswert?

hi,

danke für die antworten von thorsten und niklas!
lg
martin

hab mich auf einer chinesischen seite (in c++) informiert.
bascom:

'config spisoft.....

dim red(50) as byte
dim green(50) as byte
dim blue(50) as byte
dim stopbit(4) as byte
dim x as byte
dim y as byte

stopbit(1)=127
stopbit(2)=255
stopbit(3)=255
stopbit(4)=255

'die ganze linie in rot
do
for x=1 to 50
  red(x)=254
  green(x)=0
  blue(x)=0
next
gosub ausgabe
loop


end

ausgabe:
  for y=1 to 50
    spiout red(y),1
    spiout green(y),1
    spiout blue(y),1
  next
  for y=1 to 4
    spiout stopbit(y),1
  next
  return

von Jan (Gast)


Lesenswert?

I apologize in advance if this is in English, but I can't really read or 
write German.

Anyways, I also have this LED tape lighting that uses the SD600 chip. 
I'm testing my controller right now, and I have control over the chips, 
but I've noticed that I can't get the Red LED to turn off completely.  I 
suspect that the outputs on the SD600 chip are not truly open-collector, 
and that even when the output is "OFF" there is still current that is 
allowed to leak through.  I have the data sheet for it, but it is very 
vague.

Please let me know if anyone else has this problem and/or a solution.

von Jan (Gast)


Lesenswert?

OK,

I just confirmed my suspicion.  The outputs on  the SD600 do not float 
in OFF mode, but are actually held at approximately Vdd.  The problem 
arises when running the strip from 12V ( as indicated ) because the 
voltage drop across three red LEDs is less than 7V so the SD600 can't 
turn the red output off.  The voltage drop across the green and blue 
LEDs is more than 7V, so when the output is held at approx 5V (Vdd) the 
LEDs will not turn on.

The solution to the problem is to run the tape at 10V instead of 12V. 
The LEDs will be a little less bright, but at least the red turns off 
completely.

von Martin M. (schiefer)


Lesenswert?

hi,

i have the same problem.
if i reduce the voltage to 9 volt, the strip running very well.
the red goes off, and the other colors also.
i dont know, why the problem appears by 12volt.
in the datasheet i dont read it!

von Jan (Gast)


Lesenswert?

Yeah, it's a design problem.  It's because the SD600 chip sinks the 
current from the LEDs.  So when the chip outputs are at 0V, the LEDs 
turn on.  Then when the chip wants to turn the LEDs off, the output goes 
to 5V.  This works ok for the green and blue because when the chip 
output is at 5V, there is 7V left ( from 12V) across the three LEDs in 
series.  That is 2.3V per LED, that is not enough to turn a green or 
blue LED on, but it is enough to dimly turn the red ones on.

The SD600 chip is not designed very well to be sinking the current.  It 
would need open-collector outputs to do this.  Hopefully the 
manufacturer realizes this and makes a design change.

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.