Lichtkrant Surtronic FDS-132

Hardware die niet past in bovenstaande onderwerpen
Gebruikers-avatar
Berichten: 270
Geregistreerd: 30 Dec 2012, 11:42

Re: Lichtkrant Surtronic FDS-132

Berichtdoor Rudi » 17 Nov 2013, 11:07

Winersat, ik heb je een PB'tje gestuurd.

Voorbeeld van enig praktisch nut van het matrixbord: ik had onlangs de wagen van mijn zoon te koop aangeboden staan. Het bord werd voor de achterruit geplaatst en het toonde afwisselend de gegevens over de wagen. Ik kreeg toffe reakties op wagen én bord.
Wagen is verkocht. Matrixbord hou ik :lol:
Arduinows!
Why do computer programmers confuse Halloween with Christmas? Because Oct 31 = Dec 25
I got 01100011 problems but a bit ain't 00000001

Advertisement

Gebruikers-avatar
Berichten: 2
Geregistreerd: 11 Dec 2013, 23:50

Re: Lichtkrant Surtronic FDS-132

Berichtdoor MaxJ » 15 Jan 2014, 11:18

Na het lezen van veel info van jullie over de FDS-132 matrixborden op Circuits Online en het Nedrlands Arduino Forum heb ik ook 3 van deze borden bij Baco besteld.
1 was er kapot: schuifregister chip vanaf gebroken. Baco heeft me zonder kosten een nieuwe gestuurd (terwijl ik, voordat ik er achter kwam dat de oude kapot was, de CPLD er al vanaf had gebrand...). Dat is echt service!

Ik heb veel van jullie programma's en libraries gedownload en nog meer geprobeerd om er achter te komen hoe het bord werkt.
Uiteindelijk door inspiratie van o.a. blurp, zerobase, Rudi en Rolo (en vele anderen) een toepassing gemaakt voor mijn zoon: een Klok met diverse acties.
Gebaseerd op de originele lichtkrant van Rolo, uitbreiding met RTC en wat leuke schermacties als random text, curtain close (scherm zwart maken als gordijn sluiten) en een space invader die je scherm leeg komt eten.
Waarschijnlijk niet de beste code, maar het functioneert en wellicht kan het iemand helpen ook wat leuke dingen te doen met het LED board.

Verdere uitbreidingen die ik nog wil doen: proportional font(s) ( als in lib van Bart De Waal), ombouw maken zodat klok kan hangen, koppelen UNO met PC via RS323 om data te laten zien, scrollende tekst op 1 Row.

Een foto van UNO met RTC aangesloten
Afbeelding

en een filmpje van het scherm en de acties
http://www.youtube.com/watch?v=czUkzuXeas8


Hierbij de code:

Code: Alles selecteren
// Timer 1 Info :  http://playground.arduino.cc/code/timer1
// Using PROGMEM : http://arduino.cc/en/Reference/PROGMEM


// The matrix board is controlled by timer0 overflow interrupt. This gives a steady image and the display can be handled like a static type.
// The main code does not have to control the board, just set or clear bits in the data array to put some led's on or off.
// Logically it's organized in colums, 270 in total. This sofware defines column 0 as the upper left column and 271 is the right bottom column.
// This makes it more easy to arrange the text on the board. There is no checking if the text fits on the display.
//
// Column layout :    Line 0 : 0 to 89
//                    Line 1 : 90 to 179     
//                    Line 2 : 180 to 271
//
//
//
#include <DS1307RTC.h>
#include <Time.h>
#include <Wire.h>
#include <avr/pgmspace.h>             // Include pgmspace so data tables can be stored in program memory, see PROGMEM info
#include <SPI.h>                      // Include SPI comunications, used for high speed clocking to display shiftregisters
#include "TimerOne.h"                 // Include Timer1 library, used for timer overflow interrupt                                   
                                                       
const int strobePin = 10;             // Define I/O pins connected to the display board                 
const int clockPin = 13;                               
const int dataPin = 11;                               
const int resredPin = 9;                               
const int row_a = 5;                                     
const int row_b = 6;                                   
const int row_c = 7;                                     
const int rtcPlusPin = 17;            // +5V RTC module. 
const int rtcMinPin = 16;             // gnd RTC module. 
const int ClockPin = 2;
const int ClockPinMin = 1;

