I want to find...

Search

Shares

Table of Content

EthercatDevice_DmpLCD.lcdSetTextSize()

[EthercatDevice_DmpLCD_Generic]

Description

Set the font size multiplier for the text to be printed on the LCD display of the EtherCAT slave device. The default font size multiplier is 1, which corresponds to a 6 x 8 font. This means the text will be 6 pixels wide and 8 pixels tall. You can increase the font size multiplier by setting the value to 2, 3, or higher. Each increment in the font size multiplier results in a larger font. For example:

  • s = 2: 12 x 16 pixels.
  • s = 3: 18 x 24 pixels.
  • s = 4: 24 x 32 pixels.
  • And so on.

Beyond uniform scaling, fonts can also be scaled individually in width and height. This means that the font can be stretched horizontally or vertically without affecting the other dimensions. For example:

  • w = 1, h = 2: 6 x 16 pixels.
  • w = 2, h = 1: 12 x 8 pixels.
  • w = 2, h = 4: 12 x 32 pixels.
EthercatDevice_DmpLCD.lcdSetTextSize-1

Derived Class:

Class NameVendor IDProduct Code
EthercatDevice_QECR11UN010x00000bc30x0086d103
EthercatDevice_QECR00UN010x00000bc30x0086d100

Syntax

int lcdSetTextSize(uint8_t s);
int lcdSetTextSize(uint8_t w, uint8_t h);

Parameters

  • [in] uint8_t s
    The font size multiplier for the text to be printed.
  • [in] uint8_t w
    The font width multiplier for the text to be printed.
  • [in] uint8_t h
    The font height multiplier for the text to be printed.

Return Value

Return an error code. If the returned value is zero, it indicates a successful execution of this function.

Comment

This function must be called after a successful execution of EthercatMaster::begin(). This function is non-blocking and can be called within the Cyclic Callback.

Example

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_QECR00UN01 slave;

void CyclicCallback() {
  slave.update();
}

void setup() {
  master.begin();
  slave.attach(0, master);
  slave.lcdInit(ECAT_LCD_ILI9341_1);
  master.attachCyclicCallback(CyclicCallback);
  master.start();

  slave.lcdSetTextSize(2);
  slave.lcdPrint("Hello World!\n");
  slave.lcdSetTextSize(2, 4);
  slave.lcdPrint("Hello World!\n");
}

void loop() {
  // ...
}

Please see EthercatDevice_DmpLCD_Generic Class for more QEC Stepper Drivers instructions and API usage.

Scroll to Top