Dcs bios LCD help

Hi guys,

After copying and pasting hundreds lines of codes and 30 odd libraries from the internet I've come to the conclusion I have no idea what I'm doing. I have manage so far to print 5 lines of text on my lcd screen which to me was a massive achievement.

This is the hardware I'm using:

Screen kuman 3.5 TFT Touch Screen with SD Card Socket for Arduino touch display compatible R3 Board with Touch Function SC3A-1 https://www.amazon.co.uk/dp/B075CXXL1M/ref=cm_sw_r_apan_glt_fabc_5D9AJHY8ZYA0GG340SKH?_encoding=UTF8&psc=1

Controller ELEGOO UNO R3 Project Super... https://www.amazon.co.uk/dp/B01D8KOZF4?ref=ppx_pop_mob_ap_share

This is the code that has worked for printing 5 lines on the lcd:

/***********************************************************************************
*This program is a demo of displaying string
*This demo was made for LCD modules with 8bit or 16bit data port.
*This program requires the the LCDKIWI library.

* File                : display_string.ino
* Hardware Environment: Arduino UNO&Mega2560
* Build Environment   : Arduino

*Set the pins to the correct ones for your development shield or breakout board.
*This demo use the BREAKOUT BOARD only and use these 8bit data lines to the LCD,
*pin usage as follow:
*                  LCD_CS  LCD_CD  LCD_WR  LCD_RD  LCD_RST  SD_SS  SD_DI  SD_DO  SD_SCK 
*     Arduino Uno    A3      A2      A1      A0      A4      10     11     12      13                            
*Arduino Mega2560    A3      A2      A1      A0      A4      10     11     12      13                           

*                  LCD_D0  LCD_D1  LCD_D2  LCD_D3  LCD_D4  LCD_D5  LCD_D6  LCD_D7  
*     Arduino Uno    8       9       2       3       4       5       6       7
*Arduino Mega2560    8       9       2       3       4       5       6       7 

*Remember to set the pins to suit your display module!
*
* @attention
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, QD electronic SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
**********************************************************************************/

#include <LCDWIKI_GUI.h> //Core graphics library
#include <LCDWIKI_KBV.h> //Hardware-specific library

//if the IC model is known or the modules is unreadable,you can use this constructed function
LCDWIKI_KBV mylcd(ILI9486,A3,A2,A1,A0,A4); //model,cs,cd,wr,rd,reset
//if the IC model is not known and the modules is readable,you can use this constructed function
//LCDWIKI_KBV mylcd(320,480,A3,A2,A1,A0,A4);//width,height,cs,cd,wr,rd,reset

//define some colour values
#define  BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF

void setup() 
{
  Serial.begin(9600);
  mylcd.Init_LCD();
  Serial.println(mylcd.Read_ID(), HEX);
  mylcd.Fill_Screen(BLACK);
}

void loop() 
{
  mylcd.Set_Rotation(3);//display rotation
  mylcd.Set_Text_Mode(1);
  
  //display line 1 string
  mylcd.Fill_Screen(0x0000);//change the backgroung colour
  mylcd.Set_Text_colour(GREEN);//change colour of text
  mylcd.Set_Text_Back_colour(BLACK);
  mylcd.Set_Text_Size(4);//change text size
  mylcd.Print_String("UFC 305.00 STPT 2", 0, 10);//writes text and where it prints on screen



  //display line 2 string
  mylcd.Set_Text_colour(GREEN);
  mylcd.Set_Text_Size(4);
  mylcd.Print_String("UFC 305.00 STPT 2", 0, 80);


  //display line 3 string
  mylcd.Set_Text_colour(GREEN);
  mylcd.Set_Text_Size(4);
  mylcd.Print_String("UFC 305.00 STPT 2", 0, 150);


     //display line 4 string
  mylcd.Set_Text_colour(GREEN);
  mylcd.Set_Text_Size(4);
  mylcd.Print_String("UFC 305.00 STPT 2", 0, 210);


  //display line 5 string
  mylcd.Set_Text_colour(GREEN);
  mylcd.Set_Text_Size(4);
  mylcd.Print_String("UFC 305.00 STPT 2", 0, 270);


  delay(9000);

}