String tijd;
int blinkToggle=1;
int blinks=0;
String topText = "De tijd is";
int willekMinuut = random(0,59);     // generate random number between 0 en 59
int willekMinuut2 = random(0,59);    // generate random number between 0 en 59 

byte Space1[7];


int RowCount = 0;             // Counter for the current row, do not change this value in the main code, it's handeld in the interrupt routine 
int teller=0;
unsigned long tijdNu=millis();

#include "font75.h";         // Standard 5x7 font ASCII Table

byte ColumnBytes[8][34];     // This is the data array that is used as buffer. The display data is in this buffer and the timeroverflow routine scans this
                             // buffer and shows it on the display. So read and write to this buffer to change display data.
                             // No strings are stored here, its the raw bit data that has to be shifted into the display.
                         
byte ColumnBytesBuffer[8][34];  // Backup for ColumnBytes[8][34]

// =========================================================================================
// Setup routine, mandatory.
// =========================================================================================

 void setup() {   
  pinMode (strobePin, OUTPUT);                              // Define IO         
  pinMode (clockPin, OUTPUT); 
  pinMode (dataPin, OUTPUT); 
  pinMode (row_c, OUTPUT); 
  pinMode (row_b, OUTPUT); 
  pinMode (row_a, OUTPUT); 
  pinMode (resredPin, OUTPUT); 
  pinMode (rtcMinPin, OUTPUT); 
  pinMode (rtcPlusPin, OUTPUT); 
  digitalWrite(rtcMinPin, LOW);                       // 0V (gnd) voor RTC module. 
  digitalWrite(rtcPlusPin, HIGH);                     // +5V voor RTC module. 
  digitalWrite (resredPin, LOW);                       
  digitalWrite (strobePin, LOW);                       
  //Serial.begin(9600);                               // Include serial routine, used for debugging and testing
  SPI.begin();                                        // Start SPI comunications
  SPI.setBitOrder(LSBFIRST);                          // Initialize SPI comunications
  Timer1.initialize(2000);                            // initialize timer1, overflow timer1 handles the display driver, period (in microseconds)
  Timer1.attachInterrupt(DisplayControl);             // attaches timer1 overflow interrupt routine
  randomSeed(analogRead(0));                          // voedt de randomgenerator aan de hand van waarde niet aangesloten analoge poort. 

   Space1[0]=B00011000;                               // create sprite Space Invaders
   Space1[1]=B00111100;
   Space1[2]=B01111110;
   Space1[3]=B11011011;
   Space1[4]=B01111110;
   Space1[5]=B11000011;
   Space1[6]=B01100110;

 
// Start code here
  ClearDisplay();
  PlaceText(topText,17);

 } 

// =========================================================================================
// loop routine, mandatory
// Take notice when using time crititical code the interrupt is running to control
// the display.
// =========================================================================================

void loop() 

   tmElements_t tm;  //activate RTC lib
   String uren;
   String minuten;
   String seconden;
   
   if (RTC.read(tm)) {                                                                     //read RTC
     if (tm.Hour<=9){uren="0"+String(tm.Hour);}else{uren=String(tm.Hour);}                 //leading zero's
     if (tm.Minute<=9){minuten="0"+String(tm.Minute);}else{minuten=String(tm.Minute);}     //if
     if (tm.Second<=9){seconden="0"+String(tm.Second);}else{seconden=String(tm.Second);}   //UU,MM,SS < 10
 
     tijd = uren+":"+minuten+":"+seconden;
     PlaceText(tijd,110);
   }

     // put date in Row 3
     String maand[13] = {"leeg", "jan", "feb", "mrt", "apr", "mei", "jun", "jul", "aug", "sep", "okt", "nov", "dec"};
     String datum = String(tm.Day)+ " "+ maand[tm.Month]+ " "+ String(tmYearToCalendar(tm.Year));
     PlaceText (datum, 192);
 
   if (tm.Second == 10) randomText();                   // just for fun: show screen actions every minute
   if (tm.Second == 15) Curtain();                      // delete these 3 lines and use following functions
   if (tm.Second == 25) PlaceSprite();                  // to show them at random times

