SHARE
TWEET

Arduino with HDSP2000LP

a guest May 7th, 2010 761 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.   Display HDSP2000
  3.   Destroyed one when connected upside down!
  4.   managed to make light from one at 2010.04.24
  5.  
  6.  */
  7.  
  8. void shiftlong(long);
  9. // The setup() method runs once, when the sketch starts
  10. void setup()   {                
  11.  
  12.   pinMode(12, OUTPUT); // Col 1
  13.   pinMode(11, OUTPUT); // Col 2
  14.   pinMode(10, OUTPUT); // Col 3
  15.   pinMode(9, OUTPUT);  // Col 4
  16.   pinMode(8, OUTPUT); // Col 5
  17.  
  18.   pinMode(7, OUTPUT);  // DataIn Display
  19.   pinMode(6, OUTPUT);  // Clock
  20.   pinMode(5, OUTPUT);  // VB
  21.        
  22. }
  23.  
  24. // the loop() method runs over and over again,
  25. // as long as the Arduino has power
  26. //long lovetxt[]={0xfcf307e0L,0x0508c520L,0x05083520L,0x0508c420L,0x04f30420L};
  27. //long txt0123[]={0x7c010c20L,0x82861c10L,0x83fe2d10L,0x82064e90L,0x7c018c60L};
  28. long txt[]={0x385039c0L,0x44886350L,0x448af5e0L,0x2871a8c0L,0x1000e070L};
  29.  
  30. void loop()                    
  31. {
  32.   while(1){
  33.     for (int i=12;i>7;i--){
  34.       switch(i) {
  35.        case 12:
  36.           digitalWrite(5,LOW);   // Blank
  37.           shiftlong(txt[0]);
  38.           digitalWrite(8,LOW);  // off previous
  39.           digitalWrite(i,HIGH);  // on current
  40.           digitalWrite(5,HIGH);  // stop blank
  41.           break;
  42.        case 11:
  43.           digitalWrite(5,LOW);   // Blank
  44.           shiftlong(txt[1]);
  45.           digitalWrite(i+1,LOW);  // off previous
  46.           digitalWrite(i,HIGH);  // on current
  47.           digitalWrite(5,HIGH);  // stop blank
  48.           break;
  49.        case 10:
  50.           digitalWrite(5,LOW);   // Blank
  51.           shiftlong(txt[2]);
  52.           digitalWrite(i+1,LOW);  // off previous
  53.           digitalWrite(i,HIGH);  // on current
  54.           digitalWrite(5,HIGH);  // stop blank
  55.           break;
  56.        case 9:
  57.           digitalWrite(5,LOW);   // Blank
  58.           shiftlong(txt[3]);
  59.           digitalWrite(i+1,LOW);  // off previous
  60.           digitalWrite(i,HIGH);  // on current
  61.           digitalWrite(5,HIGH);  // stop blank
  62.           break;
  63.        case 8:
  64.           digitalWrite(5,LOW);   // Blank
  65.           shiftlong(txt[4]);
  66.           digitalWrite(i+1,LOW);  // off previous
  67.           digitalWrite(i,HIGH);  // on current
  68.           digitalWrite(5,HIGH);  // stop blank
  69.           break;
  70.       }
  71.       delay(2);
  72.     }
  73.   }
  74. }
  75.  
  76. void shiftlong(long val) {
  77. {
  78.         digitalWrite(6, LOW);
  79.         for (int i = 0; i < 32; i++)  {
  80.                 digitalWrite(7, !!(val & (1L << i)));
  81.                 digitalWrite(6, HIGH);
  82.                 digitalWrite(6, LOW);          
  83.         }
  84. }
  85. }
RAW Paste Data
Top