Jump to content

DCS BIOS A10C CMSP SCRIPTING


RogerRabbit

Recommended Posts

Hi everyone,

 

I am trying to understand how to get dcs bios to work with my 1602 lcd. I am also using I2C. I am able to use the lcd to write whatever I want but not get a string buffer to work. Through the control reference I thought I just assign the string to the display i.e (0,0) or (0,1) for 16x2 display. Any information would help a lot so I can see how I'm coding it wrong. Thank you in advance. My code is here:

 

/*

Tell DCS-BIOS to use a serial connection and use interrupt-driven

communication. The main program will be interrupted to prioritize

processing incoming data.

 

This should work on any Arduino that has an ATMega328 controller

(Uno, Pro Mini, many others).

*/

#define DCSBIOS_IRQ_SERIAL

 

#include "DcsBios.h"

 

#include <Wire.h>

#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

 

 

///LINE 1

void onCmsp1Change(char* newValue) {

 

lcd.setCursor(0,0);

}

DcsBios::StringBuffer<16> cmsp1Buffer(0x1000, onCmsp1Change);

 

////LINE 2

 

void onCmsp2Change(char* newValue) {

lcd.setCursor(0,1);

}

DcsBios::StringBuffer<16> cmsp2Buffer(0x1014, onCmsp2Change);

 

 

void setup() {

DcsBios::setup();

 

// initialize the LCD

lcd.begin();

 

// Turn on the blacklight and print a message.

 

}

 

void loop() {

DcsBios::loop();

}

Link to comment
Share on other sites

  • 2 months later...

I used this for my 16x2 display with I2c

 

 

/*

Tell DCS-BIOS to use a serial connection and use interrupt-driven

communication. The main program will be interrupted to prioritize

processing incoming data.

 

This should work on any Arduino that has an ATMega328 controller

(Uno, Pro Mini, many others).

*/

#define DCSBIOS_IRQ_SERIAL

 

#include <DcsBios.h>

#include <Wire.h>

#include <LiquidCrystal_I2C.h>

 

 

// Set the LCD address to 0x27 for a 16 chars and 2 line display

LiquidCrystal_I2C lcd(0x27, 16, 2);

 

/* paste code snippets from the reference documentation here */

void onCmsp1Change(char* newValue) {

lcd.setCursor(0, 0);

 

lcd.print(newValue[0]);

lcd.print(newValue[1]);

lcd.print(newValue[2]);

lcd.print(newValue[3]);

 

lcd.print(newValue[5]);

lcd.print(newValue[6]);

lcd.print(newValue[7]);

lcd.print(newValue[8]);

 

lcd.print(newValue[10]);

lcd.print(newValue[11]);

lcd.print(newValue[12]);

lcd.print(newValue[13]);

 

lcd.print(newValue[15]);

lcd.print(newValue[16]);

lcd.print(newValue[17]);

lcd.print(newValue[18]);

}

DcsBios::StringBuffer<19> cmsp1Buffer(0x1000, onCmsp1Change);

 

void onCmsp2Change(char* newValue) {

lcd.setCursor(0, 1);

 

lcd.print(newValue[0]);

lcd.print(newValue[1]);

lcd.print(newValue[2]);

lcd.print(newValue[3]);

 

lcd.print(newValue[5]);

lcd.print(newValue[6]);

lcd.print(newValue[7]);

lcd.print(newValue[8]);

 

lcd.print(newValue[10]);

lcd.print(newValue[11]);

lcd.print(newValue[12]);

lcd.print(newValue[13]);

 

lcd.print(newValue[15]);

lcd.print(newValue[16]);

lcd.print(newValue[17]);

lcd.print(newValue[18]);

}

DcsBios::StringBuffer<19> cmsp2Buffer(0x1014, onCmsp2Change);

 

void setup() {

DcsBios::setup();

// initialize the LCD

lcd.begin();

// Turn on the backlight.

 

lcd.backlight();

 

 

 

}

 

void loop() {

DcsBios::loop();

}


Edited by Chickenbone72
Link to comment
Share on other sites

just changed format to fit the 16 X 2 format

 

/*

Tell DCS-BIOS to use a serial connection and use interrupt-driven

communication. The main program will be interrupted to prioritize

processing incoming data.

 

This should work on any Arduino that has an ATMega328 controller

(Uno, Pro Mini, many others).

*/

#define DCSBIOS_IRQ_SERIAL

 

#include <DcsBios.h>

#include <Wire.h>

#include <LiquidCrystal_I2C.h>

 

 

// Set the LCD address to 0x27 for a 16 chars and 2 line display

LiquidCrystal_I2C lcd(0x27, 16, 2);

 

/* paste code snippets from the reference documentation here */

 

void onCmsp1Change(char* newValue) {

lcd.setCursor(0, 0);

 

lcd.print(newValue[0]);

lcd.print(newValue[1]);

lcd.print(newValue[2]);

lcd.print(newValue[3]);

 

lcd.print(newValue[5]);

lcd.print(newValue[6]);

lcd.print(newValue[7]);

lcd.print(newValue[8]);

 

lcd.print(newValue[10]);

lcd.print(newValue[11]);

lcd.print(newValue[12]);

lcd.print(newValue[13]);

 

lcd.print(newValue[15]);

lcd.print(newValue[16]);

lcd.print(newValue[17]);

lcd.print(newValue[18]);

}

DcsBios::StringBuffer<19> cmsp1Buffer(0x1000, onCmsp1Change);

 

void onCmsp2Change(char* newValue) {

lcd.setCursor(0, 1);

 

lcd.print(newValue[0]);

lcd.print(newValue[1]);

lcd.print(newValue[3]);

lcd.print(newValue[4]);

 

lcd.print(newValue[5]);

lcd.print(newValue[6]);

lcd.print(newValue[8]);

lcd.print(newValue[9]);

 

lcd.print(newValue[10]);

lcd.print(newValue[11]);

lcd.print(newValue[12]);

lcd.print(newValue[13]);

 

lcd.print(newValue[14]);

lcd.print(newValue[15]);

lcd.print(newValue[16]);

lcd.print(newValue[17]);

}

DcsBios::StringBuffer<19> cmsp2Buffer(0x1014, onCmsp2Change);

 

void setup() {

DcsBios::setup();

// initialize the LCD

lcd.begin();

// Turn on the backlight.

 

lcd.backlight();

 

 

 

}

 

void loop() {

DcsBios::loop();

}

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...