/*
   if (tm.Minute == willekMinuut && tm.Second < 1){      // put Random text in Row1
     randomText();   
     int willekMinuut = random(0,59);                    // generate randow number between 0 en 59. 
   }
 
   if (tm.Minute == willekMinuut2 && tm.Second < 1){    // Show sprite
     PlaceSprite();
     willekMinuut2 = random(0,59);                       // generate randow number between 0 en 59.
   }

   if (tm.Minute == willekMinuut2 + 14 && tm.Second < 1){ // Clear like curtain
     Curtain();
   }
*/
}



// =========================================================================================
// Timer1 overflow intterupt routine,
// Does the Display shifting and muliplexing
// =========================================================================================

 void DisplayControl() 
 { 
     digitalWrite(strobePin, LOW);                        // StrobePin LOW, so led's do not change during clocking
     digitalWrite (resredPin, LOW);                       // Display off to prevent ghosting 
 
       for (int q = 0; q<34; q++) {                       // Shift the bytes in for the current Row
       SPI.transfer(ColumnBytes[RowCount][q]);}
   
     digitalWrite (row_a, RowCount & 1);                  // Switch the current column on, will be on until next interrupt
     digitalWrite (row_b, RowCount & 2);               
     digitalWrite (row_c, RowCount & 4);           
     
     digitalWrite(strobePin, HIGH);                       // Strobe the shiftregisters so data is presented to the LED's
     digitalWrite (resredPin, HIGH);                      // Display back on

     RowCount++;                                          // Increment Row
     if (RowCount == 7) RowCount = 0 ;                    // Row is 0 to 6
 } 

// =========================================================================================
// Place text on display, uses the standard 5x7 font
// Call this routine with the text to display and the starting column to place the text
// Example : PlaceText("FDS132",27); Places the text "FDS132" starting on column 27
// =========================================================================================

void PlaceText(String text, int ColPos) {
    byte displayByte; 
    char CurChar;
    int bitpos;
    int bytepos;
    int pixelpos;
    int charCount = text.length();
    int store = ColPos;

   for (int i = 0; i < charCount; i++) {                                     // Loop for all the characters in the string
    CurChar = text.charAt(i);                                                // Read ascii value of current character
    CurChar = CurChar - 32;                                                  // Minus 32 to get the right pointer to the ascii table, the first 32 ascii code are not in the table   
     
     for (int y = 0; y<7; y++) {                                             // y loop is used to handle the 7 rows
       for (int x = 0; x<5; x++) {                                           // x loop is the pointer to the indiviual bits in the byte from the table
         displayByte = (pgm_read_word_near(Font75 + (CurChar*7)+y));         // Read byte from table
         pixelpos = abs(ColPos - 271);                                       // Calculate start position to place the data on display
         bytepos = ((pixelpos)/8);                                           
         bitpos = (pixelpos) - (bytepos*8);
         boolean bitStatus = bitRead(displayByte, x);                        // Probe the bits   
         if(bitStatus == 0) bitClear(ColumnBytes[y][bytepos], bitpos);       // And set or clear the corrosponding bits in de display buffer   
         if(bitStatus == 1) bitSet(ColumnBytes[y][bytepos], bitpos);       
         ColPos++;                                                           
      }
       ColPos = store;                                                       // Reset the column pointer so the next byte is shown on the same position
     }
    ColPos = ColPos + 6;                                                     // 6 is used here to give one column spacing between characters (one character is 5 bits wide)
    store = ColPos;                                                          // For more space between the characters increase this number
 }
}     

