Lib for Noritake Itron CU209SCPB VFD Module (1 Line, 20 Chars), Serial interface
Dependents: mbed_CU209SCPB_T20
More info is here.
Revision 0:93ae875cbb7a, committed 2017-12-10
- Comitter:
- wim
- Date:
- Sun Dec 10 17:02:32 2017 +0000
- Commit message:
- Lib for Noritake Itron VFD Module (1 Line, 20 Chars), Serial interface
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/CU209SCPB.cpp Sun Dec 10 17:02:32 2017 +0000
@@ -0,0 +1,230 @@
+/* mbed Library for Noritake Itron CU209SCPB-T20 VFD module
+ *
+ * Copyright (c) 2017, v01: WH, Initial version
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "mbed.h"
+#include "CU209SCPB.h"
+#include "CU209SCPB_UDC.inc"
+
+
+ /** Constructor for class for driving Noritake Itron CU209SCPB VFD module
+ *
+ * @brief Supports 1 line of 20 chars (5x7 matrix segments).
+ * Serial bus interface device.
+ * @param PinName TX Serial bus pin
+ * @param Baud baud selects baudrate (default 19200)
+ * @param Int Parity selects paritybits (default Even)
+ */
+CU209SCPB::CU209SCPB(PinName TXD, Baud baud, SerialBase::Parity parity) : _serial(TXD,NC), _baud(baud), _parity(parity) {
+
+ _init();
+
+ _column = 0;
+ _columns = CU209SCPB_NR_COLS;
+}
+
+/** Init the CU209SCPB interface and the module
+ *
+ * @param none
+ * @return none
+ */
+void CU209SCPB::_init(){
+
+//init Serial
+ _serial.baud(_baud);
+ _serial.format(8, _parity, 1); // CU209SCPB uses 8 databits, parity, 1 stopbit
+
+//init module
+// _serial.putc(D_ESC);
+// _serial.putc(int('I')); // Reset all settings
+//
+// _serial.putc(D_DC1); // Automatic CR mode, Cursor to 0 when reaching right end (Default)
+// _serial.putc(D_DC2); // Overputc mode, Overputc when reaching right end, Cursor does not move
+// _serial.putc(D_DC3); // Scroll mode, Text shifts left when reaching right end, Cursor does not move
+//
+// _serial.putc(D_CT0); // International Character Font (Default)
+// _serial.putc(D_CT1); // Katakana Character Font
+//
+// _serial.putc(D_ESC);
+// _serial.putc(int('T'));
+// _serial.putc(20); // Cursor Blinkspeed = 20 * 14.5ms (Default)
+ _serial.putc(80); // Cursor Blinkspeed = 80 * 14.5ms
+
+ setBrightness(CU209SCPB_BRT_DEF); // Default Brightness
+
+ // Clear the DCRAM (undefined at Reset)
+ cls();
+
+ // Clear the UDC RAM (undefined at Reset)
+ const char udc_none[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00};
+ for (int idx=0; idx < CU209SCPB_NR_UDC; idx++) {
+ setUDC(idx, (char *)udc_none);
+ }
+}
+
+
+/** Clear the screen and locate to 0
+ *
+ * @param none
+ * @return none
+ */
+void CU209SCPB::cls() {
+ _serial.putc(D_CLR); //Clear
+ _serial.putc(D_CR); //Cursor left
+
+ _column = 0;
+}
+
+
+/** Locate cursor to a screen column
+ *
+ * @param column The horizontal position from the left, indexed from 0
+ * @return none
+ */
+void CU209SCPB::locate(int column) {
+ //sanity check
+ if (column < 0) {column = 0;}
+ if (column > (_columns - 1)) {column = _columns - 1;}
+
+ _serial.putc(D_ESC);
+ _serial.putc(int('H'));
+ _serial.putc(column);
+
+ _column = column;
+}
+
+
+/** Number of screen columns
+ *
+ * @param none
+ * @return columns
+ */
+int CU209SCPB::columns() {
+ return _columns;
+}
+
+
+/** Set Brightness
+ *
+ * @param char brightness (valid range 0..FF)
+ * @return none
+ */
+void CU209SCPB::setBrightness(char brightness){
+
+//Sanity check
+ brightness = brightness & CU209SCPB_BRT_MSK; // mask invalid bits
+
+ _serial.putc(D_ESC);
+ _serial.putc(int('L'));
+ _serial.putc(brightness);
+}
+
+/** Set the Cursor mode On/off
+ *
+ * @param bool cursor mode
+ * @return none
+ */
+void CU209SCPB::setCursor(bool on) {
+
+ if (on) {
+ _serial.putc(D_DC5); // Blinking Cursor
+ }
+ else {
+ _serial.putc(D_DC4); // Invisible
+ }
+}
+
+/** Set Font
+ *
+ * @param int font (valid range: 0 == International, other == Katakana)
+ * @return none
+ */
+void CU209SCPB::setFont(int font){
+
+ if (font == 0) {
+ _serial.putc(D_CT0); // International (Default)
+ }
+ else {
+ _serial.putc(D_CT1); // Katakana
+ }
+}
+
+/** Set User Defined Characters (UDC)
+ *
+ * @param unsigned char udc_idx The Index of the UDC (0..7)
+ * @param UDCData_t udc_data The bitpattern for the UDC (7 bytes)
+ * @return none
+ */
+void CU209SCPB::setUDC(unsigned char udc_idx, UDCData_t udc_data) {
+
+//Sanity check
+ udc_idx = udc_idx & CU209SCPB_UADR_MSK; // mask invalid bits
+
+ _serial.putc(D_ESC);
+ _serial.putc(int('C')); // UDC command
+ _serial.putc(udc_idx);
+
+ _serial.putc( ((udc_data[1] & 0x07) << 5) | ((udc_data[0] & 0x1F) << 0) ); // P8 ...... P1
+ _serial.putc( ((udc_data[3] & 0x01) << 7) | ((udc_data[2] & 0x1F) << 2) | ((udc_data[1] & 0x18) >> 3) ); // P16 ...... P9
+ _serial.putc( ((udc_data[4] & 0x0F) << 4) | ((udc_data[3] & 0x1E) >> 1) ); // P24 ...... P17
+ _serial.putc( ((udc_data[6] & 0x03) << 6) | ((udc_data[5] & 0x1F) << 1) | ((udc_data[4] & 0x10) >> 4) ); // P32 ...... P25
+ _serial.putc( ((udc_data[6] & 0x1C) >> 2) ); // ... P35 P34 P33
+}
+
+/** putc a single character (Stream implementation)
+ *
+ * @param value char to print
+ * @return value;
+ */
+int CU209SCPB::_putc(int value) {
+
+ if ((value == '\n') || (value == '\r')) {
+ //No character to display
+ _serial.putc(D_CR); // Cursor to 0, Text remains as is
+
+ //Update Cursor
+ _column = 0;
+ }
+ else if ( ((value >= 0) && (value < CU209SCPB_NR_UDC)) ||
+ ((value >= CU209SCPB_CHR_STRT) && (value < CU209SCPB_CHR_END)) ){
+
+ //UDCs or Characters to display
+ _serial.putc(value);
+
+ //Update Cursor
+ _column++;
+ if (_column > (CU209SCPB_NR_COLS - 1)) {
+ _column = 0;
+ }
+ }
+
+ return value;
+}
+
+/** Get a single character (Stream implementation)
+ *
+ * @param none
+ * @return -1
+ */
+int CU209SCPB::_getc() {
+ return -1;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/CU209SCPB.h Sun Dec 10 17:02:32 2017 +0000
@@ -0,0 +1,279 @@
+/* mbed CU209SCPB Library, for Noritake Itron CU209SCPB VFD module
+ *
+ * Copyright (c) 2017, v01: WH, Initial version
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef CU209SCPB_H
+#define CU209SCPB_H
+
+// Select Noritake Itron CU209SCPB VFD module settings
+#include "CU209SCPB_Config.h"
+
+#include "CU209SCPB_UDC.h"
+
+/** An interface for driving Noritake Itron CU209SCPB VFD module
+ *
+ * @code
+ *
+ * #include "mbed.h"
+ * #include "CU209SCPB.h"
+ *
+ * DigitalOut myled(LED1);
+ * Serial pc(USBTX, USBRX);
+ *
+ * // CU209SCPB declaration, Default setting
+ * CU209SCPB CU209SCPB(p9); // TXD
+ *
+ * int main() {
+ * pc.printf("Hello World: CU209SCPB test\n\r");
+ *
+ * CU209SCPB.cls();
+ *
+ * CU209SCPB.putc('H');
+ * CU209SCPB.putc('e');
+ * CU209SCPB.putc('l');
+ * CU209SCPB.putc('l');
+ * CU209SCPB.putc('0');
+ * CU209SCPB.putc(' ');
+ * CU209SCPB.printf("World);
+ * wait(2);
+ * CU209SCPB.setBrightness(CU209SCPB_BRT0);
+ * wait(2);
+ * CU209SCPB.setBrightness(CU209SCPB_BRT3);
+ *
+ * while(1) {
+ * myled = !myled;
+ * wait(1);
+ * }
+ * }
+ * #endif
+ *
+ * @endcode
+ */
+
+
+//CU209SCPB Display data
+#define CU209SCPB_MAX_NR_GRIDS 20
+#define CU209SCPB_BYTES_PER_GRID 1
+
+//Memory size in bytes for Display
+#define CU209SCPB_DSP_MEM (CU209SCPB_MAX_NR_GRIDS * CU209SCPB_BYTES_PER_GRID)
+
+//CU209SCPB Characters per line
+#define CU209SCPB_NR_COLS CU209SCPB_MAX_NR_GRIDS
+
+//CU209SCPB User Defined Characters
+#define CU209SCPB_NR_UDC 8
+//#define CU209SCPB_UDC_MEM 8
+
+
+//Serial control data consists of an 8-bit command and one or more data bytes.
+//Command and data are sent LSB first. Data address is auto incremented.
+
+//Command delay
+#define CU209SCPB_CMD_DLY 8
+
+//Commands Characters
+#define D_BS 0x08
+#define D_HT 0x09
+#define D_LF 0x0A
+#define D_FF 0x0C
+#define D_CR 0x0D
+#define D_CLR 0x0E
+
+#define D_DC1 0x11
+#define D_DC2 0x12
+#define D_DC3 0x13
+#define D_DC4 0x14
+#define D_DC5 0x15
+#define D_DC6 0x16
+#define D_DC7 0x17
+#define D_CT0 0x18
+#define D_CT1 0x19
+#define D_ESC 0x1B
+
+//Display Characters
+#define CU209SCPB_CHR_STRT 0x20
+#define CU209SCPB_CHR_END 0xFF
+
+
+//User Defined Characters (UDCs) are a 5x7 Matrix pattern that will show on the VFD as
+// 0 P1 P2 P3 P4 P5
+// 1 P6 P7 ..... P10
+// . .............
+// . .............
+// . .............
+// 6 P31 P32 ... P35
+//
+
+//UDCs are defined by sending a 5 byte bitpattern to the display.
+//UDC Command: ESC, 'C', UDC idx
+//Followed by:
+//UDC Data (4th byte .. 8th byte)
+// D7 D6 D5 D4 D3 D2 D1 D0
+// 0 P8 P7 P6 ...... P3 P2 P1
+// 1 P16 P15 P14 ........ P10 P9
+// 2 P24 P23 P22 .......... P17
+// 3 P32 P31 P30 ............ P25
+// 4 * * * .... * P35 P34 P33
+//
+//UDCs are defined by a 5x7 matrix and stored for convenience as 7 bytes with 5 significant bits
+typedef char UDCData_t[7];
+
+//Any character in the CU209SCPB ROM can be redefined as UDC.
+//However, the lib restricts UDCs to the first 8 characters (which are not in use anyhow).
+#define CU209SCPB_UADR_MSK 0x07
+
+
+//Brightness Level (0..3)
+#define CU209SCPB_BRT_0 0x00 //Duty 25%
+#define CU209SCPB_BRT_1 0x40 //Duty 50%
+#define CU209SCPB_BRT_2 0x80 //Duty 75%
+#define CU209SCPB_BRT_3 0xC0 //Duty 100% (Default)
+
+#define CU209SCPB_BRT_DEF (CU209SCPB_BRT_1)
+
+#define CU209SCPB_BRT_MSK 0xFF
+
+
+
+/** A class for driving Noritake Itron CU209SCPB VFD module
+ *
+ * @brief Supports 1 line of 20 chars (5x7 matrix segments).
+ * Serial bus interface device.
+ * @param PinName TX Serial bus pin
+ * @param Baud baud selects baudrate (default 19200)
+ * @param Int Parity selects paritybits (default Even)
+ */
+class CU209SCPB : public Stream {
+
+ public:
+
+/** Enums
+ */
+ enum Baud {
+ B_300 = 300,
+ B_600 = 600,
+ B_1200 = 1200,
+ B_2400 = 2400,
+ B_9600 = 9600,
+ B_19200 = 19200
+ };
+
+/** Constructor for class for driving Noritake Itron CU209SCPB VFD module
+ *
+ * @brief Supports 1 line of 20 chars (5x7 matrix segments).
+ * Serial bus interface device.
+ * @param PinName TX Serial bus pin
+ * @param Baud baud selects baudrate (default 19200)
+ * @param Parity parity selects paritybits (default Even)
+ */
+ CU209SCPB(PinName TXD, Baud baud = B_19200, SerialBase::Parity parity = SerialBase::Even);
+
+ /** Clear the screen and locate to 0
+ *
+ * @param none
+ * @return none
+ */
+ void cls();
+
+ /** Locate cursor to a screen column
+ *
+ * @param column The horizontal position from the left, indexed from 0
+ * @return none
+ */
+ void locate(int column);
+
+ /** Number of screen columns
+ *
+ * @param none
+ * @return columns
+ */
+ int columns();
+
+#if DOXYGEN_ONLY
+ /** Write a character to the Display
+ *
+ * @param c The character to write to the display
+ * @return char written
+ */
+ int putc(int c);
+
+ /** Write a formatted string to the Display
+ *
+ * @param format A printf-style format string, followed by the
+ * variables to use in formatting the string.
+ */
+ int printf(const char* format, ...);
+#endif
+
+ /** Set Brightness
+ *
+ * @param char brightness (3 significant bits, valid range 0..7 (dutycycle linked to number of grids)
+ * @return none
+ */
+ void setBrightness(char brightness = CU209SCPB_BRT_DEF);
+
+ /** Set the Cursor mode On/off
+ *
+ * @param bool cursor mode
+ * @return none
+ */
+ void setCursor(bool on);
+
+ /** Set Font
+ *
+ * @param int font (valid range: 0 == International, other == Katakana)
+ * @return none
+ */
+ void setFont(int font = 0);
+
+ /** Set User Defined Characters (UDC)
+ *
+ * @param unsigned char udc_idx The Index of the UDC (0..7)
+ * @param UDCData_t udc_data The bitpattern for the UDC (7 bytes)
+ * @return none
+ */
+ void setUDC(unsigned char udc_idx, UDCData_t udc_data);
+
+ protected:
+ // Stream implementation functions
+ virtual int _putc(int value);
+ virtual int _getc();
+
+
+ /** Init the Serial interface and the module
+ *
+ * @param none
+ * @return none
+ */
+ void _init();
+
+ private:
+ Serial _serial;
+ Baud _baud;
+ SerialBase::Parity _parity;
+
+ int _column; // Current cursor location
+ int _columns; // Max number of columns
+};
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CU209SCPB_Config.h Sun Dec 10 17:02:32 2017 +0000 @@ -0,0 +1,30 @@ +/* mbed CU209SCPB Library, for Noritake Itron CU209SCPB VFD module + * + * Copyright (c) 2017, v01: WH, Initial version + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef CU209SCPB_CONFIG_H +#define CU209SCPB_CONFIG_H + +// Select if you want to include some UDC patterns +#define CU209SCPB_UDC 1 + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CU209SCPB_UDC.h Sun Dec 10 17:02:32 2017 +0000 @@ -0,0 +1,65 @@ +/* mbed CU209SCPB UDC Library, for Noritake Itron CU209SCPB VFD module + * + * Copyright (c) 2017, v01: WH, Initial version + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +#ifndef MBED_CU209SCPB_UDC_H +#define MBED_CU209SCPB_UDC_H + +#include "CU209SCPB_Config.h" + +#if(CU209SCPB_UDC == 1) +//User Defined Characters (UDCs) are a 5x7 Matrix pattern that will show on the VFD as +// 0 P1 P2 P3 P4 P5 +// 1 P6 P7 ..... P10 +// . ............. +// . ............. +// . ............. +// 6 P31 P32 ... P35 +// + +//UDCs are defined by sending a 5 byte bitpattern to the display. +//UDC Command: ESC, 'C', UDC idx +//Followed by: +//UDC Data (4th byte .. 8th byte) +// D7 D6 D5 D4 D3 D2 D1 D0 +// 0 P8 P7 P6 ...... P3 P2 P1 +// 1 P16 P15 P14 ........ P10 P9 +// 2 P24 P23 P22 .......... P17 +// 3 P32 P31 P30 ............ P25 +// 4 * * * .... * P35 P34 P33 +// + +//UDCs are defined by a 5x7 matrix and stored for convenience as 7 bytes with 5 significant bits +// +// Some sample User Defined Chars 5x7 dots */ +//extern const char udc_Bat_Hi[]; // Battery Full +//extern const char udc_Bat_Ha[]; // Battery Half +//extern const char udc_Bat_Lo[]; // Battery Low +//extern const char udc_checker[]; + +//extern const char udc_PO[]; //Padlock Open +//extern const char udc_PC[]; //Padlock Closed + +extern const char udc_LAR[]; // Left Arrow +extern const char udc_RAR[]; // Right Arrow +#endif + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/CU209SCPB_UDC.inc Sun Dec 10 17:02:32 2017 +0000
@@ -0,0 +1,62 @@
+/* mbed CU209SCPB UDC Library, for Noritake Itron CU209SCPB VFD module
+ *
+ * Copyright (c) 2017, v01: WH, Initial version
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#include "CU209SCPB_Config.h"
+
+#if(CU209SCPB_UDC == 1)
+
+//User Defined Characters (UDCs) are a 5x7 Matrix pattern that will show on the VFD as
+// 0 P1 P2 P3 P4 P5
+// 1 P6 P7 ..... P10
+// . .............
+// . .............
+// . .............
+// 6 P31 P32 ... P35
+//
+
+//UDCs are defined by sending a 5 byte bitpattern to the display.
+//UDC Command: ESC, 'C', UDC idx
+//Followed by:
+//UDC Data (4th byte .. 8th byte)
+// D7 D6 D5 D4 D3 D2 D1 D0
+// 0 P8 P7 P6 ...... P3 P2 P1
+// 1 P16 P15 P14 ........ P10 P9
+// 2 P24 P23 P22 .......... P17
+// 3 P32 P31 P30 ............ P25
+// 4 * * * .... * P35 P34 P33
+//
+
+//UDCs are defined by a 5x7 matrix and stored for convenience as 7 bytes with 5 significant bits
+//The patterns below will show up in mirrored form on the display
+//
+// Some sample User Defined Chars 5x7 dots */
+const char udc_Bat_Hi[] = {0x0E, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F}; // Battery Full
+const char udc_Bat_Ha[] = {0x0E, 0x11, 0x13, 0x17, 0x1F, 0x1F, 0x1F}; // Battery Half
+const char udc_Bat_Lo[] = {0x0E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}; // Battery Low
+const char udc_checker[] = {0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA};
+
+//const char udc_PO[] = {0x04, 0x0A, 0x0A, 0x1F, 0x1B, 0x1B, 0x1B}; //Padlock Open
+//const char udc_PC[] = {0x1C, 0x10, 0x08, 0x1F, 0x1B, 0x1B, 0x1B}; //Padlock Closed
+
+const char udc_LAR[] = {0x07, 0x03, 0x05, 0x04, 0x04, 0x04, 0x04}; // Left Arrow
+const char udc_RAR[] = {0x1C, 0x18, 0x14, 0x04, 0x04, 0x04, 0x04}; // Right Arrow
+#endif
CU209SCPB Vacuum Fluorescent Display (VFD) module (1 Line, 20 Chars), Serial interface.