<root>
<document scada='0' projtype='1' schema='103' license='1,FREE_VERSION,TCW03R' title='Embedded Project' description='' fcversion='720898' target='AVR.ATMEGA.ATMEGA328P' >
	<config data='!0,ff!8,ff!10,ff%0,3f%6,1%7,1' clkspd='8000000' simspd='0' usewdt='0' constif='0' Use3V3='0' />
	<plugins >
		<dll_models enabled='1' />
	</plugins>
	<supplement use='0' head='' body='' />
	<debug />
	<traces />
	<ghost >
		<FK2 >
			<data name='FK2D0' port='4294967295' pin='4294967295' />
			<data name='FK2D1' port='4294967295' pin='4294967295' />
			<data name='FK2D2' port='4294967295' pin='4294967295' />
			<data name='FK2D3' port='4294967295' pin='4294967295' />
			<data name='FK2D4' port='4294967295' pin='4294967295' />
			<data name='FK2D5' port='4294967295' pin='4294967295' />
			<data name='FK2D6' port='4294967295' pin='4294967295' />
			<data name='FK2D7' port='4294967295' pin='4294967295' />
			<data name='FK2D8' port='4294967295' pin='4294967295' />
			<data name='FK2D9' port='4294967295' pin='4294967295' />
			<data name='FK2D10' port='4294967295' pin='4294967295' />
			<data name='FK2D11' port='4294967295' pin='4294967295' />
			<data name='FK2D12' port='4294967295' pin='4294967295' />
			<data name='FK2D13' port='4294967295' pin='4294967295' />
			<data name='FK2D14' port='4294967295' pin='4294967295' />
			<data name='FK2D15' port='4294967295' pin='4294967295' />
			<data name='FK2A0' port='4294967295' pin='4294967295' />
			<data name='FK2A1' port='4294967295' pin='4294967295' />
			<data name='FK2A2' port='4294967295' pin='4294967295' />
			<data name='FK2A3' port='4294967295' pin='4294967295' />
			<data name='FK2A4' port='4294967295' pin='4294967295' />
			<data name='FK2A5' port='4294967295' pin='4294967295' />
		</FK2>
		<ICD >
			<data name='AnalogPrescaleValue' value='19' />
			<data name='DigitalSampleRate' value='100000' />
			<data name='BreakpointCount' value='8' />
			<data name='CallStackDepthCount' value='8' />
			<data name='ClockPort' value='1' />
			<data name='ClockPin' value='6' />
			<data name='DataPort' value='1' />
			<data name='DataPin' value='7' />
			<data name='UseDefaultPins' value='1' />
			<data name='WrapEnabled' value='1' />
			<data name='CommsDelayOverridden' value='0' />
			<data name='CommsDelay' value='21' />
			<data name='CalculatedCommsDelay' value='21' />
			<data name='AnalogEB2PrescaleValue' value='2' />
			<data name='DigitalEB2SampleRate' value='100000' />
		</ICD>
		<pins >
			<digital A='0' B='0' C='0' D='0' E='0' F='0' G='0' H='0' I='0' J='0' K='0' L='0' M='0' N='0' O='0' P='0' Q='0' R='0' S='0' T='0' U='0' V='0' W='0' X='0' Y='0' Z='0' />
			<analog A='0' B='0' C='0' D='0' E='0' F='0' G='0' H='0' I='0' J='0' K='0' L='0' M='0' N='0' O='0' P='0' Q='0' R='0' S='0' T='0' U='0' V='0' W='0' X='0' Y='0' Z='0' />
		</pins>
	</ghost>
	<components >
		<settings autoimg='0' center='1' unitscale='0' fixedscale='0' fixedx='25' fixedy='25' fixedz='25' headcode='0' />
		<definition guid='a44d3e20-476a-44e1-b963-9f841862533c' vstate='40' vmin='0' vmaj='1' srcleaf='' visiblename='' description='' category='' category2='' category3='' bIs2dOnly='0' bIs3dOnly='0' bIsWysiwyg='0' catenable='1' author='' manuname='' manucode='' sysinfo='0' keywords='' dynamic='1' scadaCompatible='0' embeddedCompatible='1' showmacros='1' iconpath='' />
		<component class_type='root' codename='ComponentRoot' panelId='-1' x='0' y='0' z='0' xsz='1' ysz='1' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='0' poslock='0' ancTop='0' ancBottom='0' ancLeft='0' ancRight='0' ancMinX='0' ancMinY='0' comp2dType='0' >
			<resources />
			<properties />
			<values />
			<events />
			<apis />
			<variables >
				<variable public='0' >
					<def class_type='variable' name='false' type='b1' description='' isconst='1' isHidden='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='true' type='b1' description='' isconst='1' isHidden='0' isinit='1' usrinit='1' setinit='1' />
				</variable>
			</variables>
			<macros >
				<macro >
					<flowline name='Main' description='' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<command class_type='native' title='Code' ccode='// Enter C code below this comment

//************************************************************************************
//**  
//**  Source name:   E:\flowcode exp\Flowcode1.fcfx
//**  Title:         Embedded Project
//**  Description:   
//**  Device:        AVR.ATMEGA.ATMEGA328P
//**  
//**  Generated by:  Flowcode v11.0.2.17
//**  Date:          Wednesday, September 23, 2026 09:29:35
//**  Users:         1
//**  Registered to: 18913347650 (FREE_VERSION)
//**  Licence key: TCW03R
//**  
//**  
//**     NOT FOR COMMERCIAL USE
//**  
//**  https://www.flowcode.co.uk
//**  
//************************************************************************************


#define MX_AVR

#define MX_CAL_AVR

#define MX_CLK_SPEED 8000000

#define FCP_NULL Unconnected_Port

#define MX_UART_ID
#define MX_UART_UCSRC

#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
#include &lt;math.h&gt;
#include &lt;avr\io.h&gt;
#include &lt;avr\interrupt.h&gt;
#include &lt;avr\eeprom.h&gt;
#include &lt;avr\wdt.h&gt;

//Configuration Start
//Configuration End

/*========================================================================*\
   Use :Include the type definitions
\*========================================================================*/
#include &quot;C:\ProgramData\MatrixTSL\FlowcodeV11\CAL\internals.c&quot;



MX_UINT32 FCLV_LOOP1;
MX_UINT32 FCLV_LOOP2;
MX_UINT32 FCLV_LOOP3;

MX_UINT16 FCD_00fb2_WidthData__GetLUTCount();
MX_UINT16 FCD_00fb1_ASCIIData__GetLUTCount();
MX_UINT32 FCD_09e51_gLCD_Font1__SumWidths(MX_UINT8 FCL_CHARACTER);
MX_UINT8 FCD_09e51_gLCD_Font1__ReadWidth(MX_UINT8 FCL_CHARACTER);
MX_UINT8 FCD_09e51_gLCD_Font1__ReadFontStat(MX_UINT8 FCL_INDEX);
MX_UINT8 FCD_09e51_gLCD_Font1__ReadASCIILUT(MX_UINT8 FCL_CHARACTER, MX_UINT16 FCL_BYTEINDEX);

/*========================================================================*\
   Use :Base_GLCD1
       :Macro function declarations
\*========================================================================*/

/*=----------------------------------------------------------------------=*\
   Use :Base_GLCD1
       :Supplementary defines
\*=----------------------------------------------------------------------=*/
#define ReadFontWidth(FONT, CHAR) FCD_0ba71_Base_GLCD1__ReadFontWidth(FONT, CHAR)
#define ReadFontStat(FONT, IDX) FCD_0ba71_Base_GLCD1__ReadFontStat(FONT, IDX)