// =========================================================================================
// Make a sprite clear the screen from Row3 to Row2
// =========================================================================================
void PlaceSprite() {
    byte displayByte; 
    char CurChar;
    int bitpos;
    int bytepos;
    int pixelpos;
    int ColPos = 269;
    int store = ColPos;
    int Sbytepos;
    int Sbitpos;

    for (int z = 0; z < 189; z++){     
     for (int y = 0; y < 7; y++) {                                           // y loop is used to handle the 7 rows
      for (int x = 0; x < 8; x++) {                                          // x loop is the pointer to the indiviual bits in the byte from the table
         displayByte = Space1[y];                                            // Read byte from table
         pixelpos = abs(ColPos + z - 271);                                   // Calculate start position to place the data on display
         if (pixelpos > 180) pixelpos = 180;                                 // only move on the bottom 2 bars
         bytepos = ((pixelpos)/8);                                           
         bitpos = (pixelpos) - (bytepos*8);
         boolean bitStatus = bitRead(displayByte, x);                        // Probe the bits   
         if(bitStatus == 0) bitClear(ColumnBytes[y][bytepos], bitpos);       // And set or clear the corrosponding bits in de display buffer   
         if(bitStatus == 1) bitSet(ColumnBytes[y][bytepos], bitpos);
         if(x < 1){
            Sbytepos = bytepos;
            Sbitpos = bitpos;
         }
         ColPos++;                                                           
      }
       ColPos = store;                                                       // Reset the column pointer so the next byte is shown on the same position
     }
      delay(50);
      for (int d = 0; d < 7; d++){                                           // clear trailing set bits
        bitClear(ColumnBytes[d][Sbytepos],Sbitpos);
      }
  }
 delay(500);
}     


// =========================================================================================
// Clears the screen like curtain
// =========================================================================================
void Curtain() {

  for (int i = 0; i < 35; i++){                //use byte ColumnBytesBuffer[8][34] as backup
      for (int j = 0; j < 7; j++){
        ColumnBytesBuffer[j][i] = ColumnBytes[j][i];
      }
    } 
 
   for (int k = 0; k < 6; k++){
     for (int l = 0; l < 8; l++){
      for (int m = 0; m < 7; m++){
       bitClear(ColumnBytes[m][k],l);            // clear right to left Row1
       bitClear(ColumnBytes[m][11-k],7-l);       // clear left to right Row1
       bitClear(ColumnBytes[m][11+k],l);         // clear right to left Row2
       bitClear(ColumnBytes[m][22-k],7-l);       // clear left to right Row2
       bitClear(ColumnBytes[m][22+k],l);         // clear right to left Row3
       bitClear(ColumnBytes[m][33-k],7-l);       // clear left to right Row3
       delay(20);
      }
     }
    delay (50);
   }
   delay(500);
   for (int i = 0; i < 35; i++){                 // put buffer back
     for (int j = 0; j < 7; j++){
       ColumnBytes[j][i] = ColumnBytesBuffer[j][i];
     }
   } 
}


// =========================================================================================
// Put Random Text in centre of top row
// =========================================================================================
void randomText(){
  ClearDisplay();

  String topText[5] = {"Goeiedag!", "Hallo Alex", "Het is nu:", "Is het al tijd?", "De tijd is:"};
  int wilTop = random(0,4);
 
  int offsTop = (90 - topText[wilTop].length() * 6)/2;  // calculate offset to centre the text
  PlaceText (topText[wilTop], offsTop);
}


