Home \ Help \ Search \ Login RSS

Welcome, Guest. Please Login

This forum is now READ-ONLY! Please visit http://forum.wiring.co/ for the new forum.

Wiring ForumProgramming Questions & HelpPrograms › slow LED-Stripes and Shift-Register over Serial

Page Index Toggle Pages: 1
slow LED-Stripes and Shift-Register over Serial (Read 2996 times)
09/11/08 at 11:35:26

thomsen   Offline
YaBB Newbies
I Love YaBB 2!

Posts: 13
*
 
Hi all,
at the moment i play around with some broken RGB-Led-Tubes i got from a Club,
and i made some litte play's with my multimeter to know how they work. They are equipped with an Atmega ( which is broken in 4 of 6 Stribes ) and some Shift-Registers... so i took my Solder-Iron and made a little hack. I conected my Wiring and it worked like charm when i coded the signal into wiring.  But this is boring after some minuts... So i took vvvv and tried to control them via rs232. Now there is my Problem... the refresh-rate is pretty slow... even with a high-speed serial port setting.

I send normal ascii out of vvvv, no big conversion. ( 1=Put a high bit into Shiftregister, 0 = Put a low bit into register, d = display shiftregisters, c= clear shift-registers ). I send 48 Times "1" or "0" and then "d" to display it...

Is there a way to speed it up a little thing ?

Thank you for your Help,
Thomas


My Code:

Code:
int signal = 2;
int sschieb = 3;
int rschieb = 4;
int clearsr = 5;
int display = 6;

int val;
int dp;

void setup() {
  pinMode(signal, OUTPUT);  // SERIAL
  pinMode(sschieb, OUTPUT); // Shiftregister Clock
  pinMode(rschieb, OUTPUT); // Output Clock
  pinMode(clearsr, OUTPUT); // Clear Shiftregister
  pinMode(display, OUTPUT); // Put Shiftregister to Outputregiser
  Serial.begin(115200);
}

void loop() {
  digitalWrite(clearsr, HIGH);
  digitalWrite(display, LOW);
  if( Serial.available() )      
  {
    val = Serial.read();        
  }
  if( val == '1' ) {
    digitalWrite(signal, HIGH);  // PUT HIGH BIT IN SHIFTREGISTER and SHIFT IT
    digitalWrite(sschieb, HIGH);
    digitalWrite(sschieb, LOW);
    digitalWrite(signal, LOW);
    val = 'x';  
  }
  else if (val =='0') {
    digitalWrite(signal, LOW);  // PUT LOW BIT IN SHIFTREGISTER and SHIFT IST
    digitalWrite(sschieb, HIGH);
    digitalWrite(sschieb, LOW);
    val = 'x';  
  }
  else if ( val == 'c') {
    digitalWrite(clearsr, LOW);  // CLEAR SHIFTREGISTER AND PUT ON OUTPUTS
    digitalWrite(clearsr, HIGH);
    digitalWrite(rschieb, HIGH);
    digitalWrite(rschieb, LOW);
  }
  else if ( val == 'd') {
    digitalWrite(rschieb, HIGH);  //PUT SHIFTREGISTER ON OUTPUTS
    digitalWrite(rschieb, LOW);
  }
}

 


 
IP Logged
 
Page Index Toggle Pages: 1