⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 560.h

📁 本程序为某企业的税控机固件程序.基于东芝TMP93CS41 16位单片机编写,符合国家标准.该程序已经经过多次长期调试.
💻 H
字号:
#include "io900l.h"
#include "stdlib.h"
#include "sic.h"
#include "ioc.h"
#include "int.h"
#include "timer.h"
#include "vec.h"
#include "wdt.h"
#include "int.h"
#include "const.h"


#define	information 	0x1FD00
/*税控卡*/
#define	fiscal_information	information	
#define tsamno		fiscal_information		//8	税控卡编号
#define tmachno		fiscal_information+8 		//8	税控收款机机器编号
#define tuserno		fiscal_information+16		//8	纳税人编码
#define tuserid		fiscal_information+24		//20	纳税人识别号
#define tstart_data	fiscal_information+44		//4	应用启用日期
#define teffect_data	fiscal_information+48		//4	应用有效日期
#define tappbs		fiscal_information+52		//1	应用类型标识
#define tapp_edition	fiscal_information+53		//1	应用版本
#define tFCI		fiscal_information+54		//1	发卡方自定义FCI数据
#define tusername	fiscal_information+55		//40	纳税人单位名称
#define tchargeno	fiscal_information+95		//4	主管分局代码
#define tdeclare	fiscal_information+99		//1	申报方式
#define tpsbs		fiscal_information+100		//1	税控收款机使用口令标志
/*用户卡*/
#define umachnum	fiscal_information+101 		//1	税控收款机数量
#define uuserno		fiscal_information+102		//8	纳税人编码
#define ustart_data	fiscal_information+110		//4	应用启用日期
#define ueffect_data	fiscal_information+114		//4	应用有效日期
#define uappbs		fiscal_information+118		//1	应用类型标识
#define uapp_edition	fiscal_information+119		//1	应用版本
#define uFCI		fiscal_information+120		//1	发卡方自定义FCI数据
#define uusername	fiscal_information+121		//40	纳税人单位名称

#define	machno		fiscal_information+161          //8  生产机器号
#define first_pin	fiscal_information+169		//8  pin存放地址
#define	userpin		fiscal_information+178		//8  用户卡的pin存放地址

//--------------------------------------//
#define taxindex	0x1FE00
#define taxitem_index	taxindex		//1	税种税目索引号
#define taxitem		taxindex+1		//4	经营税种项目代码
#define taxitem_rate	taxindex+5		//2	税率
#define taxitemcname	taxindex+7		//20	经营项目中文名称
#define taxitemename	taxindex+27		//20	经营项目英文名称

//--------------------------------------//
#define	taxreg		0x20100
#define hardedition	taxreg			//2   	硬件版本号
#define softedition	taxreg+2 		//2   	软件版本号
#define hold		taxreg+4 		//50  	保留字节
//分户信息 共计:128*2 = 256
#define disshop		0x20200
#define disshopnum	disshop		//2 byte 分户数量
#define disshopno1	disshop+2	//2 byte 分户编码1
#define disshopno2	disshop+7	//2 byte 分户编码2
//#define	curdpsl		taxreg           	//2 	单品总数量                       
//#define	curblsl		taxreg+2             	//1 	部类总数量
//#define	barnum		taxreg+3            	//2 	有条码的单品     
//#define	ipadr		taxreg+5              	//1 	商店机器自编号,联网用
//#define	pfomat      	taxreg+6              	//1 	发票的打印方式
//#define hardedition	taxreg+7 		//2   	硬件版本号
//#define softedition	taxreg+9 		//2   	软件版本号
//#define hold		taxreg+11 		//50  	保留字节
//
//#define	blinfo	    	taxreg+61    		//	部类信息首地址
//#define	dpinfo	    	blinfo+920	     	//	单品信息首地址

//下面是在第二片flash中的
//==============税目索引================//
#define	admin		0x82100               //4 管理员密码(默认:0)
/****************I2C中发票明细数据********************/
//I2c
#define			I2cMiXi_Star		0x0000	//I2c销售明细起始地址
#define			I2cMiXi_End		0x7FFF	//I2c销售明细结束地址
/****************申报数据********************/
//Flash
#define			Declare_Star		0x82200//0x9B000//10k  申报数据??question
#define			Declare_End		Declare_Star+0x2800
						//0x82300--0x84B00