// =========================================================================================
// Clear display
// All bytes in buffer are set to zero
// =========================================================================================
void ClearDisplay() {
    for (int y = 0; y<8; y++) {     
       for (int x = 0; x<34; x++) {     
         ColumnBytes[y][x] = 0;
       }
    }     



// =========================================================================================
// Clear Row1 (topRow)
// All bytes in topRow are set to zero (almost)
// =========================================================================================
void ClearRow1() {
    for (int y = 0; y<8; y++) {     
       for (int x = 22; x<34; x++) {     
         ColumnBytes[y][x] = 0;
       }
    }     



en de font-code van Rolo
Code: Alles selecteren
// ASCII Table
PROGMEM  prog_uchar Font75[]  = {
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,     // 
0x04 ,0x04 ,0x04 ,0x04 ,0x00 ,0x00 ,0x04 ,     // !
0x0A ,0x0A ,0x0A ,0x00 ,0x00 ,0x00 ,0x00 ,     // "
0x0A ,0x0A ,0x1F ,0x0A ,0x1F ,0x0A ,0x0A ,     // #
0x04 ,0x1E ,0x05 ,0x0E ,0x14 ,0x0F ,0x04 ,     // $
0x03 ,0x13 ,0x08 ,0x04 ,0x02 ,0x19 ,0x18 ,     // %
0x06 ,0x09 ,0x05 ,0x02 ,0x15 ,0x09 ,0x16 ,     // &
0x06 ,0x04 ,0x02 ,0x00 ,0x00 ,0x00 ,0x00 ,     // '
0x08 ,0x04 ,0x02 ,0x02 ,0x02 ,0x04 ,0x08 ,     // (
0x02 ,0x04 ,0x08 ,0x08 ,0x08 ,0x04 ,0x02 ,     // )
0x00 ,0x04 ,0x15 ,0x0E ,0x15 ,0x04 ,0x00 ,     // *
0x00 ,0x04 ,0x04 ,0x1F ,0x04 ,0x04 ,0x00 ,     // +
0x00 ,0x00 ,0x00 ,0x00 ,0x06 ,0x04 ,0x02 ,     // Comma
0x00 ,0x00 ,0x00 ,0x1F ,0x00 ,0x00 ,0x00 ,     // -
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x06 ,0x06 ,     // .
0x00 ,0x10 ,0x08 ,0x04 ,0x02 ,0x01 ,0x00 ,     // Slash
0x0E ,0x11 ,0x19 ,0x15 ,0x13 ,0x11 ,0x0E ,     // 0
0x04 ,0x06 ,0x04 ,0x04 ,0x04 ,0x04 ,0x0E ,     // 1
0x0E ,0x11 ,0x10 ,0x08 ,0x04 ,0x02 ,0x1F ,     // 2
0x1F ,0x08 ,0x04 ,0x08 ,0x10 ,0x11 ,0x0E ,     // 3
0x08 ,0x0C ,0x0A ,0x09 ,0x1F ,0x08 ,0x08 ,     // 4
0x1F ,0x01 ,0x0F ,0x10 ,0x10 ,0x11 ,0x0E ,     // 5
0x0C ,0x02 ,0x01 ,0x0F ,0x11 ,0x11 ,0x0E ,     // 6
0x1F ,0x10 ,0x08 ,0x04 ,0x02 ,0x02 ,0x02 ,     // 7
0x0E ,0x11 ,0x11 ,0x0E ,0x11 ,0x11 ,0x0E ,     // 8
0x0E ,0x11 ,0x11 ,0x1E ,0x10 ,0x08 ,0x06 ,     // 9
0x00 ,0x06 ,0x06 ,0x00 ,0x06 ,0x06 ,0x00 ,     // :
0x00 ,0x06 ,0x06 ,0x00 ,0x06 ,0x04 ,0x02 ,     // ;
0x08 ,0x04 ,0x02 ,0x01 ,0x02 ,0x04 ,0x08 ,     // <
0x00 ,0x00 ,0x1F ,0x00 ,0x1F ,0x00 ,0x00 ,     // =
0x02 ,0x04 ,0x08 ,0x10 ,0x08 ,0x04 ,0x02 ,     // >
0x0E ,0x11 ,0x10 ,0x08 ,0x04 ,0x00 ,0x04 ,     // ?
0x0E ,0x11 ,0x10 ,0x16 ,0x15 ,0x15 ,0x0E ,     // @
0x0E ,0x11 ,0x11 ,0x11 ,0x1F ,0x11 ,0x11 ,     // A
0x0F ,0x11 ,0x11 ,0x0F ,0x11 ,0x11 ,0x0F ,     // B
0x0E ,0x11 ,0x01 ,0x01 ,0x01 ,0x11 ,0x0E ,     // C
0x07 ,0x09 ,0x11 ,0x11 ,0x11 ,0x09 ,0x07 ,     // D
0x1F ,0x01 ,0x01 ,0x0F ,0x01 ,0x01 ,0x1F ,     // E
0x1F ,0x01 ,0x01 ,0x0F ,0x01 ,0x01 ,0x01 ,     // F
0x0E ,0x11 ,0x01 ,0x1D ,0x11 ,0x11 ,0x1E ,     // G
0x11 ,0x11 ,0x11 ,0x1F ,0x11 ,0x11 ,0x11 ,     // H
0x0E ,0x04 ,0x04 ,0x04 ,0x04 ,0x04 ,0x0E ,     // I
0x1C ,0x08 ,0x08 ,0x08 ,0x08 ,0x09 ,0x06 ,     // J
0x11 ,0x09 ,0x05 ,0x03 ,0x05 ,0x09 ,0x11 ,     // K
0x01 ,0x01 ,0x01 ,0x01 ,0x01 ,0x01 ,0x1F ,     // L
0x11 ,0x1B ,0x15 ,0x15 ,0x11 ,0x11 ,0x11 ,     // M
0x11 ,0x11 ,0x13 ,0x15 ,0x19 ,0x11 ,0x11 ,     // N
0x0E ,0x11 ,0x11 ,0x11 ,0x11 ,0x11 ,0x0E ,     // O
0x0F ,0x11 ,0x11 ,0x0F ,0x01 ,0x01 ,0x01 ,     // P
0x0E ,0x11 ,0x11 ,0x11 ,0x15 ,0x09 ,0x16 ,     // Q
0x0F ,0x11 ,0x11 ,0x0F ,0x05 ,0x09 ,0x11 ,     // R
0x1E ,0x01 ,0x01 ,0x0E ,0x10 ,0x10 ,0x0F ,     // S
0x1F ,0x04 ,0x04 ,0x04 ,0x04 ,0x04 ,0x04 ,     // T
0x11 ,0x11 ,0x11 ,0x11 ,0x11 ,0x11 ,0x0E ,     // U
0x11 ,0x11 ,0x11 ,0x11 ,0x11 ,0x0A ,0x04 ,     // V
0x11 ,0x11 ,0x11 ,0x15 ,0x15 ,0x15 ,0x0A ,     // W
0x11 ,0x11 ,0x0A ,0x04 ,0x0A ,0x11 ,0x11 ,     // X
0x11 ,0x11 ,0x11 ,0x0A ,0x04 ,0x04 ,0x04 ,     // Y
0x1F ,0x10 ,0x08 ,0x04 ,0x02 ,0x01 ,0x1F ,     // Z
0x0E ,0x02 ,0x02 ,0x02 ,0x02 ,0x02 ,0x0E ,     // [
0x00 ,0x01 ,0x02 ,0x04 ,0x08 ,0x10 ,0x00 ,     // Backslash
0x0E ,0x08 ,0x08 ,0x08 ,0x08 ,0x08 ,0x0E ,     // ]
0x04 ,0x0A ,0x11 ,0x00 ,0x00 ,0x00 ,0x00 ,     // ^
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x1F ,     // _
0x02 ,0x04 ,0x08 ,0x00 ,0x00 ,0x00 ,0x00 ,     // High Comma
0x00 ,0x00 ,0x0E ,0x10 ,0x1E ,0x11 ,0x1E ,     // a
0x01 ,0x01 ,0x0D ,0x13 ,0x11 ,0x11 ,0x0F ,     // b
0x00 ,0x00 ,0x0E ,0x01 ,0x01 ,0x11 ,0x0E ,     // c
0x10 ,0x10 ,0x16 ,0x19 ,0x11 ,0x11 ,0x1E ,     // d
0x00 ,0x00 ,0x0E ,0x11 ,0x1F ,0x01 ,0x0E ,     // e
0x0C ,0x12 ,0x02 ,0x07 ,0x02 ,0x02 ,0x02 ,     // f
0x00 ,0x1E ,0x11 ,0x11 ,0x1E ,0x10 ,0x0E ,     // g
0x01 ,0x01 ,0x0D ,0x13 ,0x11 ,0x11 ,0x11 ,     // h
0x04 ,0x00 ,0x06 ,0x04 ,0x04 ,0x04 ,0x0E ,     // i
0x08 ,0x00 ,0x0C ,0x08 ,0x08 ,0x09 ,0x06 ,     // j
0x01 ,0x01 ,0x09 ,0x05 ,0x03 ,0x05 ,0x09 ,     // k
0x06 ,0x04 ,0x04 ,0x04 ,0x04 ,0x04 ,0x0E ,     // l
0x00 ,0x00 ,0x0B ,0x15 ,0x15 ,0x11 ,0x11 ,     // m
0x00 ,0x00 ,0x0D ,0x13 ,0x11 ,0x11 ,0x11 ,     // n
0x00 ,0x00 ,0x0E ,0x11 ,0x11 ,0x11 ,0x0E ,     // o
0x00 ,0x00 ,0x0F ,0x11 ,0x0F ,0x01 ,0x01 ,     // p
0x00 ,0x00 ,0x16 ,0x19 ,0x1E ,0x10 ,0x10 ,     // q
0x00 ,0x00 ,0x0D ,0x13 ,0x01 ,0x01 ,0x01 ,     // r
0x00 ,0x00 ,0x0E ,0x01 ,0x0E ,0x10 ,0x0F ,     // s
0x02 ,0x02 ,0x07 ,0x02 ,0x02 ,0x12 ,0x0C ,     // t
0x00 ,0x00 ,0x11 ,0x11 ,0x11 ,0x19 ,0x16 ,     // u
0x00 ,0x00 ,0x11 ,0x11 ,0x11 ,0x0A ,0x04 ,     // v
0x00 ,0x00 ,0x11 ,0x11 ,0x15 ,0x15 ,0x0A ,     // w
0x00 ,0x00 ,0x11 ,0x0A ,0x04 ,0x0A ,0x11 ,     // x
0x00 ,0x00 ,0x11 ,0x11 ,0x1E ,0x10 ,0x0E ,     // y
0x00 ,0x00 ,0x1F ,0x08 ,0x04 ,0x02 ,0x1F ,     // z
0x08 ,0x04 ,0x04 ,0x02 ,0x04 ,0x04 ,0x08 ,     // {
0x04 ,0x04 ,0x04 ,0x00 ,0x04 ,0x04 ,0x04 ,     // |
0x02 ,0x04 ,0x04 ,0x08 ,0x04 ,0x04 ,0x02 ,     // }
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,     // ~
0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,     // Block
};


Veel succes ermee!

Max

Gebruikers-avatar
Berichten: 5043
Geregistreerd: 13 Mei 2013, 20:57
Woonplaats: Heemskerk

Re: Lichtkrant Surtronic FDS-132

Berichtdoor nicoverduin » 15 Jan 2014, 13:19

MaxJ schreef:Na het lezen van veel info van jullie over de FDS-132 matrixborden op Circuits Online en het Nedrlands Arduino Forum heb ik ook 3 van deze borden bij Baco besteld.
1 was er kapot: schuifregister chip vanaf gebroken. Baco heeft me zonder kosten een nieuwe gestuurd (terwijl ik, voordat ik er achter kwam dat de oude kapot was, de CPLD er al vanaf had gebrand...). Dat is echt service!
Piet doet niet zo moeilijk :)
Had je die link van dat filmpje naar hem toegestuurd? Vindt ie vast wel leuk :)
Docent HBO Technische Informatica, Embedded ontwikkelaar & elektronicus
http://www.verelec.nl