MX_UINT32 FCD_0ba71_Base_GLCD1__Prv_SumWidths(MX_UINT8 FCL_CHARACTER);
MX_UINT8 FCD_0ba71_Base_GLCD1__ReadFontWidth(MX_UINT8 FCL_FONT, MX_UINT8 FCL_CHARACTER);
void FCD_0ba71_Base_GLCD1__Prv_ReadFontFileHeader(MX_UINT8 FCL_FONT);
MX_UINT8 FCD_0ba71_Base_GLCD1__ReadFontStat(MX_UINT8 FCL_FONT, MX_UINT8 FCL_INDEX);
void FCD_0ba71_Base_GLCD1__SetExternalFont(MX_UINT8 FCL_FONT, MX_CHAR *PFCL_FILENAME, MX_UINT8 FCL_CHARACTERSPACING, MX_UINT8 FCL_SPACEWIDTH);
MX_UINT8 FCD_0ba71_Base_GLCD1__ReadFontByte(MX_UINT8 FCL_FONT, MX_UINT8 FCL_CHARACTER, MX_UINT16 FCL_BYTEINDEX);
void FCD_04071_LCD__Clear();
void FCD_04071_LCD__PrintString(MX_CHAR *FCL_TEXT, MX_UINT16 FCLsz_TEXT);
void FCD_04071_LCD__PrintAscii(MX_UINT8 FCL_CHARACTER);
void FCD_04071_LCD__PrintNumber(MX_SINT16 FCL_NUMBER);
void FCD_04071_LCD__RAMWrite(MX_UINT8 FCL_INDEX, MX_UINT8 FCL_D0, MX_UINT8 FCL_D1, MX_UINT8 FCL_D2, MX_UINT8 FCL_D3, MX_UINT8 FCL_D4, MX_UINT8 FCL_D5, MX_UINT8 FCL_D6, MX_UINT8 FCL_D7);
void FCD_04071_LCD__ClearLine(MX_UINT8 FCL_LINE);
void FCD_04071_LCD__Cursor(MX_UINT8 FCL_X, MX_UINT8 FCL_Y);
void FCD_04071_LCD__Command(MX_UINT8 FCL_INSTRUCTION);
void FCD_04071_LCD__PrintFormattedNumber(MX_UINT32 FCL_NUMBER, MX_BOOL FCL_FORMAT);
void FCD_04071_LCD__ScrollDisplay(MX_UINT8 FCL_POSITION, MX_UINT8 FCL_DIRECTION);
void FCD_04071_LCD__RawSend(MX_UINT8 FCL_DATA, MX_BOOL FCL_TYPE);
void FCD_04071_LCD__PrintFloat(MX_FLOAT FCL_NUMBER, MX_UINT8 FCL_DECIMALPLACES);
void FCD_04071_LCD__RemapCharacter(MX_UINT8 FCL_REMAPIDX, MX_UINT8 FCL_SEARCHCHARACTER, MX_UINT8 FCL_REPLACEMENTCHARACTER);
void FCD_04071_LCD__Start();
void FCD_0f9e1_lcd_16x2__Clear();
void FCD_0f9e1_lcd_16x2__PrintString(MX_CHAR *FCL_TEXT, MX_UINT16 FCLsz_TEXT);
void FCD_0f9e1_lcd_16x2__PrintAscii(MX_UINT8 FCL_CHARACTER);
void FCD_0f9e1_lcd_16x2__PrintNumber(MX_SINT16 FCL_NUMBER);
void FCD_0f9e1_lcd_16x2__RAMWrite(MX_UINT8 FCL_INDEX, MX_UINT8 FCL_D0, MX_UINT8 FCL_D1, MX_UINT8 FCL_D2, MX_UINT8 FCL_D3, MX_UINT8 FCL_D4, MX_UINT8 FCL_D5, MX_UINT8 FCL_D6, MX_UINT8 FCL_D7);
void FCD_0f9e1_lcd_16x2__ClearLine(MX_UINT8 FCL_LINE);
void FCD_0f9e1_lcd_16x2__Cursor(MX_UINT8 FCL_X, MX_UINT8 FCL_Y);
void FCD_0f9e1_lcd_16x2__Command(MX_UINT8 FCL_INSTRUCTION);
void FCD_0f9e1_lcd_16x2__PrintFormattedNumber(MX_UINT32 FCL_NUMBER, MX_BOOL FCL_FORMAT);
void FCD_0f9e1_lcd_16x2__ScrollDisplay(MX_UINT8 FCL_POSITION, MX_UINT8 FCL_DIRECTION);
void FCD_0f9e1_lcd_16x2__RawSend(MX_UINT8 FCL_DATA, MX_BOOL FCL_TYPE);
void FCD_0f9e1_lcd_16x2__PrintFloat(MX_FLOAT FCL_NUMBER, MX_UINT8 FCL_DECIMALPLACES);
void FCD_0f9e1_lcd_16x2__RemapCharacter(MX_UINT8 FCL_REMAPIDX, MX_UINT8 FCL_SEARCHCHARACTER, MX_UINT8 FCL_REPLACEMENTCHARACTER);
void FCD_0f9e1_lcd_16x2__Start();

/*========================================================================*\
   Use :Include the chip adaption layer
\*========================================================================*/
#include &quot;C:\ProgramData\MatrixTSL\FlowcodeV11\CAL\includes.c&quot;


/*========================================================================*\
   Use :WidthData
       :GUID: dfb4d07a-3d70-45d5-83ef-07e3c95d86ab
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV11\Components\lut.fcpx
       :Version: 21.0 (0x100828)
       :Timestamp: 05\05\2026
       :Variable declarations
       :Macro implementations
\*========================================================================*/
#define FCVsz_00fb2_WidthData__FLOATFIXEDLIST 200000
#define FCVsz_00fb2_WidthData__INTFIXEDLIST 95
#define FCD_00fb2_WidthData__INTFIXEDLIST(ix) 0

/*=----------------------------------------------------------------------=*\
   Use :Gets the number of individual data entries stored in the LUT.
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_00fb2_WidthData__GetLUTCount()
{
  //Local variable definitions
  MX_UINT16 FCR_RETVAL;


  #if (1)
    FCR_RETVAL = 95;

  #else
  //Code has been optimised out by the pre-processor
  #endif

  return (FCR_RETVAL);

}


/*========================================================================*\
   Use :ASCIIData
       :GUID: dfb4d07a-3d70-45d5-83ef-07e3c95d86ab
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV11\Components\lut.fcpx
       :Version: 21.0 (0x100828)
       :Timestamp: 05\05\2026
       :Variable declarations
       :Macro implementations
\*========================================================================*/
#define FCVsz_00fb1_ASCIIData__FLOATFIXEDLIST 200000
#define FCVsz_00fb1_ASCIIData__INTFIXEDLIST 475
#define FCD_00fb1_ASCIIData__INTFIXEDLIST(ix) pgm_read_byte(&amp;(FCD_00fb1_ASCIIData__INTFIXEDLIST_LUT[ix]))
ROMARRAY_(MX_UINT8) FCD_00fb1_ASCIIData__INTFIXEDLIST_LUT ROMARRAY_E =
{
0x00,0x06,0x5F,0x06,0x00,0x07,0x03,0x00,0x07,0x03,0x24,0x7E,0x24,0x7E,0x24,0x24,0x2B,0x6A,0x12,0x00,0x63,0x13,0x08,0x64,0x63,0x36,0x49,0x56,0x20,0x50,0x00,0x07,0x03,0x00,0x00,0x00,0x3E,0x41,0x00,0x00,0x00,0x41,0x3E,0x00,0x00,0x08,0x3E,0x1C,0x3E,0x08,0x08,0x08,0x3E,0x08,0x08,0x00,0xE0,0x60,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x60,0x60,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x3E,0x51,0x49,0x45,0x3E,0x00,0x42,0x7F,0x40,0x00,0x62,0x51,0x49,0x49,0x46,0x22,0x49,0x49,0x49,0x36,0x18,0x14,0x12,0x7F,0x10,0x27,0x45,0x45,0x45,0x39,0x3C,0x4A,0x49,0x49,0x30,0x01,0x71,0x09,0x05,0x03,0x36,0x49,0x49,0x49,0x36,0x06,0x49,0x49,0x29,0x1E,0x00,0x6C,0x6C,0x00,0x00,0x00,0xEC,0x6C,0x00,0x00,0x08,0x14,0x22,0x41,0x00,0x24,0x24,0x24,0x24,0x24,0x00,0x41,0x22,0x14,0x08,0x02,0x01,0x59,0x09,0x06,0x3E,0x41,0x5D,0x55,0x1E,0x7E,0x09,0x09,0x09,0x7E,0x7F,0x49,0x49,0x49,0x36,0x3E,0x41,0x41,0x41,0x22,0x7F,0x41,0x41,0x41,0x3E,0x7F,0x49,0x49,0x49,0x41,0x7F,0x09,0x09,0x09,0x01,0x3E,0x41,0x49,0x49,0x7A,0x7F,0x08,0x08,0x08,0x7F,0x00,0x41,0x7F,0x41,0x00,0x30,0x40,0x40,0x40,0x3F,0x7F,0x08,0x14,0x22,0x41,0x7F,0x40,0x40,0x40,0x40,0x7F,0x02,0x04,0x02,0x7F,0x7F,0x02,0x04,0x08,0x7F,0x3E,0x41,0x41,0x41,0x3E,0x7F,0x09,0x09,0x09,0x06,0x3E,0x41,0x51,0x21,0x5E,0x7F,0x09,0x09,0x19,0x66,0x26,0x49,0x49,0x49,0x32,0x01,0x01,0x7F,0x01,0x01,0x3F,0x40,0x40,0x40,0x3F,0x1F,0x20,0x40,0x20,0x1F,0x3F,0x40,0x3C,0x40,0x3F,0x63,0x14,0x08,0x14,0x63,0x07,0x08,0x70,0x08,0x07,0x71,0x49,0x45,0x43,0x00,0x00,0x7F,0x41,0x41,0x00,0x02,0x04,0x08,0x10,0x20,0x00,0x41,0x41,0x7F,0x00,0x04,0x02,0x01,0x02,0x04,0x80,0x80,0x80,0x80,0x80,0x00,0x03,0x07,0x00,0x00,0x20,0x54,0x54,0x54,0x78,0x7F,0x44,0x44,0x44,0x38,0x38,0x44,0x44,0x44,0x28,0x38,0x44,0x44,0x44,0x7F,0x38,0x54,0x54,0x54,0x18,0x08,0x7E,0x09,0x09,0x00,0x18,0xA4,0xA4,0xA4,0x7C,0x7F,0x04,0x04,0x78,0x00,0x00,0x00,0x7D,0x00,0x00,0x40,0x80,0x84,0x7D,0x00,0x7F,0x10,0x28,0x44,0x00,0x00,0x00,0x7F,0x40,0x00,0x7C,0x04,0x18,0x04,0x78,0x7C,0x04,0x04,0x78,0x00,0x38,0x44,0x44,0x44,0x38,0xFC,0x44,0x44,0x44,0x38,0x38,0x44,0x44,0x44,0xFC,0x44,0x78,0x44,0x04,0x08,0x08,0x54,0x54,0x54,0x20,0x04,0x3E,0x44,0x24,0x00,0x3C,0x40,0x20,0x7C,0x00,0x1C,0x20,0x40,0x20,0x1C,0x3C,0x60,0x30,0x60,0x3C,0x6C,0x10,0x10,0x6C,0x00,0x9C,0xA0,0x60,0x3C,0x00,0x64,0x54,0x54,0x4C,0x00,0x08,0x3E,0x41,0x41,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x41,0x41,0x3E,0x08,0x02,0x01,0x02,0x01,0x00,0x06,0x09,0x09,0x06,0x00
};