So obviously I know this has no benefit to using dcs bios. I just wanted to see how the screen would look.

My plan its to have dcs bios to print on the lcd screen to make a ded screen but I don't know what code to use.

From dcs bios

void onDedLine1Change(char* newValue) {
/* your code here */
}
DcsBios::StringBuffer<25> dedLine1Buffer(0x44fc, onDedLine1Change);

I've been trying for the last month with different lines of code and different libraries but nothing seems to work for me. Can someone help me with an example of what to input so I can get the result I'm after.

Thanks

RED

You made it this far - congratulations!

Now that you have the basic hardware working, stop for ten minutes and read about how to post code, and the best way to arrange your question.

More people will read it,mand some of them might respond.

As this is early in the thread, you can go back edit your initial post,nand make it right.
Merry Christmas!

Apologies,
Hopefully the code is now in the correct format

Thanks
Red

Hi all,

I've finally managed to find the code I need, It came from a A-10c CDU sketch. I changed a few lines to make it work for me so if you have this hardware this code should work for you.

#include <Adafruit_GFX.h>
#include <Adafruit_GrayOLED.h>
#include <Adafruit_SPITFT.h>
#include <Adafruit_SPITFT_Macros.h>
#include <gfxfont.h>
#include <Adafruit_GrayOLED.h>
#include <Adafruit_SPITFT.h>
#include <Adafruit_SPITFT_Macros.h>
#include <gfxfont.h>

/*
  Tell DCS-BIOS to use a serial connection and use the default Arduino Serial
  library. This will work on the vast majority of Arduino-compatible boards,
  but you can get corrupted data if you have too many or too slow outputs
  (e.g. when you have multiple character displays), because the receive
  buffer can fill up if the sketch spends too much time updating them.
  
  If you can, use the IRQ Serial connection instead.
*/
#define DCSBIOS_IRQ_SERIAL

#include "DcsBios.h"
#include <Adafruit_GFX.h>
#include <UTFTGLUE.h>

UTFTGLUE myGLCD(0x9488,A2,A1,A3,A4,A0);

void printChar(int row, int col, unsigned char c) {
  int16_t x = 13 + col * 19;
  int16_t y = row * 32 + 6;
  myGLCD.drawChar(x, y, c, 0x07E0, 0x0, 3);
} 

/* paste code snippets from the reference documentation here */
void onDedLine1Change(char* newValue) {
  for(int i = 0; i < 24; i++){
    printChar(1, i, newValue[i]);
  }
}
DcsBios::StringBuffer<25> dedLine1Buffer(0x44fc, onDedLine1Change);

void onDedLine2Change(char* newValue) {
  for(int i = 0; i < 24; i++){
    printChar(3, i, newValue[i]);
  }
}
DcsBios::StringBuffer<25> dedLine2Buffer(0x4516, onDedLine2Change);

void onDedLine3Change(char* newValue) {
  for(int i = 0; i < 24; i++){
    printChar(5, i, newValue[i]);
  }
}
DcsBios::StringBuffer<25> dedLine3Buffer(0x4530, onDedLine3Change);

void onDedLine4Change(char* newValue) {
  for(int i = 0; i < 24; i++){
    printChar(7, i, newValue[i]);
  }
}
DcsBios::StringBuffer<25> dedLine4Buffer(0x454a, onDedLine4Change);

void onDedLine5Change(char* newValue) {
  for(int i = 0; i < 24; i++){
    printChar(9, i, newValue[i]);
  }
}
DcsBios::StringBuffer<25> dedLine5Buffer(0x4564, onDedLine5Change);
 
void setup() {
  DcsBios::setup();

  // Setup the LCD
  myGLCD.InitLCD();
  myGLCD.clrScr();
  myGLCD.setTextSize(3);
  myGLCD.setColor(0, 0, 255);
  myGLCD.drawRect(10, 0, 469, 319);
}

void loop() {
  DcsBios::loop();
}

Thanks Red

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