Gebruikers-avatar
Berichten: 2
Geregistreerd: 11 Dec 2013, 23:50

Re: Lichtkrant Surtronic FDS-132

Berichtdoor MaxJ » 15 Jan 2014, 15:16

Ik heb de link doorgestuurd. Bedankt voor de tip.

Berichten: 4
Geregistreerd: 30 Sep 2013, 22:17

Re: Lichtkrant Surtronic FDS-132

Berichtdoor Rolo » 15 Jan 2014, 19:21

Ziet er mooi uit, leuk om te weten dat je iets van mijn code gebruikt hebt.

Berichten: 11
Geregistreerd: 24 Mei 2016, 11:59

Re: Lichtkrant Surtronic FDS-132

Berichtdoor Looneyt » 24 Mei 2016, 12:31

Ik weet dat dit topic al twee jaar niet meer actief is, maar mijn vraag heeft betrekking op de FDS132.

We proberen de FDS132 te gebruiken voor ons vrijwilligerszwembad om de huidige tijd, water temperatuur en lucht temperatuur te tonen. De temperatuur nodes zenden draadloos hun data naar een MQTT server die draait op een Pi. Deze Pi zou dan de temperaturen en tijd naar de arduino moeten sturen zodat deze het kan tonen.

Alle basis zaken werken, Pi communiceert middels USB met de Arduino (Het display kan ook rechtstreeks op de Pi aangesloten worden maar dit is niet werkend bij ons) en de nodes verzenden hun temperatuur netjes.