/*=----------------------------------------------------------------------=*\
   Use :Gets the number of individual data entries stored in the LUT.
       :
       :Returns : MX_UINT16
\*=----------------------------------------------------------------------=*/
MX_UINT16 FCD_00fb1_ASCIIData__GetLUTCount()
{
  //Local variable definitions
  MX_UINT16 FCR_RETVAL;


  #if (1)
    FCR_RETVAL = 475;

  #else
  //Code has been optimised out by the pre-processor
  #endif

  return (FCR_RETVAL);

}


/*========================================================================*\
   Use :gLCD_Font1
       :GUID: 1b08885c-807e-4631-930e-a4fef06159dc
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV11\Components\gLCD_Font.fcpx
       :Version: 37.0 (0x1400028)
       :Timestamp: 12\09\2025
       :Variable declarations
       :Macro implementations
\*========================================================================*/
MX_GLOBAL MX_UINT8 FCV_09e51_gLCD_Font1__OLDCHAR = (0x0);
MX_GLOBAL MX_UINT32 FCV_09e51_gLCD_Font1__OLDPOSITION = (0x0);

/*=----------------------------------------------------------------------=*\
   Use :Adds up all the pixels widths before the selected character to get to the start of the pixel data
       :
       :Parameters for macro SumWidths:
       :  Character : MX_UINT8
       :
       :Returns : MX_UINT32
\*=----------------------------------------------------------------------=*/
MX_UINT32 FCD_09e51_gLCD_Font1__SumWidths(MX_UINT8 FCL_CHARACTER)
{
  //Local variable definitions
  MX_UINT8 FCL_WIDTH;
  MX_UINT32 FCR_RETVAL;


  FCR_RETVAL = 0;

  #if (1)
    #if (0) // 1 == 0
    //Code has been optimised out by the pre-processor
    // #else
    #endif

  // #else
  //Code has been optimised out by the pre-processor
  #endif

  return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Gets the width of the ASCII character font data
       :
       :Parameters for macro ReadWidth:
       :  Character : ASCII position so A = &apos;A&apos;
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_09e51_gLCD_Font1__ReadWidth(MX_UINT8 FCL_CHARACTER)
{
  //Local variable definitions
  MX_UINT16 FCL_POSITION;
  MX_UINT8 FCL_PWIDTH;
  MX_UINT8 FCR_RETVAL;


  #if (1)
    #if (1) // 127 &lt; 255
#if 0 // Disabled code
      if ((FCL_CHARACTER == 167) || (FCL_CHARACTER == 248))
      {      

        FCL_CHARACTER = 127;

      // } else {

      }

#endif // Disabled code

      if (FCL_CHARACTER &gt; 127)
      {      

        FCL_CHARACTER = 127;

      // } else {

      }

    // #else
    //Code has been optimised out by the pre-processor
    #endif

    #if (0) // 0 &amp;&amp; (FCL_CHARACTER &gt;= &apos;a&apos;)
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    #if (1)
      if (FCL_CHARACTER == 32)
      {      

        FCR_RETVAL = 005;

      } else {

        FCR_RETVAL = 5;

      }

    #else
    //Code has been optimised out by the pre-processor
    #endif

  #else
  //Code has been optimised out by the pre-processor
  #endif

  return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Collects a stat about the selected font
       :
       :Parameters for macro ReadFontStat:
       :  Index : 0=SpaceColumns, 1=CharacterHeight
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_09e51_gLCD_Font1__ReadFontStat(MX_UINT8 FCL_INDEX)
{
  //Local variable definitions
  MX_UINT8 FCR_RETVAL;


  if (FCL_INDEX == 1)
  {  

    FCR_RETVAL = 8;

  } else {

    FCR_RETVAL = 000;

  }

  return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Gets a single pixel column byte from the selected ASCII character font data.
       :
       :Parameters for macro ReadASCIILUT:
       :  Character : ASCII position so A = &apos;A&apos;
       :  ByteIndex : Range: 0 to ((PixelWidth - 1) * BytesPerColumn)
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_09e51_gLCD_Font1__ReadASCIILUT(MX_UINT8 FCL_CHARACTER, MX_UINT16 FCL_BYTEINDEX)
{
  //Local variable definitions
  MX_UINT32 FCL_POSITION;
  MX_UINT8 FCR_RETVAL;


  #if (1)
    #if (1) // 127 &lt; 255
#if 0 // Disabled code
      if ((FCL_CHARACTER == 167) || (FCL_CHARACTER == 248))
      {      

        FCL_CHARACTER = 127;

      // } else {

      }

#endif // Disabled code

      if (FCL_CHARACTER &gt; 127)
      {      

        FCL_CHARACTER = 127;

      // } else {

      }

    // #else
    //Code has been optimised out by the pre-processor
    #endif

    #if (0) // 0 &amp;&amp; (FCL_CHARACTER &gt;= &apos;a&apos;)
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    if ((FCL_CHARACTER &lt; 33) || (FCL_CHARACTER &gt; (33 + 95)))
    {    

      if (FCL_CHARACTER == 32)
      {      

        FCR_RETVAL = 0;

      } else {

        //Comment:
        //Out of range

        FCR_RETVAL = 0xAA;

      }

    } else {

      FCL_CHARACTER = FCL_CHARACTER - 33;

      #if (1) // 1 == 1
        if (FCL_CHARACTER == FCV_09e51_gLCD_Font1__OLDCHAR)
        {        

          FCL_POSITION = FCV_09e51_gLCD_Font1__OLDPOSITION;

        } else {

          FCL_POSITION = FCL_CHARACTER * 5 * 1;

          FCV_09e51_gLCD_Font1__OLDPOSITION = FCL_POSITION;
          FCV_09e51_gLCD_Font1__OLDCHAR = FCL_CHARACTER;

        }

      #else
      //Code has been optimised out by the pre-processor
      #endif

      FCL_POSITION = FCL_POSITION + FCL_BYTEINDEX;

      FCR_RETVAL = FCD_00fb1_ASCIIData__INTFIXEDLIST(FCL_POSITION);

    }

  #else
  //Code has been optimised out by the pre-processor
  #endif

  return (FCR_RETVAL);

}


/*========================================================================*\
   Use :Base_GLCD1
       :GUID: 4384cba9-0bea-4359-8c5b-dcd046aa7778
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV11\Components\Base_GLCD.fcpx
       :Version: 56.0 (0x2300028)
       :Timestamp: 19\03\2026
       :Variable declarations
       :Macro implementations
\*========================================================================*/
#define FCVsz_0ba71_Base_GLCD1__FONTFILENAME2 13
#define FCVsz_0ba71_Base_GLCD1__FONTFILENAME1 13
#define FCVsz_0ba71_Base_GLCD1__SPACEWIDTH 1
#define FCVsz_0ba71_Base_GLCD1__FONTHEADER 16
#define FCVsz_0ba71_Base_GLCD1__FONTFILENAME8 13
#define FCVsz_0ba71_Base_GLCD1__FONTFILENAME7 13
#define FCVsz_0ba71_Base_GLCD1__FONTFILENAME6 13
#define FCVsz_0ba71_Base_GLCD1__FONTFILENAME5 13
#define FCVsz_0ba71_Base_GLCD1__FONTFILENAME4 13
#define FCVsz_0ba71_Base_GLCD1__CHARSPACING 1
#define FCVsz_0ba71_Base_GLCD1__FONTFILENAME3 13

/*=----------------------------------------------------------------------=*\
   Use :Parameters for macro Prv_SumWidths:
       :  Character : MX_UINT8
       :
       :Returns : MX_UINT32
\*=----------------------------------------------------------------------=*/
MX_UINT32 FCD_0ba71_Base_GLCD1__Prv_SumWidths(MX_UINT8 FCL_CHARACTER)
{
  //Local variable definitions
  MX_UINT8 FCL_WIDTH = (0x0);
  MX_UINT32 FCR_RETVAL;


  FCR_RETVAL = 0;

  #if (0)
  //Code has been optimised out by the pre-processor
  // #else
  #endif

  return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Reads the number of pixel columns used in the selected font
       :
       :Parameters for macro ReadFontWidth:
       :  Font : Font selection range: 0 to (NumFonts - 1)
       :  Character : ASCII character to get the pixel width e.g. &apos;A&apos; or 65
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_0ba71_Base_GLCD1__ReadFontWidth(MX_UINT8 FCL_FONT, MX_UINT8 FCL_CHARACTER)
{
  //Local variable definitions
  MX_UINT8 FCR_RETVAL;


  FCR_RETVAL = 0;

  if (FCL_FONT &gt;= 1)
  {  

    FCL_FONT = 0;

  // } else {

  }

  #if (0)
  //Code has been optimised out by the pre-processor
  #else
    if (FCL_FONT == 0)
    {    

      FCR_RETVAL = FCD_09e51_gLCD_Font1__ReadWidth(FCL_CHARACTER);

    // } else {

    }

    #if (0) // 1 &gt; 1
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    #if (0) // 1 &gt; 2
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    #if (0) // 1 &gt; 3
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    #if (0) // 1 &gt; 4
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    #if (0) // 1 &gt; 5
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    #if (0) // 1 &gt; 6
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    #if (0) // 1 &gt; 7
    //Code has been optimised out by the pre-processor
    // #else
    #endif

  #endif

  #if (0)
  //Code has been optimised out by the pre-processor
  // #else
  #endif

  return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Parameters for macro Prv_ReadFontFileHeader:
       :  Font : MX_UINT8
\*=----------------------------------------------------------------------=*/
void FCD_0ba71_Base_GLCD1__Prv_ReadFontFileHeader(MX_UINT8 FCL_FONT)
{
  //Local variable definitions
  MX_UINT8 FCL_RETVAL = (0x0);
  MX_UINT8 FCL_IDX = (0x0);
  #define FCLsz_TEST 20
  MX_CHAR FCL_TEST[FCLsz_TEST] = &quot;&quot;;


  #if (0)
  //Code has been optimised out by the pre-processor
  // #else
  #endif

  //Local variable definitions
  #undef FCLsz_TEST
}

/*=----------------------------------------------------------------------=*\
   Use :Gets a stat from the selected embedded ASCII font data.
       :
       :Parameters for macro ReadFontStat:
       :  Font : Font selection range: 0 to (NumFonts - 1)
       :  Index : 0=SpaceWidth, 1=PixelHeight
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_0ba71_Base_GLCD1__ReadFontStat(MX_UINT8 FCL_FONT, MX_UINT8 FCL_INDEX)
{
  //Local variable definitions
  MX_UINT16 FCL_POSITION;
  MX_UINT8 FCR_RETVAL;


  FCR_RETVAL = 0;

  if (FCL_FONT &gt;= 1)
  {  

    FCL_FONT = 0;

  // } else {

  }

  #if (0)
  //Code has been optimised out by the pre-processor
  #else
    //Comment:
    //Character Spacing comes from font component properties
    //specified by the user and independent of the font file.

    if (FCL_FONT == 0)
    {    

      FCR_RETVAL = FCD_09e51_gLCD_Font1__ReadFontStat(FCL_INDEX);

    // } else {

    }

    #if (0) // 1 &gt; 1
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    #if (0) // 1 &gt; 2
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    #if (0) // 1 &gt; 3
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    #if (0) // 1 &gt; 4
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    #if (0) // 1 &gt; 5
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    #if (0) // 1 &gt; 6
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    #if (0) // 1 &gt; 7
    //Code has been optimised out by the pre-processor
    // #else
    #endif

  #endif

  #if (0)
  //Code has been optimised out by the pre-processor
  // #else
  #endif

  return (FCR_RETVAL);

}

/*=----------------------------------------------------------------------=*\
   Use :Allows one of the default external font files to be switched out for a different font file.
       :
       :Parameters for macro SetExternalFont:
       :  Font : Range: 0 to (FontCount - 1)
       :  Filename[20] : New font filename
       :  CharacterSpacing : Number of pixel columns to use between each character
       :  SpaceWidth : Number of pixel columns to use for a space character
\*=----------------------------------------------------------------------=*/
void FCD_0ba71_Base_GLCD1__SetExternalFont(MX_UINT8 FCL_FONT, MX_CHAR *PFCL_FILENAME, MX_UINT8 FCL_CHARACTERSPACING, MX_UINT8 FCL_SPACEWIDTH)
{
  #define FCLsz_FILENAME 20
  MX_CHAR FCL_FILENAME[FCLsz_FILENAME];
  FCI_CONCATENATE(PFCL_FILENAME,FCLsz_FILENAME,&quot;&quot;,0,FCL_FILENAME,FCLsz_FILENAME);


  #if (0)
  //Code has been optimised out by the pre-processor
  // #else
  #endif

  //Local variable definitions
  #undef FCLsz_FILENAME
}

/*=----------------------------------------------------------------------=*\
   Use :Gets a byte from the selected embedded ASCII font data.
       :
       :Parameters for macro ReadFontByte:
       :  Font : Font selection range: 0 to (NumFonts - 1)
       :  Character : ASCII character for example &apos;A&apos; or 65
       :  ByteIndex : Font column Ranging 0-4
       :
       :Returns : MX_UINT8
\*=----------------------------------------------------------------------=*/
MX_UINT8 FCD_0ba71_Base_GLCD1__ReadFontByte(MX_UINT8 FCL_FONT, MX_UINT8 FCL_CHARACTER, MX_UINT16 FCL_BYTEINDEX)
{
  //Local variable definitions
  MX_UINT32 FCL_POSITION;
  MX_UINT8 FCR_RETVAL;


  FCR_RETVAL = 0;

  if (FCL_FONT &gt;= 1)
  {  

    FCL_FONT = 0;

  // } else {

  }

  #if (0) // (0) &amp;&amp; (FCL_CHARACTER != &apos; &apos;)
  //Code has been optimised out by the pre-processor
  #else
    if (FCL_FONT == 0)
    {    

      FCR_RETVAL = FCD_09e51_gLCD_Font1__ReadASCIILUT(FCL_CHARACTER, FCL_BYTEINDEX);

    // } else {

    }

    #if (0) // 1 &gt; 1
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    #if (0) // 1 &gt; 2
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    #if (0) // 1 &gt; 3
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    #if (0) // 1 &gt; 4
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    #if (0) // 1 &gt; 5
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    #if (0) // 1 &gt; 6
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    #if (0) // 1 &gt; 7
    //Code has been optimised out by the pre-processor
    // #else
    #endif

  #endif

  return (FCR_RETVAL);

}


/*========================================================================*\
   Use :LCD
       :GUID: 0953aac0-9c23-4c2f-9843-88954a4191ea
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV11\Components\LCD.fcpx
       :Version: 6.0 (0x200528)
       :Timestamp: 10\10\2023
       :Variable declarations
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Clears the entire contents of the display.
\*=----------------------------------------------------------------------=*/
void FCD_04071_LCD__Clear()
{

  // ctrl_lcd::Clear()

  // ::Component.Property.SetValue(this, &quot;CursorPosX&quot;, 0)

  // ::Component.Property.SetValue(this, &quot;CursorPosY&quot;, 0)

  FCD_04071_LCD__RawSend(0x01, 0);

  FCI_DELAYBYTE_MS(2);

  FCD_04071_LCD__RawSend(0x02, 0);

  FCI_DELAYBYTE_MS(2);

}

/*=----------------------------------------------------------------------=*\
   Use :Breaks down a string of text and sends it to the LCD via the private RawSend(byte, mask) macro
       :
       :Parameters for macro PrintString:
       :  Text[20] : Enter the text or variable to print to the LCD
\*=----------------------------------------------------------------------=*/
void FCD_04071_LCD__PrintString(MX_CHAR *FCL_TEXT, MX_UINT16 FCLsz_TEXT)
{
  //Local variable definitions
  MX_UINT8 FCL_IDX = (0x0);
  MX_UINT8 FCL_COUNT;


  FCL_COUNT = FCI_GETLENGTH(FCL_TEXT, FCLsz_TEXT);

  while (FCL_IDX &lt; FCL_COUNT)
  {
    #if (0) // 0 &gt; 0
    //Code has been optimised out by the pre-processor
    #else
      // ctrl_lcd::AddText(CursorPosX, CursorPosY, .Text)

      FCD_04071_LCD__RawSend(FCL_TEXT[FCL_IDX], 0x10);

    #endif

    FCL_IDX = FCL_IDX + 1;

  }

  // ::Component.Property.SetValue(this, &quot;CursorPosX&quot;, CursorPosX + LENGTH$ (.Text))

}

/*=----------------------------------------------------------------------=*\
   Use :Takes the ascii value for a character and prints the character
       :
       :Parameters for macro PrintAscii:
       :  character : Holds an ascii value.
\*=----------------------------------------------------------------------=*/
void FCD_04071_LCD__PrintAscii(MX_UINT8 FCL_CHARACTER)
{

  FCD_04071_LCD__RawSend(FCL_CHARACTER, 0x10);

  // ctrl_lcd::AddChar(CursorPosX, CursorPosY, .character)

  // ::Component.Property.SetValue(this, &quot;CursorPosX&quot;, CursorPosX + 1)

}

/*=----------------------------------------------------------------------=*\
   Use :Based on v5 macro, will allow you to print a number. This is limited to a signed-INT, -32768 to 32767
       :
       :Parameters for macro PrintNumber:
       :  Number : Enter the number or variable to print to the LCD
\*=----------------------------------------------------------------------=*/
void FCD_04071_LCD__PrintNumber(MX_SINT16 FCL_NUMBER)
{
  //Local variable definitions
  #define FCLsz_S 10
  MX_CHAR FCL_S[FCLsz_S];


  FCI_TOSTRING(FCL_NUMBER, FCL_S,10);

  FCD_04071_LCD__PrintString(FCL_S, FCLsz_S);

  //Local variable definitions
  #undef FCLsz_S
}

/*=----------------------------------------------------------------------=*\
   Use :Modifies the internal memory of the LCD to allow for up to 8 customised characters to be created and stored in the device memory
       :
       :Parameters for macro RAMWrite:
       :  Index : Values 0 to 7
       :  d0 : MX_UINT8
       :  d1 : MX_UINT8
       :  d2 : MX_UINT8
       :  d3 : MX_UINT8
       :  d4 : MX_UINT8
       :  d5 : MX_UINT8
       :  d6 : MX_UINT8
       :  d7 : MX_UINT8
\*=----------------------------------------------------------------------=*/
void FCD_04071_LCD__RAMWrite(MX_UINT8 FCL_INDEX, MX_UINT8 FCL_D0, MX_UINT8 FCL_D1, MX_UINT8 FCL_D2, MX_UINT8 FCL_D3, MX_UINT8 FCL_D4, MX_UINT8 FCL_D5, MX_UINT8 FCL_D6, MX_UINT8 FCL_D7)
{

  FCD_04071_LCD__RawSend(64 + (FCL_INDEX &lt;&lt; 3), 0);

  FCI_DELAYBYTE_MS(2);

  FCD_04071_LCD__RawSend(FCL_D0, 0x10);

  FCD_04071_LCD__RawSend(FCL_D1, 0x10);

  FCD_04071_LCD__RawSend(FCL_D2, 0x10);

  FCD_04071_LCD__RawSend(FCL_D3, 0x10);

  FCD_04071_LCD__RawSend(FCL_D4, 0x10);

  FCD_04071_LCD__RawSend(FCL_D5, 0x10);

  FCD_04071_LCD__RawSend(FCL_D6, 0x10);

  FCD_04071_LCD__RawSend(FCL_D7, 0x10);

  FCD_04071_LCD__Clear();

}

/*=----------------------------------------------------------------------=*\
   Use :Clears a single line on the display and then moves the cursor to the start of the line to allow you to start populating the line with data.
       :
       :Parameters for macro ClearLine:
       :  Line : The line to clear, zero being the first (top) line of the display
\*=----------------------------------------------------------------------=*/
void FCD_04071_LCD__ClearLine(MX_UINT8 FCL_LINE)
{
  //Local variable definitions
  MX_UINT8 FCL_X;


  if (FCL_LINE &lt; 2)
  {  

    // ctrl_lcd::ClearLine(.Line)

    FCD_04071_LCD__Cursor(0, FCL_LINE);

    FCL_X = 0;

    while (FCL_X &lt; 16)
    {
      FCD_04071_LCD__RawSend(&apos; &apos;, 0x10);

      FCL_X = FCL_X + 1;

    }

    FCD_04071_LCD__Cursor(0, FCL_LINE);

  // } else {

  }

}

/*=----------------------------------------------------------------------=*\
   Use :Moves the cursor on the LCD Display
       :
       :Parameters for macro Cursor:
       :  x : Set the cursor position in the X plane, 0 is the left most cell
       :  y : Set the cursor position in the Y plane, 0 is the top most cell
\*=----------------------------------------------------------------------=*/
void FCD_04071_LCD__Cursor(MX_UINT8 FCL_X, MX_UINT8 FCL_Y)
{

  // ::Component.Property.SetValue(this, &quot;CursorPosX&quot;, .x)

  // ::Component.Property.SetValue(this, &quot;CursorPosY&quot;, .y)

  #if (0) // 2 == 1
  //Code has been optimised out by the pre-processor
  // #else
  #endif

  #if (1) // 2 == 2
    if (FCL_Y == 0)
    {    

      FCL_Y = 0x80;

    } else {

      FCL_Y = 0xC0;

    }

  // #else
  //Code has been optimised out by the pre-processor
  #endif

  #if (0) // 2 == 4
  //Code has been optimised out by the pre-processor
  // #else
  #endif

  FCD_04071_LCD__RawSend(FCL_Y + FCL_X, 0);

  FCI_DELAYBYTE_MS(2);

  //Comment:
  //EB2 LCDs have occasional problems here if cursor command isn&apos;t called twice

  FCD_04071_LCD__RawSend(FCL_Y + FCL_X, 0);

  FCI_DELAYBYTE_MS(2);

}

/*=----------------------------------------------------------------------=*\
   Use :Use this method/macro to send a specific command to the LCD. Refer to the Matrix Multimedia EB006 datasheet for a list of supported instructions. For Non-Matrix LCD&apos;s refer to the manufacturers datasheet.
       :
       :Parameters for macro Command:
       :  instruction : Send a defined command to the LCD Screen. See datasheet for supported commands.
\*=----------------------------------------------------------------------=*/
void FCD_04071_LCD__Command(MX_UINT8 FCL_INSTRUCTION)
{

  FCD_04071_LCD__RawSend(FCL_INSTRUCTION, 0);

  FCI_DELAYBYTE_MS(2);

}

/*=----------------------------------------------------------------------=*\
   Use :Will allow you to print a number up to 32-bits with signed or unsigned formatting.

       :Signed = -2147483648 to 2147483647

       :Unsigned = 0 to 4294967295
       :
       :Parameters for macro PrintFormattedNumber:
       :  Number : Enter the number or variable to print to the LCD
       :  Format : 0=Signed, 1=Unsigned
\*=----------------------------------------------------------------------=*/
void FCD_04071_LCD__PrintFormattedNumber(MX_UINT32 FCL_NUMBER, MX_BOOL FCL_FORMAT)
{
  //Local variable definitions
  #define FCLsz_S 15
  MX_CHAR FCL_S[FCLsz_S];


  if (FCL_FORMAT == 1)
  {  

    FCI_UTOS32(FCL_NUMBER, FCL_S,15);

  } else {

    FCI_ITOS32((MX_SINT32)(FCL_NUMBER), FCL_S,15);

  }

  FCD_04071_LCD__PrintString(FCL_S, FCLsz_S);

  //Local variable definitions
  #undef FCLsz_S
}

/*=----------------------------------------------------------------------=*\
   Use :Scrolls the display left or right by a number of given positions.
       :
       :Parameters for macro ScrollDisplay:
       :  Position : Holds the number of positions to shift the display
       :  Direction : 0 = left, 1 = right
\*=----------------------------------------------------------------------=*/
void FCD_04071_LCD__ScrollDisplay(MX_UINT8 FCL_POSITION, MX_UINT8 FCL_DIRECTION)
{
  //Local variable definitions
  MX_UINT8 FCL_CMD = (0x0);
  MX_UINT8 FCL_SCROLL;


  FCL_CMD = 0;

  if (FCL_DIRECTION == 0)
  {  

    FCL_CMD = 0x18;

    // .scroll=ctrl_lcd::GetScrollX()

    // ctrl_lcd::SetScrollX(.scroll + .Position)

  } else {

    FCL_CMD = 0x1C;

    // ctrl_lcd::SetScrollX(ctrl_lcd::GetScrollX() - .Position)

  }

  if (FCL_CMD != 0 &amp;&amp; FCL_POSITION != 0)
  {  

    while (FCL_POSITION != 0)
    {
      FCD_04071_LCD__RawSend(FCL_CMD, 0);

      FCL_POSITION = FCL_POSITION - 1;

    }

  // } else {

  }

}

/*=----------------------------------------------------------------------=*\
   Use :Sends data to the LCD display
       :
       :Parameters for macro RawSend:
       :  data : The data byte to send to the LCD
       :  type : A boolean to indicate command type: true to write data, false to write a command
\*=----------------------------------------------------------------------=*/
void FCD_04071_LCD__RawSend(MX_UINT8 FCL_DATA, MX_BOOL FCL_TYPE)
{
  //Local variable definitions
  MX_UINT8 FCL_NIBBLE;


  //Comment:
  //Output upper nibble of the byte

  #if (1) // 0 == 0
    SET_PORT_PIN(B, 0, 0);
    SET_PORT_PIN(B, 1, 0);
    SET_PORT_PIN(B, 2, 0);
    SET_PORT_PIN(B, 3, 0);
    SET_PORT_PIN(B, 4, 0);
    SET_PORT_PIN(B, 5, 0);

    #if (0)
    //Code has been optimised out by the pre-processor
    // #else
    #endif

    FCL_NIBBLE = (FCL_DATA &gt;&gt; 4);
    SET_PORT_PIN(B, 0, (FCL_NIBBLE &amp; 0x01));
    FCL_NIBBLE = FCL_NIBBLE &gt;&gt; 1;
    SET_PORT_PIN(B, 1, (FCL_NIBBLE &amp; 0x01));
    FCL_NIBBLE = FCL_NIBBLE &gt;&gt; 1;
    SET_PORT_PIN(B, 2, (FCL_NIBBLE &amp; 0x01));
    FCL_NIBBLE = FCL_NIBBLE &gt;&gt; 1;
    SET_PORT_PIN(B, 3, (FCL_NIBBLE &amp; 0x01));

  // #else
  //Code has been optimised out by the pre-processor
  #endif

  //Comment:
  //Output byte to pins

  #if (0) // 0 == 1
  //Code has been optimised out by the pre-processor
  // #else
  #endif

  //Comment:
  //Output byte to port

  #if (0) // 0 == 2
  //Code has been optimised out by the pre-processor
  // #else
  #endif

  if (FCL_TYPE)
  {  

    SET_PORT_PIN(B, 4, 1);

  // } else {

  }

  #if (0)
  //Code has been optimised out by the pre-processor
  // #else
  #endif

  FCI_DELAYBYTE_US(100);

  //Comment:
  //Set Enable high, pause then set low

  //to acknowledge the data has been 
  //submitted.

  SET_PORT_PIN(B, 5, 1);

  FCI_DELAYBYTE_US(100);

  SET_PORT_PIN(B, 5, 0);

  FCI_DELAYBYTE_US(100);

  #if (1) // 0 == 0
    SET_PORT_PIN(B, 0, 0);
    SET_PORT_PIN(B, 1, 0);
    SET_PORT_PIN(B, 2, 0);
    SET_PORT_PIN(B, 3, 0);
    SET_PORT_PIN(B, 4, 0);

    FCL_NIBBLE = (FCL_DATA &amp; 0xf);
    SET_PORT_PIN(B, 0, (FCL_NIBBLE &amp; 0x01));
    FCL_NIBBLE = FCL_NIBBLE &gt;&gt; 1;
    SET_PORT_PIN(B, 1, (FCL_NIBBLE &amp; 0x01));
    FCL_NIBBLE = FCL_NIBBLE &gt;&gt; 1;
    SET_PORT_PIN(B, 2, (FCL_NIBBLE &amp; 0x01));
    FCL_NIBBLE = FCL_NIBBLE &gt;&gt; 1;
    SET_PORT_PIN(B, 3, (FCL_NIBBLE &amp; 0x01));

    if (FCL_TYPE)
    {    

      SET_PORT_PIN(B, 4, 1);

    // } else {

    }

    FCI_DELAYBYTE_US(100);

    SET_PORT_PIN(B, 5, 1);

    FCI_DELAYBYTE_US(100);

    SET_PORT_PIN(B, 5, 0);

    FCI_DELAYBYTE_US(100);

  // #else
  //Code has been optimised out by the pre-processor
  #endif

}

/*=----------------------------------------------------------------------=*\
   Use :Print a Float number rounded up to a specified amount of decimal places.
       :
       :Parameters for macro PrintFloat:
       :  Number : Enter the number or variable to print to the LCD
       :  DecimalPlaces : Enter how many decimal places to round up to (1 - 6)
\*=----------------------------------------------------------------------=*/
void FCD_04071_LCD__PrintFloat(MX_FLOAT FCL_NUMBER, MX_UINT8 FCL_DECIMALPLACES)
{
  //Local variable definitions
  #define FCLsz_S 10
  MX_CHAR FCL_S[FCLsz_S];


  if (FCL_DECIMALPLACES &gt; 6)
  {  

    FCL_DECIMALPLACES = 6;

  } else {

    if (FCL_DECIMALPLACES &lt; 1)
    {    

      FCL_DECIMALPLACES = 1;

    // } else {

    }

  }

  FCI_FLOAT_TO_STRING(FCL_NUMBER, FCL_DECIMALPLACES, FCL_S, FCLsz_S);

  FCD_04071_LCD__PrintString(FCL_S, FCLsz_S);

  //Local variable definitions
  #undef FCLsz_S
}

/*=----------------------------------------------------------------------=*\
   Use :Assigns a remap character allowing the PrintString function to automatically swap between pre-defined characters. 

       :The characters can be custom (in the range 0-9) or can point to an existing character in the LCD character map.
       :
       :Parameters for macro RemapCharacter:
       :  RemapIdx : Remap Index, Range: 0 to (Remap Characters - 1)
       :  SearchCharacter : Character to look for a replace
       :  ReplacementCharacter : New character value to use in place of the search character.
\*=----------------------------------------------------------------------=*/
void FCD_04071_LCD__RemapCharacter(MX_UINT8 FCL_REMAPIDX, MX_UINT8 FCL_SEARCHCHARACTER, MX_UINT8 FCL_REPLACEMENTCHARACTER)
{

  #if (0) // 0 &gt; 0
  //Code has been optimised out by the pre-processor
  // #else
  #endif

}

/*=----------------------------------------------------------------------=*\
   Use :Startup routine required by the hardware device.

       :Automatically clears the display after initialising.
\*=----------------------------------------------------------------------=*/
void FCD_04071_LCD__Start()
{

  // ::Component.Property.SetValue(this, &quot;CursorPosX&quot;, 0)

  // ::Component.Property.SetValue(this, &quot;CursorPosY&quot;, 0)

  #if (1) // 0 == 0
    SET_PORT_PIN(B, 0, 0);
    SET_PORT_PIN(B, 1, 0);
    SET_PORT_PIN(B, 2, 0);
    SET_PORT_PIN(B, 3, 0);
    SET_PORT_PIN(B, 4, 0);
    SET_PORT_PIN(B, 5, 0);

  // #else
  //Code has been optimised out by the pre-processor
  #endif

  #if (0) // 0 == 1
  //Code has been optimised out by the pre-processor
  // #else
  #endif

  #if (0) // 0 == 2
  //Code has been optimised out by the pre-processor
  // #else
  #endif

  #if (0)
  //Code has been optimised out by the pre-processor
  // #else
  #endif

  FCI_DELAYBYTE_MS(12);

  FCD_04071_LCD__RawSend(0x33, 0);

  FCI_DELAYBYTE_MS(2);

  FCD_04071_LCD__RawSend(0x33, 0);

  FCI_DELAYBYTE_MS(2);

  #if (0) // 0 &gt; 0
  //Code has been optimised out by the pre-processor
  #else
    FCD_04071_LCD__RawSend(0x32, 0);

    FCI_DELAYBYTE_MS(2);

    FCD_04071_LCD__RawSend(0x2c, 0);

  #endif

  FCI_DELAYBYTE_MS(2);

  FCD_04071_LCD__RawSend(0x06, 0);

  FCI_DELAYBYTE_MS(2);

  FCD_04071_LCD__RawSend(0x0c, 0);

  FCI_DELAYBYTE_MS(2);

  FCD_04071_LCD__RawSend(0x01, 0);

  FCI_DELAYBYTE_MS(2);

  FCD_04071_LCD__RawSend(0x02, 0);

  FCI_DELAYBYTE_MS(2);

  FCD_04071_LCD__Clear();

  #if (0) // 0 &gt; 0
  //Code has been optimised out by the pre-processor
  // #else
  #endif

}

#define FCA_LCD_16X2 0xf9e1
#define FCV_LCD_16X2 0x1d29

/*========================================================================*\
   Use :lcd_16x2
       :GUID: f8c9b53d-0bf2-469f-8f0a-34caa93749ba
       :Location: C:\ProgramData\MatrixTSL\FlowcodeV11\Components\lcd_16x2.fcpx
       :Version: 7.0 (0x100128)
       :Timestamp: 11\11\2022
       :Variable declarations
       :Macro implementations
\*========================================================================*/
/*=----------------------------------------------------------------------=*\
   Use :Clears the entire contents of the display.
\*=----------------------------------------------------------------------=*/
void FCD_0f9e1_lcd_16x2__Clear()
{

  FCD_04071_LCD__Clear();

}

/*=----------------------------------------------------------------------=*\
   Use :Breaks down a string of text and sends it to the LCD via the private RawSend(byte, mask) macro
       :
       :Parameters for macro PrintString:
       :  Text[20] : Enter the text or variable to print to the LCD
\*=----------------------------------------------------------------------=*/
void FCD_0f9e1_lcd_16x2__PrintString(MX_CHAR *FCL_TEXT, MX_UINT16 FCLsz_TEXT)
{

  FCD_04071_LCD__PrintString(FCL_TEXT, FCLsz_TEXT);

}

/*=----------------------------------------------------------------------=*\
   Use :Takes the ascii value for a character and prints the character
       :
       :Parameters for macro PrintAscii:
       :  character : Holds an ascii value.
\*=----------------------------------------------------------------------=*/
void FCD_0f9e1_lcd_16x2__PrintAscii(MX_UINT8 FCL_CHARACTER)
{

  FCD_04071_LCD__PrintAscii(FCL_CHARACTER);

}

/*=----------------------------------------------------------------------=*\
   Use :Based on v5 macro, will allow you to print a number. This is limited to a signed-INT, -32768 to 32767
       :
       :Parameters for macro PrintNumber:
       :  Number : Enter the number or variable to print to the LCD
\*=----------------------------------------------------------------------=*/
void FCD_0f9e1_lcd_16x2__PrintNumber(MX_SINT16 FCL_NUMBER)
{

  FCD_04071_LCD__PrintNumber(FCL_NUMBER);

}

/*=----------------------------------------------------------------------=*\
   Use :Modifies the internal memory of the LCD to allow for up to 8 customised characters to be created and stored in the device memory
       :
       :Parameters for macro RAMWrite:
       :  Index : Values 0 to 7
       :  d0 : MX_UINT8
       :  d1 : MX_UINT8
       :  d2 : MX_UINT8
       :  d3 : MX_UINT8
       :  d4 : MX_UINT8
       :  d5 : MX_UINT8
       :  d6 : MX_UINT8
       :  d7 : MX_UINT8
\*=----------------------------------------------------------------------=*/
void FCD_0f9e1_lcd_16x2__RAMWrite(MX_UINT8 FCL_INDEX, MX_UINT8 FCL_D0, MX_UINT8 FCL_D1, MX_UINT8 FCL_D2, MX_UINT8 FCL_D3, MX_UINT8 FCL_D4, MX_UINT8 FCL_D5, MX_UINT8 FCL_D6, MX_UINT8 FCL_D7)
{

  FCD_04071_LCD__RAMWrite(FCL_INDEX, FCL_D0, FCL_D1, FCL_D2, FCL_D3, FCL_D4, FCL_D5, FCL_D6, FCL_D7);

}

/*=----------------------------------------------------------------------=*\
   Use :Clears a single line on the display and then moves the cursor to the start of the line to allow you to start populating the line with data.
       :
       :Parameters for macro ClearLine:
       :  Line : The line to clear, zero being the first (top) line of the display
\*=----------------------------------------------------------------------=*/
void FCD_0f9e1_lcd_16x2__ClearLine(MX_UINT8 FCL_LINE)
{

  FCD_04071_LCD__ClearLine(FCL_LINE);

}

/*=----------------------------------------------------------------------=*\
   Use :Moves the cursor on the LCD Display
       :
       :Parameters for macro Cursor:
       :  x : Set the cursor position in the X plane, 0 is the left most cell
       :  y : Set the cursor position in the Y plane, 0 is the top most cell
\*=----------------------------------------------------------------------=*/
void FCD_0f9e1_lcd_16x2__Cursor(MX_UINT8 FCL_X, MX_UINT8 FCL_Y)
{

  FCD_04071_LCD__Cursor(FCL_X, FCL_Y);

}

/*=----------------------------------------------------------------------=*\
   Use :Use this method/macro to send a specific command to the LCD. Refer to the Matrix Multimedia EB006 datasheet for a list of supported instructions. For Non-Matrix LCD&apos;s refer to the manufacturers datasheet.
       :
       :Parameters for macro Command:
       :  instruction : Send a defined command to the LCD Screen. See datasheet for supported commands.
\*=----------------------------------------------------------------------=*/
void FCD_0f9e1_lcd_16x2__Command(MX_UINT8 FCL_INSTRUCTION)
{

  FCD_04071_LCD__Command(FCL_INSTRUCTION);

}

/*=----------------------------------------------------------------------=*\
   Use :Will allow you to print a number up to 32-bits with signed or unsigned formatting.

       :Signed = -2147483648 to 2147483647

       :Unsigned = 0 to 4294967295
       :
       :Parameters for macro PrintFormattedNumber:
       :  Number : Enter the number or variable to print to the LCD
       :  Format : 0=Signed, 1=Unsigned
\*=----------------------------------------------------------------------=*/
void FCD_0f9e1_lcd_16x2__PrintFormattedNumber(MX_UINT32 FCL_NUMBER, MX_BOOL FCL_FORMAT)
{

  FCD_04071_LCD__PrintFormattedNumber(FCL_NUMBER, FCL_FORMAT);

}

/*=----------------------------------------------------------------------=*\
   Use :Scrolls the display left or right by a number of given positions.
       :
       :Parameters for macro ScrollDisplay:
       :  Position : Holds the number of positions to shift the display
       :  Direction : 0 = left, 1 = right
\*=----------------------------------------------------------------------=*/
void FCD_0f9e1_lcd_16x2__ScrollDisplay(MX_UINT8 FCL_POSITION, MX_UINT8 FCL_DIRECTION)
{

  FCD_04071_LCD__ScrollDisplay(FCL_POSITION, FCL_DIRECTION);

}

/*=----------------------------------------------------------------------=*\
   Use :Sends data to the LCD display
       :
       :Parameters for macro RawSend:
       :  data : The data byte to send to the LCD
       :  type : A boolean to indicate command type: true to write data, false to write a command
\*=----------------------------------------------------------------------=*/
void FCD_0f9e1_lcd_16x2__RawSend(MX_UINT8 FCL_DATA, MX_BOOL FCL_TYPE)
{

  FCD_04071_LCD__RawSend(FCL_DATA, FCL_TYPE);

}

/*=----------------------------------------------------------------------=*\
   Use :Print a Float number rounded up to a specified amount of decimal places.
       :
       :Parameters for macro PrintFloat:
       :  Number : Enter the number or variable to print to the LCD
       :  DecimalPlaces : Enter how many decimal places to round up to (1 - 6)
\*=----------------------------------------------------------------------=*/
void FCD_0f9e1_lcd_16x2__PrintFloat(MX_FLOAT FCL_NUMBER, MX_UINT8 FCL_DECIMALPLACES)
{

  FCD_04071_LCD__PrintFloat(FCL_NUMBER, FCL_DECIMALPLACES);

}

/*=----------------------------------------------------------------------=*\
   Use :Assigns a remap character allowing the PrintString function to automatically swap between pre-defined characters. 

       :The characters can be custom (in the range 0-9) or can point to an existing character in the LCD character map.
       :
       :Parameters for macro RemapCharacter:
       :  RemapIdx : Remap Index, Range: 0 to (Remap Characters - 1)
       :  SearchCharacter : Character to look for a replace
       :  ReplacementCharacter : New character value to use in place of the search character.
\*=----------------------------------------------------------------------=*/
void FCD_0f9e1_lcd_16x2__RemapCharacter(MX_UINT8 FCL_REMAPIDX, MX_UINT8 FCL_SEARCHCHARACTER, MX_UINT8 FCL_REPLACEMENTCHARACTER)
{

  FCD_04071_LCD__RemapCharacter(FCL_REMAPIDX, FCL_SEARCHCHARACTER, FCL_REPLACEMENTCHARACTER);

}

/*=----------------------------------------------------------------------=*\
   Use :Startup routine required by the hardware device.

       :Automatically clears the display after initialising.
\*=----------------------------------------------------------------------=*/
void FCD_0f9e1_lcd_16x2__Start()
{

  FCD_04071_LCD__Start();

}


/*========================================================================*\
   Use :User Project
       :Variable declarations
       :Macro implementations
\*========================================================================*/
#define FCV_FALSE (0)
#define FCV_TRUE (1)



/*========================================================================*\
   Use :Main
\*========================================================================*/
int main()
{
	MCUSR=0x00;

	
#if 0 // Disabled code
  // Enter C code below this comment
  //************************************************************************************
  //**  
  //**  Source name:   E:\flowcode exp\Flowcode1.fcfx
  //**  Title:         Embedded Project
  //**  Description:   
  //**  Device:        AVR.ATMEGA.ATMEGA328P
  //**  
  //**  Generated by:  Flowcode v11.0.2.17
  //**  Date:          Wednesday, September 23, 2026 09:26:02
  //**  Users:         1
  //**  Registered to: 18913347650 (FREE_VERSION)
  //**  Licence key: TCW03R
  //**  
  //**  
  //**     NOT FOR COMMERCIAL USE
  //**  
  //**  https://www.flowcode.co.uk
  //**  
  //************************************************************************************


  #define MX_AVR

  #define MX_CAL_AVR

  #define MX_CLK_SPEED 8000000

  #define FCP_NULL Unconnected_Port

  #define MX_UART_ID
  #define MX_UART_UCSRC

  #include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  #include &lt;avr\io.h&gt;
  #include &lt;avr\interrupt.h&gt;
  #include &lt;avr\eeprom.h&gt;
  #include &lt;avr\wdt.h&gt;

  //Configuration Start
  //Configuration End

  /*========================================================================*\
     Use :Include the type definitions
  \*========================================================================*/
  #include &quot;C:\ProgramData\MatrixTSL\FlowcodeV11\CAL\internals.c&quot;





#endif // Disabled code

  // Component Macro
  FCD_0f9e1_lcd_16x2__Start();

	mainendloop: goto mainendloop;
}



/*========================================================================*\
   Use :Interrupt
\*========================================================================*/




' language='C' />
						<command class_type='call' title='Component Macro' component='lcd_16x2' macro='Start' />
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='f8c9b53d-0bf2-469f-8f0a-34caa93749ba' vmin='1' vmaj='1' codename='lcd_16x2' panelId='0' x='303.5' y='-148.5' z='0' xsz='24.9314' ysz='25.3226' zsz='25' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='2' poslock='1' ancTop='0' ancBottom='0' ancLeft='0' ancRight='0' ancMinX='0' ancMinY='0' comp2dType='0' >
				<resources />
				<properties />
				<values >
					<value target='Pin_Data_0' data='$PORTB.0' />
					<value target='Pin_Data_1' data='$PORTB.1' />
					<value target='Pin_Data_2' data='$PORTB.2' />
					<value target='Pin_Data_3' data='$PORTB.3' />
					<value target='Pin_RS' data='$PORTB.4' />
					<value target='Pin_E' data='$PORTB.5' />
					<value target='LCD::ctrl_lcd::Base_GLCD1::ComponentLabel' data='000' />
					<value target='LCD::ctrl_lcd::Base_GLCD1::GdiText1::sText' data='lcd_16x2' />
					<value target='LCD::ctrl_lcd::Base_GLCD1::GdiText1::dScale' data='1.4' />
					<value target='LCD::ctrl_lcd::TextColour' data='0' />
					<value target='LCD::ctrl_lcd::TextBg' data='14803425' />
					<value target='LCD::ctrl_lcd::DisplayBg' data='16777215' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
		</component>
	</components>
	<scadaresourcelookup />
	<keymap />
	<panel2d shadows='0' lighting='2' brightness='0' >
		<background rgb='7292207' img='' style='0' />
		<camera xe='0' ye='0' ze='429.55' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<viewport dx='128' dy='128' zoom='36.0563' fix_topleft='0' />
		<page x='1000' y='1000' show='0' rgb='7360576' />
		<winpos ID='7005' RectRecentFloat='0,0,1146,782' RectRecentDocked='0,0,375,532' RecentFrameAlignment='16384' RecentRowIndex='0' IsFloating='0' MRUWidth='32767' PinState='0' IsMaximized='0' IsVisible='0' />
	</panel2d>
	<panel3d shadows='0' lighting='2' brightness='0' perspective='1' >
		<background rgb='8409120' img='' style='0' />
		<table rgb='7360576' img='' style='0' size='0' />
		<camera xe='0' ye='0' ze='781.66' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<camerakey0 xe='0' ye='0' ze='300' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<camerakey1 xe='-3.67394e-14' ye='0' ze='-300' xt='0' yt='0' zt='0' xquat='0' yquat='1' zquat='0' wquat='6.12323e-17' />
		<camerakey2 xe='0' ye='-300' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.707107' yquat='0' zquat='0' wquat='0.707107' />
		<camerakey3 xe='-3.67394e-14' ye='300' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-4.32978e-17' yquat='0.707107' zquat='0.707107' wquat='4.32978e-17' />
		<camerakey4 xe='-300' ye='-6.66134e-14' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.5' yquat='0.5' zquat='0.5' wquat='0.5' />
		<camerakey5 xe='300' ye='-6.66134e-14' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.5' yquat='-0.5' zquat='-0.5' wquat='0.5' />
		<camerakey6 xe='-173.205' ye='-173.205' ze='173.205' xt='0' yt='0' zt='0' xquat='-0.424708' yquat='0.17592' zquat='0.339851' wquat='0.820473' />
		<winpos ID='7004' RectRecentFloat='0,191,654,768' RectRecentDocked='0,0,370,561' RecentFrameAlignment='16384' RecentRowIndex='0' IsFloating='0' MRUWidth='32767' PinState='0' IsMaximized='0' IsVisible='0' />
	</panel3d>
	<panels2d count='1' >
		<panel2d_0 id='0' name='NewPanel' type='0' >
			<winpos ID='1171' RectRecentFloat='746,343,1396,793' RectRecentDocked='0,0,650,450' RecentFrameAlignment='16384' RecentRowIndex='0' IsFloating='1' MRUWidth='32767' PinState='0' IsMaximized='0' IsVisible='1' />
			<background fill='288230376151053813' showgrid='1' gridstyle='1' gridsize='10' gridbrush='71776119075691740' snaptogrid='1' fitcomp='0' disp_x='300' disp_y='400' scale='100' disp_col='16777215' />
		</panel2d_0>
	</panels2d>
	<layout >
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAcAAAARQQAACwCAAA' zoom='100' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
