Falsches Display gekauft

Hallo an alle
Ich habe ein Displayprojekt nachgebaut. Das 1 Display läuft auch super.
Wollte das gleiche Projekt nochmal nachbauen und habe das falsche Display gekauft.
Ich jetzt das Problem.
Das ist der Schaltplan von dem Projekt:

Ich komme mit der Pinbelegung(bezeichnung) nicht zurecht.

vergleich

Das erste Display was ich gekauft habe war Typ 3.
Das zweite Display was ich erwischt habe war Typ 2.
Die den Pins vom Typ 3 sind mir klar.

Auch Pins vom Typ 2 sind klar , diese sind.

DB7 bis DB0,E,R/W,RS,Vo,Vdd,Vss,CS2,CS1,Vout,RST ,LedA,LEDK.

aber beim Typ 3 gibt es einen Pin im Schaltplan mit der Bezeichnung CS3 was ist mit dem bei Typ 2.
(Ich weis schon das das zum ansteuren der Felder(SEGMENTE) im Display ist.)
Wie muss ich mit CS3 machen.
Das ist mein ganzesProblem.

Danke Stefan

Gib uns doch mal Links deiner gekauften Displays.
Da können wir sicher mehr daraus erkennen.

Hallo HotSystems
Hier ist der Link.

Hallo Stefan,

soweit ich dass verstehe unterscheiden sich Typ 1, Typ 2 und Typ 3 Displays Grundsätzlich in der Größe bzw. der Pixel und den darin Verbauten KS0108 Chips.

Das Typ 2 Display hat zwar wie das Typ 3 Display 3 Chips drauf, selektiert diese aber nur über die Pin´s CS1 und CS2.

Link zu Beitrag mit Erklärung.

Hast du beim kompilieren den richtigen Displaytyp ausgewählt?

P.S. Den CS3 brauchst du bei dem Typ 2 nicht. Es muss aber beim beschreiben des Controllers ein anderer Displaytyp ausgewählt werden, wie bei dem mit dem Typ 3.

Hallo Brutus279
Danke für die Antwort .
Habe mir das jetzt mal durchgelesen.Habe das mal auf gut glück gebaut und es hat beim ersten mal gelappt. Also das bedeutet für mich , das ich das Hex file für den Typ 3 auf den Atmega brenne und dann in der Datei ks0108.h von Typ 3 auf 2 umstellen muss. Aber was bedeutet das für den Schaltplan. Was passiert mit dem CS3 Signal von Controller bei dem neuen Display für mich. Wo muss der Pin angeschlossen werden oder beleibt der NC.

Genau daher habe ich das Display.

Danke Stefan

Ich hoffe dass sich hier noch jemand der sich sehr sicher in der Materie ist deinem Problem annehmen wird.

Ich bin mir aber ziemlich sicher dass du den Anschluss für CS3 nicht belegen musst, da dieser nur beim Typ 3 benutzt wird, wo die 3 x KS0108´s separat angesteuert werden.

Hallo Brutus279
Danke für die Antwort, das ist doch schon mal ein anfang.
Werde es morgen mal ausprobieren.
Danke Stefan

Hallo an alle
Jetzt muss ich nochmal was Fragen was ich nicht verstehe:
Habe es jetzt von der Hardware herbekommen das das Display geht.Zumindest kann ich den Kontrast verstellen, und
Licht habe ich auch.

Ich muss laut Artikel in der Datei ks0108.h das Display Typ auswählen.
Eingestellt war Typ 3 und das habe ich auf Typ 2 umgestellt.
Aber was ich nicht begreife ist das ich die "ks0108.h" nirgendswo eingebunden ist.
Habe ein Beispiel von ihm genommen.
Kann mir da mal einer einen Typ geben , was ich da machen muss.Der Code ist jetzt weiter unten.

Danke Stefan

Sketch in Codetags einstellen , hier oben "< CODE >" wählen danach einfügen, wo möglich findet sich jemand was sich mit den LCD's auskennt.

Hallo fony

/*-------------------------------------------------------------------------------------
 * glcd_demo
 * 
 * Simple exmaple for working with the I2C graphic LCD
 * Reads a value from ADC port 0 and shows that value as a horizonatl bar graph
 * In addition, the display light is switch off after a period of inactivity 
 * and restored to the previous level, once activity is recogized
 * 
 * Stephan Laage-Witt - 17-Dec-2017
 * http://laagewitt.de/smart-i2c-glcd-am-arduino-ein-einfaches-beispiel/
 */

#include <Wire.h>
#include <glcd_functions.h>

#define ADC_CHANNEL A0
#define LIGHT_OFF_DELAY 300
#define ADC_OFFSET 10

// Global varibales -------------------------------------------------------------------
glcd my_gd(0x20);                           // instance of the graphic display at I2C address 0x20

uint16_t delay_cnt = LIGHT_OFF_DELAY;       // counter measuring time of inactivity

struct bar_graph {
  uint8_t x_pos;                            // coordinates of the upper left corner
  uint8_t y_pos;
  uint8_t len;                              // length and width of the bar
  uint8_t width;
  uint8_t new_display_len;                  // new length of the display bar, to be set
  uint8_t current_display_len;              // current length of the display bar
} my_bar_graph;