/****************发票卷数据********************/
#define			Volume_Star		Declare_Star+0x2800//12k 发票卷使用汇总数据
#define			Volume_End		Declare_Star+0x5800//0x535c  check
						//0x84B00--0x87B00
/****************日交易数据********************/
#define			Daily_Star		Declare_Star+0x5800//350k 日交易累计数据
#define			Daily_End		Declare_Star+0x5CF80 //0x64300 check 
						//0x87B00--0xDF300
						//0xf8084--0xf80c6
/****************FLASH中发票明细数据********************/
#define			FlashMiXi_Star		0xDF500//0x180000//1.5m 销售明细存放地址
						//0xE8000   check begin
						//0x148000  check end
#define			FlashMiXi_End		0x2CFFFF
						//0xDF400--0x300000
/****************审计核查数据********************/
#define 		Audit_Star		0x2D0000	/*审计信息191K*/
#define 		Audit_End		0x2FFFFF
						
/****************************************/
/*FM24256*/
#define FM24256Star	0x10000
#define P_FlashMiXi	FM24256Star			/*4 byte  Flash中销售明细指针*/
#define P_Declare	FM24256Star+0x04		/*4 byte  Flash中申报数据指针*/
#define P_Volume	FM24256Star+0x08		/*4 byte  Flash中卷信息指针*/
#define P_Daily		FM24256Star+0x1C		/*4 byte  Flash中日交易累计指针*/
#define P_I2cMiXi	FM24256Star+0x20		/*2 byte  I2c中销售明细指针*/
#define invcount	FM24256Star+0x22		/*1 byte  发票记数器,销售明细中用  2004-9-29 18:38*/
#define data1287	FM24256Star+0x23		/*3 byte  12887中数据的日期*/ 
#define pincode		FM24256Star+0x26		/*8 byte  Sam卡的pin码*/
#define Save_adr	FM24256Star+0x2E		/*2 byte  最新一卷发票分发后存放的地址*/
#define acash		FM24256Star+0x32		/*4 byte  开票累计总金额(程序控制)*/
#define tcash		FM24256Star+0x36		/*4 byte  退票累计总金额(程序控制)*/

#define volume_flag	FM24256Star+0x3A		/*1 byte  卷标志,换卷时置1,在一张发票开成功后清0*/
#define volume_count	FM24256Star+0x3B		/*1 byte  使用发票卷数计数器,每次sale完一卷更新(发票验旧时用)*/
#define limit_date	FM24256Star+0x3C		/*4 byte  开票截至日期(明文)*/
#define scash_limit	FM24256Star+0x40		/*4 byte  单张开票限额*/
#define acash_limit	FM24256Star+0x44		/*4 byte  开票累计限额*/
#define tcash_limit	FM24256Star+0x48		/*4 byte  退票累计限额*/
#define tax_index	FM24256Star+0x4c		/*6 byte  税种税目索引号*/
#define Declar_Sc_Flag	FM24256Star+0x52		/*1 byte  申报标示和密钥标示符*/
#define break_flag_add	FM24256Star+0x53		/*1 byte  断电标志.00-正常,01-datacarry(),02-sale_checkout(废票)04-Invoice_Distribute() error)*/
							/*   08-Daily_Collect(),10-sale_checkout(退票)*/
#define volume_print	FM24256Star+0x54		/*1 byte  卷信息打印标志(0:没有打印,1:已打印)*/
#define lockmac		FM24256Star+0x55		/*1 byte  lock machine sign*/
							/*01 - 申报锁机;02 - PIN验证错误锁机*/
#define break_point	FM24256Star+0x56		/*4 byte   断电指针,Datacarry()中*/
#define lock_date	FM24256Star+0x5A		/*3 byte  日交易数据满5年锁机日期*/
#define invoce_code	FM24256Star+0x5D		/*1150 byte  存放分发的发票号码1+10+4+4+4*/

#define Audit_Common	0x10700 			/*4byte 审计指针*/

//------------------------------------------------------------------------------------------------//
union gyt4
{
	unsigned long pr;
	unsigned char str[4];
};

union gyt3	//使用时,为防止未用的高位字节影响数值,必须先赋值为0!!!
{
	unsigned long pr;
	unsigned char str[3];
};		//为防止数据丢失,long型数据不能大于16777214

union gyt2
{
	unsigned int pr;
	unsigned char str[2];
};

extern unsigned char no_invoice_flag;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -