📄 vfd_tool.c
字号:
#define ICON_G4P1 {0x06, 0x01}
#define ICON_G4P2 {0x06, 0x02}
#define ICON_G4P3 {0x06, 0x04}
#define ICON_G4P4 {0x06, 0x08}
#define ICON_G4P5 {0x06, 0x10}
#define ICON_G4P6 {0x06, 0x20}
#define ICON_G4P7 {0x06, 0x40}
#define ICON_G4P8 {0x06, 0x80}
#define ICON_G4P9 {0x07, 0x01}
#define ICON_G4P10 {0x07, 0x02}
#define ICON_G4P11 {0x07, 0x04}
#define ICON_G4P12 {0x07, 0x08}
#define ICON_G4P13 {0x07, 0x10}
#define ICON_G4P14 {0x07, 0x20}
#define ICON_G4P15 {0x07, 0x40}
#define ICON_G4P16 {0x07, 0x80}
#define ICON_G5P1 {0x08, 0x01}
#define ICON_G5P2 {0x08, 0x02}
#define ICON_G5P3 {0x08, 0x04}
#define ICON_G5P4 {0x08, 0x08}
#define ICON_G5P5 {0x08, 0x10}
#define ICON_G5P6 {0x08, 0x20}
#define ICON_G5P7 {0x08, 0x40}
#define ICON_G5P8 {0x08, 0x80}
#define ICON_G5P9 {0x09, 0x01}
#define ICON_G5P10 {0x09, 0x02}
#define ICON_G5P11 {0x09, 0x04}
#define ICON_G5P12 {0x09, 0x08}
#define ICON_G5P13 {0x09, 0x10}
#define ICON_G5P14 {0x09, 0x20}
#define ICON_G5P15 {0x09, 0x40}
#define ICON_G5P16 {0x09, 0x80}
#define ICON_G6P1 {0x0a, 0x01}
#define ICON_G6P2 {0x0a, 0x02}
#define ICON_G6P3 {0x0a, 0x04}
#define ICON_G6P4 {0x0a, 0x08}
#define ICON_G6P5 {0x0a, 0x10}
#define ICON_G6P6 {0x0a, 0x20}
#define ICON_G6P7 {0x0a, 0x40}
#define ICON_G6P8 {0x0a, 0x80}
#define ICON_G6P9 {0x0b, 0x01}
#define ICON_G6P10 {0x0b, 0x02}
#define ICON_G6P11 {0x0b, 0x04}
#define ICON_G6P12 {0x0b, 0x08}
#define ICON_G6P13 {0x0b, 0x10}
#define ICON_G6P14 {0x0b, 0x20}
#define ICON_G6P15 {0x0b, 0x40}
#define ICON_G6P16 {0x0b, 0x80}
#define ICON_G7P1 {0x0c, 0x01}
#define ICON_G7P2 {0x0c, 0x02}
#define ICON_G7P3 {0x0c, 0x04}
#define ICON_G7P4 {0x0c, 0x08}
#define ICON_G7P5 {0x0c, 0x10}
#define ICON_G7P6 {0x0c, 0x20}
#define ICON_G7P7 {0x0c, 0x40}
#define ICON_G7P8 {0x0c, 0x80}
#define ICON_G7P9 {0x0d, 0x01}
#define ICON_G7P10 {0x0d, 0x02}
#define ICON_G7P11 {0x0d, 0x04}
#define ICON_G7P12 {0x0d, 0x08}
#define ICON_G7P13 {0x0d, 0x10}
#define ICON_G7P14 {0x0d, 0x20}
#define ICON_G7P15 {0x0d, 0x40}
#define ICON_G7P16 {0x0d, 0x80}
#define ICON_G8P1 {0x0e, 0x01}
#define ICON_G8P2 {0x0e, 0x02}
#define ICON_G8P3 {0x0e, 0x04}
#define ICON_G8P4 {0x0e, 0x08}
#define ICON_G8P5 {0x0e, 0x10}
#define ICON_G8P6 {0x0e, 0x20}
#define ICON_G8P7 {0x0e, 0x40}
#define ICON_G8P8 {0x0e, 0x80}
#define ICON_G8P9 {0x0f, 0x01}
#define ICON_G8P10 {0x0f, 0x02}
#define ICON_G8P11 {0x0f, 0x04}
#define ICON_G8P12 {0x0f, 0x08}
#define ICON_G8P13 {0x0f, 0x10}
#define ICON_G8P14 {0x0f, 0x20}
#define ICON_G8P15 {0x0f, 0x40}
#define ICON_G8P16 {0x0f, 0x80}
#define ICON_G9P1 {0x10, 0x01}
#define ICON_G9P2 {0x10, 0x02}
#define ICON_G9P3 {0x10, 0x04}
#define ICON_G9P4 {0x10, 0x08}
#define ICON_G9P5 {0x10, 0x10}
#define ICON_G9P6 {0x10, 0x20}
#define ICON_G9P7 {0x10, 0x40}
#define ICON_G9P8 {0x10, 0x80}
#define ICON_G9P9 {0x11, 0x01}
#define ICON_G9P10 {0x11, 0x02}
#define ICON_G9P11 {0x11, 0x04}
#define ICON_G9P12 {0x11, 0x08}
#define ICON_G9P13 {0x11, 0x10}
#define ICON_G9P14 {0x11, 0x20}
#define ICON_G9P15 {0x11, 0x40}
#define ICON_G9P16 {0x11, 0x80}
#define ICON_G10P1 {0x12, 0x01}
#define ICON_G10P2 {0x12, 0x02}
#define ICON_G10P3 {0x12, 0x04}
#define ICON_G10P4 {0x12, 0x08}
#define ICON_G10P5 {0x12, 0x10}
#define ICON_G10P6 {0x12, 0x20}
#define ICON_G10P7 {0x12, 0x40}
#define ICON_G10P8 {0x12, 0x80}
#define ICON_G10P9 {0x13, 0x01}
#define ICON_G10P10 {0x13, 0x02}
#define ICON_G10P11 {0x13, 0x04}
#define ICON_G10P12 {0x13, 0x08}
#define ICON_G10P13 {0x13, 0x10}
#define ICON_G10P14 {0x13, 0x20}
#define ICON_G10P15 {0x13, 0x40}
#define ICON_G10P16 {0x13, 0x80}
#define ICON_G11P1 {0x14, 0x01}
#define ICON_G11P2 {0x14, 0x02}
#define ICON_G11P3 {0x14, 0x04}
#define ICON_G11P4 {0x14, 0x08}
#define ICON_G11P5 {0x14, 0x10}
#define ICON_G11P6 {0x14, 0x20}
#define ICON_G11P7 {0x14, 0x40}
#define ICON_G11P8 {0x14, 0x80}
#define ICON_G11P9 {0x15, 0x01}
#define ICON_G11P10 {0x15, 0x02}
#define ICON_G11P11 {0x15, 0x04}
#define ICON_G11P12 {0x15, 0x08}
#define ICON_G11P13 {0x15, 0x10}
#define ICON_G11P14 {0x15, 0x20}
#define ICON_G11P15 {0x15, 0x40}
#define ICON_G11P16 {0x15, 0x80}
#define ICON_G12P1 {0x16, 0x01}
#define ICON_G12P2 {0x16, 0x02}
#define ICON_G12P3 {0x16, 0x04}
#define ICON_G12P4 {0x16, 0x08}
#define ICON_G12P5 {0x16, 0x10}
#define ICON_G12P6 {0x16, 0x20}
#define ICON_G12P7 {0x16, 0x40}
#define ICON_G12P8 {0x16, 0x80}
#define ICON_G12P9 {0x17, 0x01}
#define ICON_G12P10 {0x17, 0x02}
#define ICON_G12P11 {0x17, 0x04}
#define ICON_G12P12 {0x17, 0x08}
#define ICON_G12P13 {0x17, 0x10}
#define ICON_G12P14 {0x17, 0x20}
#define ICON_G12P15 {0x17, 0x40}
#define ICON_G12P16 {0x17, 0x80}
#define ICON_G13P1 {0x18, 0x01}
#define ICON_G13P2 {0x18, 0x02}
#define ICON_G13P3 {0x18, 0x04}
#define ICON_G13P4 {0x18, 0x08}
#define ICON_G13P5 {0x18, 0x10}
#define ICON_G13P6 {0x18, 0x20}
#define ICON_G13P7 {0x18, 0x40}
#define ICON_G13P8 {0x18, 0x80}
#define ICON_G13P9 {0x19, 0x01}
#define ICON_G13P10 {0x19, 0x02}
#define ICON_G13P11 {0x19, 0x04}
#define ICON_G13P12 {0x19, 0x08}
#define ICON_G13P13 {0x19, 0x10}
#define ICON_G13P14 {0x19, 0x20}
#define ICON_G13P15 {0x19, 0x40}
#define ICON_G13P16 {0x19, 0x80}
#define ICON_G14P1 {0x1a, 0x01}
#define ICON_G14P2 {0x1a, 0x02}
#define ICON_G14P3 {0x1a, 0x04}
#define ICON_G14P4 {0x1a, 0x08}
#define ICON_G14P5 {0x1a, 0x10}
#define ICON_G14P6 {0x1a, 0x20}
#define ICON_G14P7 {0x1a, 0x40}
#define ICON_G14P8 {0x1a, 0x80}
#define ICON_G14P9 {0x1b, 0x01}
#define ICON_G14P10 {0x1b, 0x02}
#define ICON_G14P11 {0x1b, 0x04}
#define ICON_G14P12 {0x1b, 0x08}
#define ICON_G14P13 {0x1b, 0x10}
#define ICON_G14P14 {0x1b, 0x20}
#define ICON_G14P15 {0x1b, 0x40}
#define ICON_G14P16 {0x1b, 0x80}
#define ICON_G15P1 {0x1c, 0x01}
#define ICON_G15P2 {0x1c, 0x02}
#define ICON_G15P3 {0x1c, 0x04}
#define ICON_G15P4 {0x1c, 0x08}
#define ICON_G15P5 {0x1c, 0x10}
#define ICON_G15P6 {0x1c, 0x20}
#define ICON_G15P7 {0x1c, 0x40}
#define ICON_G15P8 {0x1c, 0x80}
#define ICON_G15P9 {0x1d, 0x01}
#define ICON_G15P10 {0x1d, 0x02}
#define ICON_G15P11 {0x1d, 0x04}
#define ICON_G15P12 {0x1d, 0x08}
#define ICON_G15P13 {0x1d, 0x10}
#define ICON_G15P14 {0x1d, 0x20}
#define ICON_G15P15 {0x1d, 0x40}
#define ICON_G15P16 {0x1d, 0x80}
#define ICON_G16P1 {0x1e, 0x01}
#define ICON_G16P2 {0x1e, 0x02}
#define ICON_G16P3 {0x1e, 0x04}
#define ICON_G16P4 {0x1e, 0x08}
#define ICON_G16P5 {0x1e, 0x10}
#define ICON_G16P6 {0x1e, 0x20}
#define ICON_G16P7 {0x1e, 0x40}
#define ICON_G16P8 {0x1e, 0x80}
#define ICON_G16P9 {0x1f, 0x01}
#define ICON_G16P10 {0x1f, 0x02}
#define ICON_G16P11 {0x1f, 0x04}
#define ICON_G16P12 {0x1f, 0x08}
#define ICON_G16P13 {0x1f, 0x10}
#define ICON_G16P14 {0x1f, 0x20}
#define ICON_G16P15 {0x1f, 0x40}
#define ICON_G16P16 {0x1f, 0x80}
/************************************************************************
Load specified VFD definition
************************************************************************/
#include "vfdspec.h"
/************************************************************************
Local variables
************************************************************************/
#define MAX_SHADOW_NUMBER 60
#define LIST_ITEM2LEN(item) (item*3+1)
#define MAX_LIST_LEN LIST_ITEM2LEN(VFD_SHADOW_LEN)
typedef struct structShadow
{
BYTE pbOn[VFD_SHADOW_LEN];
BYTE pbOff[VFD_SHADOW_LEN];
BYTE pbList[MAX_LIST_LEN];
BYTE bListLen;
} strucShadow;
strucShadow prShadow[MAX_SHADOW_NUMBER];
WORD pwNumberList[] = {CHAR_0, CHAR_1, CHAR_2, CHAR_3, CHAR_4, CHAR_5,
CHAR_6, CHAR_7, CHAR_8, CHAR_9, CHAR_all };
/* for binary data storage */
#define VFD_BINARY_MAX (16*1024) /* 16K */
BYTE pbVfdBinary[VFD_BINARY_MAX];
/************************************************************************
Function :
Description :
Parameter :
Return :
************************************************************************/
void vResetShadow(void)
{
BYTE i, j;
for (i=0;i<MAX_SHADOW_NUMBER;i++)
{
for (j=0;j<VFD_SHADOW_LEN;j++)
{
(prShadow[i]).pbOn[j] = 0x00;
(prShadow[i]).pbOff[j] = 0xff;
}
}
}
/************************************************************************
Function :
Description :
Parameter :
Return :
************************************************************************/
void VfdSetIcon(strucVfdIcon *prNode, BYTE bLite, BYTE bNo)
{
if (bLite == 1) /* turn on */
{
(prShadow[bNo]).pbOn[prNode->bHi] |= prNode->bLo;
}
else if (bLite == 0) /* turn off */
{
(prShadow[bNo]).pbOff[prNode->bHi] &= ~(prNode->bLo);
}
}
/************************************************************************
Function :
Description :
Parameter :
Return :
************************************************************************/
BYTE bVfdGetListLenMax(BYTE bNoMax)
{
BYTE i, bLen;
bLen = 0;
for (i=0;i<bNoMax;i++)
{
if (bLen < (prShadow[i]).bListLen)
{
bLen = (prShadow[i]).bListLen;
}
}
return bLen;
}
/************************************************************************
Function :
Description :
Parameter :
Return :
************************************************************************/
void VfdGetList(BYTE bNo)
{
BYTE i, bCnt;
BYTE *pbIndex;
char *pcIndex;
bCnt = 0;
pbIndex = (prShadow[bNo]).pbList;
for (i=0;i<VFD_SHADOW_LEN;i++)
{
if (((prShadow[bNo]).pbOn[i] != 0x00) || ((prShadow[bNo]).pbOff[i] != 0xff))
{
*pbIndex = i;
*(pbIndex+1) = (prShadow[bNo]).pbOn[i];
*(pbIndex+2) = (prShadow[bNo]).pbOff[i];
pbIndex += 3;
bCnt++;
}
}
/* note we do not add list end */
(prShadow[bNo]).bListLen = bCnt;
return;
}
/************************************************************************
Function :
Description :
Parameter :
Return :
************************************************************************/
void VfdWriteAllList(FILE *out, BYTE bNoMax, BYTE bListMax)
{
BYTE i, j, bMaxLen;
char pcTmp[MAX_LIST_LEN*6+5];
BYTE *pbIndex;
char *pcIndex;
for (i=0;i<bNoMax;i++)
{
/* convert binary to string */
pbIndex = (prShadow[i]).pbList;
pcIndex = pcTmp;
for (j=0;j<bListMax;j++)
{
if (j < (prShadow[i]).bListLen)
{
sprintf(pcIndex, "0x%02x, 0x%02x, 0x%02x, ",
*pbIndex, *(pbIndex+1), *(pbIndex+2));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -