交叉二五码实验报告.docx

上传人:b****5 文档编号:2855793 上传时间:2022-11-16 格式:DOCX 页数:15 大小:247.54KB
下载 相关 举报
交叉二五码实验报告.docx_第1页
第1页 / 共15页
交叉二五码实验报告.docx_第2页
第2页 / 共15页
交叉二五码实验报告.docx_第3页
第3页 / 共15页
交叉二五码实验报告.docx_第4页
第4页 / 共15页
交叉二五码实验报告.docx_第5页
第5页 / 共15页
点击查看更多>>
下载资源
资源描述

交叉二五码实验报告.docx

《交叉二五码实验报告.docx》由会员分享,可在线阅读,更多相关《交叉二五码实验报告.docx(15页珍藏版)》请在冰豆网上搜索。

交叉二五码实验报告.docx

交叉二五码实验报告

 

交叉二五码实验报告

 

专业

班级

姓名

学号

课程物流供应链管理与编码技术

指导教师

 

一、实验题目

交叉二五码实验

二、实验目的

熟悉并掌握交叉二五码的编码方式,在编码实验的过程中体现编码原则,最终生成交叉二五码。

三、实验原理

交叉25码是一种高密度的,可以嵌入任意数量数字的,长度可变化的数字条形码。

该条形码是基于标准25码的规范改进而得来,它比标准25码有更高的密度与数据存储能力。

交叉25码主要运用在物流行业与仓储业中。

标准25码只用黑色条码代表数字0-9,而交叉25码既使用黑色条码也使用白色条码来代表0-9的数字。

例如,标准25码会用前五个黑色条码表示第一个数字,用紧接着的五个黑色条码表示第二个数字;而交叉25码是使用前五条黑色条码表示第一个数字,而用介于前五个黑色条码中的白色条码表示第二个数字。

这也是交叉25码名称的来源。

交叉25码是连续型、非定长、具有自动校验功能的双向条码,交叉25码的编码是以两个字符为一组(上下各一个)进行编码,其中一个字符以条编码,另一个字符以空编码,每个字符由5个单元组成(3个窄单元,2个宽单元),两个字符的条空相互交叉组合在一起。

交叉25码的起始符为:

窄条--窄空--窄条--窄空,0000

交叉25码的终止符为:

宽条--窄空--窄条,100

交插25码的字符集包括数字0到9如下图示:

起始符:

0000,非条码字符,终止符:

100,非条码字符。

奇数:

条;偶数位:

空字符集;

数字0~9宽度调节编码法:

编码方法以窄单元(条或空)表示逻辑值“0”,宽单元(条或空)表示逻辑值“1”。

宽单元通常是窄单元的2~3倍。

0~9与条或空的关系分析例子如下:

0偶数位用空表示:

窄—窄—宽—宽—窄00110

1奇数位用条表示:

宽—窄—窄—窄—宽10001

2偶数位用空表示:

窄—宽—窄—窄—宽01001

3奇数位用条表示:

宽—宽—窄—窄—窄11000

4偶数位用空表示:

窄—窄—宽—窄—宽00101

5奇数位用条表示:

宽—窄—宽—窄—窄10100

6奇数位用空表示:

窄—宽—宽—窄—窄01100

7奇数位用条表示:

窄—窄—窄—宽—宽00011

8偶数位用空表示:

宽—窄—窄—宽—窄10010

9奇数位用条表示:

窄—宽—窄—宽—窄01010

总结:

起始—0000

1—10001

2—01001

3—11000

4—00101

5—10100

6—01100

7—00011

8—10010

9—01010

0—00110

终止—100

四、实验步骤

1.先打开visualc++并新建项目。

在lib目录下输入编好的代码,如下图:

2.点击运行调试

3.输入我的学号“2011115040415”后点击Encode按键,生成一个交叉二五码:

五、实验主要代码

1.Program.cs:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.Windows.Forms;

namespaceBarcoder

{

staticclassProgram

{

///

///Themainentrypointfortheapplication.

///

[STAThread]

staticvoidMain()

{

Application.EnableVisualStyles();

Application.SetCompatibleTextRenderingDefault(false);

Application.Run(newMainForm());

}

}

}

2.MainForm.cs:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Text;

usingSystem.Windows.Forms;

usingBarcoderLib;

namespaceBarcoder

{

publicpartialclassMainForm:

Form

{

publicMainForm()

{

InitializeComponent();

}

privatevoidexitToolStripMenuItem_Click(objectsender,EventArgse)

{

this.Close();

}

privatevoidaboutToolStripMenuItem_Click(objectsender,EventArgse)

{

AboutBoxaboutBox1=newAboutBox();

aboutBox1.ShowDialog();

}

privatevoidMainForm_Load(objectsender,EventArgse)

{

}

privatevoidcmdEncode_Click(objectsender,EventArgse)

{

cmdSave.Enabled=false;

try

{

switch(cboFormat.Text.Trim())

{

case"Interleaved2of5":

BarcodeInter2of5encoderInter2of5=newBarcodeInter2of5();

picOutput.Image=encoderInter2of5.Encode(txtMessage.Text.Trim());

cmdSave.Enabled=true;

break;

}

}

catch(Exceptionex)

{

MessageBox.Show(ex.Message,"Error",MessageBoxButtons.OK);

}

}

privatevoidcmdSave_Click(objectsender,EventArgse)

{

saveFileDialog1.ShowDialog();

if(saveFileDialog1.FileName!

="")

{

//SavestheImageviaaFileStreamcreatedbytheOpenFilemethod.

System.IO.FileStreamfs=

(System.IO.FileStream)saveFileDialog1.OpenFile();

//SavestheImageintheappropriateImageFormatbaseduponthe

//Filetypeselectedinthedialogbox.

//NOTEthattheFilterIndexpropertyisone-based.

switch(saveFileDialog1.FilterIndex)

{

case1:

picOutput.Image.Save(fs,System.Drawing.Imaging.ImageFormat.Jpeg);

break;

case2:

picOutput.Image.Save(fs,System.Drawing.Imaging.ImageFormat.Bmp);

break;

case3:

picOutput.Image.Save(fs,System.Drawing.Imaging.ImageFormat.Gif);

break;

}

fs.Close();

}

}

privatevoidcboFormat_SelectedIndexChanged(objectsender,EventArgse)

{

if(cboFormat.SelectedItem.ToString().Trim()=="MSI")

{

cboModulo.Visible=true;

if((cboModulo.SelectedItem.ToString()=="Modulo11")||(cboModulo.SelectedItem.ToString()=="Modulo1011")||(cboModulo.SelectedItem.ToString()=="Modulo1110"))

{

cboWeightType.Visible=true;

}

else

{

cboWeightType.Visible=false;

}

}

else

{

cboModulo.Visible=false;

cboWeightType.Visible=false;

}

}

privatevoidcboModulo_SelectedIndexChanged(objectsender,EventArgse)

{

if((cboModulo.SelectedItem.ToString()=="Modulo11")||(cboModulo.SelectedItem.ToString()=="Modulo1011")||(cboModulo.SelectedItem.ToString()=="Modulo1110"))

{

cboWeightType.Visible=true;

}

else

{

cboWeightType.Visible=false;

}

}

}

}

3.BarcodeInter2of5.cs:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.Text;

usingSystem.Drawing;

usingSystem.Text.RegularExpressions;

namespaceBarcoderLib

{

publicclassBarcodeInter2of5

{

privatestringgLeftGuard="1010";

privatestringgRightGuard="01101";

privatestring[]gOdd={"1011001","1101011","1001011","1100101","1011011","1101101","1001101","1010011","1101001","1001001"};

privatestring[]gEven={"0100110","0010100","0110100","0011010","0100100","0010010","0110010","0101100","0010110","0110110"}

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 表格模板 > 合同协议

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1