Ik probeer met de library van BartW de tekst op het matrixbord te laten updaten maar loop vast.

De example sketch van BartW draait zonder problemen. Als ik dan probeer om er ingelezen seriële data ( if Serial.available() > 0 ) en met Serial.read() de tekst te laten updaten krijg ik compile errors. Ook als ik eerst een array vul en dan probeer de array te laten zien op het matrixbord kom ik errors bij het compilen tegen.
Verwacht de library van BartW Chars of een String? Ik zal later de code plaatsen, ik zit nu op m'n werk en heb de stoute schoenen aangetrokken om mijn vraag hier te posten :) .

Gebruikers-avatar
Berichten: 5043
Geregistreerd: 13 Mei 2013, 20:57
Woonplaats: Heemskerk

Re: Lichtkrant Surtronic FDS-132

Berichtdoor nicoverduin » 24 Mei 2016, 13:26

Ach compiler errors zijn zonder meer oplosbaar. Zet anders hier ff de sketch en de boodschappen. Lossen we het wel op.
Docent HBO Technische Informatica, Embedded ontwikkelaar & elektronicus
http://www.verelec.nl

Berichten: 11
Geregistreerd: 24 Mei 2016, 11:59

Re: Lichtkrant Surtronic FDS-132

Berichtdoor Looneyt » 24 Mei 2016, 23:17

Uiteindelijk zijn de buurman en ik bezig geweest om de voorbeeld sketch aan te passen zodat deze in ieder geval via de Pi tekst laat inlezen en kan weergeven. Hier hebben we wat successe geboekt. Helemaal 100% is het nog niet omdat bij het overschrijven van de bufferlengte de zaak niet meer werkt.

Compilen gaat wel goed in ieder geval.

cpp code
/*
Thanks to Rudi Imbrechts (http://arduinows.blogspot.nl/) for the initial example.
*/
#include "fds132text.h"
#include <SPI.h> //for some reason it only works if you include it here

char inData[22]; // Allocate some space for the string
char inChar; // Where to store the character read
byte index = 0; // Index into array; where to store the character

fdsScreen mainScreen;
fdsString *changeThisString;

void setup() {
Serial.begin(9600);

Serial.println("ehc");

mainScreen.setPins(); // Uses the default from Rudi Imbrechts guide on how to set up the pins.
// You can set diffent pins, see fds132text.h for the arguments
initialiseLetters() ; // I haven't figured out the smart way to set all the letter variables to the value I want yet.
mainScreen.addString("I love the arduino",0); // Add a string beginning at address 0 (the start of the screen)
mainScreen.update();
}

void loop()
{

mainScreen.display();

while(Serial.available() > 0) // Don't read unless
// there you know there is data
{
if(index < 19) // One less than the size of the array
{
inChar = Serial.read(); // Read a character
inData[index] = inChar; // Store it
index++; // Increment where to write next
inData[index] = '\0'; // Null terminate the string
}

if (index==18) {

// Serial.print(inData);
mainScreen.addString(inData,0);
delay(100);
mainScreen.update();
Serial.flush();
index=0;


}




}



/*


/* changeThisString = mainScreen.addString("a lot",90); // This one will start at the start of line 2
mainScreen.addString("-- Bart",225); // And this halfway through the third line


*/


}


Ook worden de zaken die nog in de buffer aanwezig zijn, niet weggehaald wat aangeeft dat de buffer niet gecleared wordt. Met serial.read of serial.flush lijkt het niet te lukken, e.e.a. nog in onderzoek natuurlijk.

Gebruikers-avatar
Berichten: 5043
Geregistreerd: 13 Mei 2013, 20:57
Woonplaats: Heemskerk

Re: Lichtkrant Surtronic FDS-132

Berichtdoor nicoverduin » 25 Mei 2016, 08:35

De buffer wordt nooit gewist bij Serial. Hij heeft een ringbuffer met 2 pointer (begin en eind). Als beide gelijk zijn dan is er gaan data. Bij een verschil is er available(). Je moet in de ontvangstbuffer altijd zorgen dat je voldoende ruimte hebt om alles te ontvangen. En controleren dat je niet buiten die boundary komt want dan ga je andere variabelen overschrijven met alle gevolgen van dien.
Serial.Flush() zorgt er voor dat de output buffer wordt geleegd. Dit is bijvoorbeeld nodig als je tussentijds in jouw programma zou willen wisselen van baudrates.
Docent HBO Technische Informatica, Embedded ontwikkelaar & elektronicus
http://www.verelec.nl

Vorige

Terug naar Overige hardware

Wie is er online?

Gebruikers in dit forum: Geen geregistreerde gebruikers en 9 gasten