// setup() ----------------------------------------------------------------------------
void setup() {
  uint8_t x_cur, y_cur, font_height;
  
  // initialize bar graph
  my_bar_graph.x_pos = 10;
  my_bar_graph.y_pos = 40;
  my_bar_graph.len = 170;
  my_bar_graph.width = 6;
  my_bar_graph.current_display_len = 0;

  // start display, print title and draw bar frame for the bar graph  
  Wire.begin();
  my_gd.clear_screen();                          
  my_gd.set_light(10);
  my_gd.set_font(4);                             
  my_gd.draw_str("Smart I2C GLCD Demo with Arduino"); 
  delay(40);                            // ensure buffer is empty prior to read request
  my_gd.get_cursor(&x_cur, &y_cur);
  font_height = my_gd.get_font_height();
  my_gd.draw_line(0, font_height + 1, x_cur - 1, font_height + 1, 1);
  draw_bar_graph_frame(&my_bar_graph);   // plot frame for the bar
  my_gd.set_font(0);
}

// loop() -----------------------------------------------------------------------------
void loop() {
  uint16_t adc_value;                           // input via ADC channel 0 (0 ... 1024)
  uint16_t conv_value;                          // converted ADC value (0 ... 1000)
  
  // read and print ADC value
  adc_value = analogRead(ADC_CHANNEL);                      
  my_gd.set_cursor(my_bar_graph.x_pos - 5, my_bar_graph.y_pos - 20);
  my_gd.draw_udec(adc_value, 4, 1);               

  // convert ADC value to usable range (0 ... 1000)
  if (adc_value < ADC_OFFSET) conv_value = 0; 
  else if(adc_value > 1000 + ADC_OFFSET) conv_value = 1000;
  else conv_value = adc_value - ADC_OFFSET;
  my_bar_graph.new_display_len = (uint32_t) conv_value * my_bar_graph.len / 1000;         // calculate corresponding display len

  // show current value and manage back light
  if (my_bar_graph.new_display_len != my_bar_graph.current_display_len) {       // any changes ?
    refresh_bar_graph(&my_bar_graph);             // show new value
    my_gd.dim_off();                              // enable display backlight 
    delay_cnt = LIGHT_OFF_DELAY;                  // re-initilaize delay_counter
  } else {                                
    if (delay_cnt > 0) {                           // otherwise in case of no changes ...     
      --delay_cnt;                                 // count down delay counter
      if (delay_cnt == 0)                          // when reaching zero ...
        my_gd.dim_on();                            // switch off the light
    };
  }

  // wait a moment
  delay(100);
}

/* draw_bar_graph_frame(bar_graph *bg) --------------------------------------------------------------
 *  Plots the frame for a horizontal bar display
 */
void draw_bar_graph_frame(bar_graph *bg) {
  uint16_t tickmark, tickmark_x;
  char tickmark_str[4];

  // draw empty box
  my_gd.draw_rectangle(bg->x_pos -1 , bg->y_pos - 1, bg->x_pos + bg->len + 1, bg->y_pos + bg->width + 1, 1);
  // draw tick marks
  my_gd.set_font(1);
  for (tickmark = 0; tickmark <= 1000; tickmark += 100) {             // 10 tickmarks in total
    tickmark_x = bg->x_pos + ((uint32_t) tickmark * bg->len / 1000); 
    my_gd.set_pixel(tickmark_x, bg->y_pos - 2, 1);
    my_gd.set_pixel(tickmark_x, bg->y_pos - 3, 1);
    my_gd.set_pixel(tickmark_x, bg->y_pos + bg->width + 2, 1);
    my_gd.set_pixel(tickmark_x, bg->y_pos + bg->width + 3, 1);
    my_gd.set_pixel(tickmark_x, bg->y_pos + bg->width + 2, 1);
    my_gd.set_pixel(tickmark_x, bg->y_pos + bg->width + 3, 1);
    if (tickmark % 200 == 0) {
      my_gd.set_cursor(tickmark_x, bg->y_pos - 9);                    // every other tickmark with label
      itoa(tickmark / 10, tickmark_str, 10);
      my_gd.draw_center_str(tickmark_str);
    };
  };
}

/* refresh_bar_graph(bar_graph *bg) -------------------------------------------------------------------
 *  Plots a display bar  
 */
void refresh_bar_graph(bar_graph *bg) {
  if (bg->new_display_len > bg->current_display_len) {                 // in case the new bar is longer than the current ... 
    my_gd.draw_filled_rectangle(bg->x_pos + bg->current_display_len,
      bg->y_pos, bg->x_pos + bg->new_display_len, 
      bg->y_pos + bg->width, 1);
  } else if (bg->new_display_len < bg->current_display_len) {         // in case the new bar is shorter than the current ... 
    my_gd.draw_filled_rectangle(bg->x_pos + bg->new_display_len + 1, 
      bg->y_pos, bg->x_pos + bg->current_display_len, 
      bg->y_pos + bg->width, 0);
  };
  bg->current_display_len = bg->new_display_len;                      // udpate current status of the display
}

Habe den Code jetzt mal als Beispiel genommen.
Es geht mir nur um das Einbinden der Ks0108.h Datei in den Code.

Woher weißt Du denn, dass die nirgendwo eingebunden ist? Hast Du Dir die glcd_functions.h Datei schon angeschaut?

Hallo Kai-R
Ich habe ich .
Da ist nur die arduino.h und die glcd_functions.h eingebunden.
Danke Stefan

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.