?? jbwait.c
字號:
void DispTalk(uint iTalkPointer) //顯示查詢話單
{
byte i;
memset(&aLargeBuf,0,20);
memcpy(&aDataBuf,&aNumBuf,16);
if(fDispTalkPointer){ //是否顯示話單序列號
for(i=10;i>3;i--)
aNumBuf[i]=aNumBuf[i-4];
if(aNumBuf[4]==0x0d)
aNumBuf[4]=0x0c;
i=0;
aNumBuf[i++]=iTalkPointer/100;
aNumBuf[i++]=(iTalkPointer/10)%10;
aNumBuf[i++]=iTalkPointer%10;
aNumBuf[i++]=0x0d;
}
pReadNumber=10;
DispNum(LargeLcd);
memcpy(&aNumBuf,&aDataBuf,16);
if(iTotalTime!=0){
DispTime(iTotalTime);
DispCharge(lTotalTariff,1);
DispCharge(lTotalTariff,2);
}
pReadNumber=pWriteNumber=0;
}
void DispBillTime(void)
{
// bool fFlag=0;
// if((aLargeBuf[0]&0x08)==0x08)
// fFlag=1;
memset(aLargeBuf,0,20);
aLargeBuf[0]|=aLCDSegment[aCallTime[MONTH]>>4];
// if(fFlag)
// aLargeBuf[0]|=0x08;
aLargeBuf[1]=aLCDSegment[aCallTime[MONTH]&0x0f];
aLargeBuf[2]=0x20;
aLargeBuf[3]=aLCDSegment[aCallTime[DAY]>>4];
aLargeBuf[4]=aLCDSegment[aCallTime[DAY]&0x0f];
aLargeBuf[5]=0;
aLargeBuf[6]=aLCDSegment[aCallTime[HOUR]>>4];
aLargeBuf[7]=aLCDSegment[aCallTime[HOUR]&0x0f];
aLargeBuf[8]=0x20;
aLargeBuf[9]=aLCDSegment[aCallTime[MINUTE]>>4];
aLargeBuf[10]=aLCDSegment[aCallTime[MINUTE]&0x0f];
DispOut();
}
/***********************************************************************
*
*
* 函 數 名: SaveDayTotal
* 說 明: 將日分項合計值寫入到ROM中的存儲區域
*
*
*
***********************************************************************/
void WriteDayTotal(void)
{
byte i;
byte bTemp;
AutoReadPara(78);
bParaByte++;
if(bParaByte>2){
if(fWorkMode)
iAddress=PARA_00;
else
iAddress=PARA_200;
ReadBytes(1,4);
iAddress-=4; //恢復到原來的值
if(aParaBuf[2]!=0){
memset(aParaBuf,0,4);
WriteData(1,iAddress,4,&aParaBuf);
}
bParaByte=0;
}
AutoWritePara(78);
Page(6);
if((aUserRTCBuf[MONTH]==XBYTE[0xc02c]) //防止因某種原因導致重復寫日分項
&&(aUserRTCBuf[DAY]==XBYTE[0xc02d])){
Page(5);
return;
}
iAddress=PARA_75;
if(!fWorkMode){
iAddress++; //若工作在老模式,則不取年
iAddress++;
}
for(i=0;i<21;i++){
Page(6);
bTemp=XBYTE[iAddress++]; //將日分項合計值填入到緩沖區aDataBuf中
Page(5);
aDataBuf[i]=bTemp;
}
Page(6);
i=XBYTE[PARA_71]; //取出日分項合計指針
if(fWorkMode){
if(i>31)
i=0;
iAddress=NEW_DAYTOTAL_ADDR+(uint)(i*21); //new mode
iPaNeNum=21;
if(++i>31)
i=0;
}
else{
if(i>14)
i=0;
iAddress=OLD_DAYTOTAL_ADDR+(uint)(i*16); //old mode
iPaNeNum=16;
if(++i>14)
i=0;
}
XBYTE[PARA_71]=i; //更新日分項合計指針
Page(5);
GeneralWriteData(iAddress);
Page(6);
XBYTE[0xc02a]=aUserRTCBuf[YEARH];
XBYTE[0xc02b]=aUserRTCBuf[YEARL];
XBYTE[0xc02c]=aUserRTCBuf[MONTH];
XBYTE[0xc02d]=aUserRTCBuf[DAY];
for(i=0,iAddress=0xc02e;i<17;i++,iAddress++)
XBYTE[iAddress]=0;
XBYTE[DateAddress]=aUserRTCBuf[YEARL];
if((XBYTE[DateAddress+2]!=aUserRTCBuf[DAY])||
(XBYTE[DateAddress+2]>0x31)){
XBYTE[DateAddress+2]=aUserRTCBuf[DAY];
for(i=0,iAddress=TodayIDDAddress;i<15;i++){
XBYTE[iAddress+i]=0x00;
}
}
if((XBYTE[DateAddress+1]!=aUserRTCBuf[MONTH])||
(XBYTE[DateAddress+1]>0x12)){
XBYTE[DateAddress+1]=aUserRTCBuf[MONTH];
for(i=0,iAddress=MonthIDDAddress;i<15;i++){
XBYTE[iAddress+i]=0x00;
}
}
Page(5);
}
void DispCurrentTime(void)
{
byte aTemp[4];
WaitRTC();
Page(6);
aTemp[0]=aLCDSegment[aRTCTime[4]>>4];
aTemp[1]=aLCDSegment[aRTCTime[4]&0x0f];
aTemp[2]=aLCDSegment[aRTCTime[2]>>4];
aTemp[3]=aLCDSegment[aRTCTime[2]&0x0f];
Page(5);
aSmallBuf[0]&=0x08;
aSmallBuf[1]&=0x08;
aSmallBuf[0]|=aTemp[0];
aSmallBuf[1]|=aTemp[1];
aSmallBuf[3]=aTemp[2];
aSmallBuf[4]=aTemp[3];
aLargeBuf[6]=aTemp[0];
aLargeBuf[7]=aTemp[1];
aLargeBuf[9]=aTemp[2];
aLargeBuf[10]=aTemp[3];
}
// End function: DispCurrentTime()
/*************************************************************
*
*
* Function: 在大顯示屏最頂上一行左邊顯示通話次數,
* 右邊顯示話費累計值
*
*
***************************************************************/
void DispTotal(byte bPage,bool fPlus3)
{
byte i;
ReadBytes(bPage,2);
iTotalTime=iParaWord;
ReadBytes(bPage,3);
lTotalTariff=lParaLWord;
if(fPlus3&&(!fWorkMode)){
for(i=0;i<3;i++){
ReadBytes(bPage,3);
lTotalTariff+=lParaLWord;
}
}
DispCharge(iTotalTime,3);
DispCharge(lTotalTariff,0);
}
/**************************************************************
*
* 顯示日分項合計值的月、日
* 使用aNumBuf[]作為緩存
*
**************************************************************/
void DispMD(byte bPage)
{
byte i,j;
Page(bPage);
aNumBuf[0]=aLCDSegment[XBYTE[iAddress]>>4]; //顯示日期
aNumBuf[1]=aLCDSegment[XBYTE[iAddress]&0x0f];
aNumBuf[2]=0x20;
aNumBuf[3]=aLCDSegment[XBYTE[iAddress+1]>>4];
aNumBuf[4]=aLCDSegment[XBYTE[iAddress+1]&0x0f];
Page(5);
for(i=19,j=0;j<5;i--,j++)
aLargeBuf[i]=aNumBuf[j];
}
byte ReadByte(uint iAddr,byte bPage)
{
byte i;
Page(bPage);
i=XBYTE[iAddr];
Page(5);
return(i);
}
void ReadBytes(byte bPage,byte bNum)
{
byte i;
Page(bPage);
switch(bNum){
case 1:
bParaByte=XBYTE[iAddress];
break;
case 2:
iParaWord=(uint)((XBYTE[iAddress])*256)
+XBYTE[iAddress+1];
break;
case 3:
lParaLWord=(ulint)((XBYTE[iAddress])*65536)
+(ulint)((XBYTE[iAddress+1])*256)
+XBYTE[iAddress+2];
break;
default:
for(i=0;i<bNum;i++)
aParaBuf[i]=XBYTE[iAddress+i];
break;
}
iAddress+=bNum;
Page(5);
}
void WriteOut(uint iAddr,byte bData)
{
Page(6);
XBYTE[iAddr]=bData;
Page(5);
}
void Open(byte bWhich)
{
OutBuf|=bWhich;
WriteOut(OUT_CE,OutBuf);
}
void Close(byte bWhich)
{
OutBuf&=~bWhich;
WriteOut(OUT_CE,OutBuf);
}
bool KeyProcess(void)
{
InBuf=ReadByte(IN_CE,6)&0xf0;
if(bEnterFlag==0x69){
bEnterFlag=0x00;
return FALSE;
}
bStatusWord=S_SERVICE;
switch(InBuf){
case K1: // Display All Lcd Segment
DispAllSegment();
break;
case K2: // Call PC
EX0=1;
bStatusWord=S_SERIALCOMM;
return TRUE;
case K3: // Clear Total Accumulate Data
ClrStatData();
break;
/*
EX0=1; // 打開秒中斷
bStatusWord=S_SERVICE;
return TRUE;
*/
case K4: // Display Software Version & Adjust Print Format
DispVersion();
break;
case K12: // Send All Data via Serial Port
DispComm(0);
SendAll(0);
ExitUart();
break;
case K13: // Send All Data & Clear Internal Ram
DispComm(1);
SendAll(1);
ExitUart();
break;
case K23: // Send Clock Data
DispComm(2);
SendClock();
ExitUart();
break;
case K14: // Receive Data via Serial Port
DispComm(3);
RecvAll();
if(bDlpReason!=0) return TRUE; // 轉入串口程序下載過程
ExitUart();
break;
case K24: // Set Old Adjust Control Parameter
SetControlParameter();
DispOK(3);
break;
case K34: // Renew Password for Clr Total Data
if(!InPutPassWord(2))
DispErrorCode();
else
DispOK(3);
break;
case K124: // Input SSd Password & Set SSd Control Parameter
SetSSd();
break;
case K123: // Adjust Print Move Distance
SetPrnPaper();
break;
default:
bStatusWord=S_HARDWAREINIT;
bEnterFlag=0x00;
return FALSE;
}
bStatusWord=S_HARDWAREINIT;
return TRUE;
}
byte code aCommCode[][3]={"SA ","SAC","SC ","RD "};
void DispComm(byte bNum)
{
memcpy(&aLargeBuf,&aCommCode[bNum],3);
if(bNum!=3)
aLargeBuf[10]=bNum+48;
ConvertCode();
DispSymbol(LARGE_COMM);
}
void SetPrnPaper(void)
{
aLargeBuf[0]='P';
aLargeBuf[1]='R';
aLargeBuf[2]='N';
aLargeBuf[3]='-';
ConvertCode();
AutoReadPara(73);
while(1){
IDLE;
aLargeBuf[4]=aLCDSegment[bParaByte/100];
aLargeBuf[5]=aLCDSegment[(bParaByte%100)/10];
aLargeBuf[6]=aLCDSegment[bParaByte%10];
DispOut();
if(fKey){
fKey=0;
switch(bKeyBuf){
case K1:
cbKey=10;
AutoWritePara(73);
TestPrinter();
AutoReadPara(73);
break;
case K2:
if(cbKey>199)
cbKey=180;
bParaByte--;
break;
case K3:
if(cbKey>199)
cbKey=180;
bParaByte++;
break;
case K4:
AutoWritePara(73);
DispOK(3);
return;
}
}
}
}
byte code aSSd[3][3]={"SSD","XJ ","ZJ "}; // SSd Data
byte code aSSdLocation[3]={0x04,0x10,0x80}; // location of the control word
byte code aOldCont[][3]={"FDD","No","BhY","FPU","cDY"}; //
byte code aOldContLoc[]={0x01,0x02,0x08,0x20,0x40};
byte code aNewCont[][3]={"FDD","No","BhY","FPU","cDY"}; //
byte code aNewContLoc[]={0x01,0x02,0x04,0x08,0x10};
byte code aOnOff[2][4]={"-oFF","-oN "};
void SetSSd(void)
{
if(fWorkMode)
return;
if(!InPutPassWord(3)){
DispErrorCode();
return;
}
AutoReadPara(51);
SetParameter(3,SSD);
AutoWritePara(51);
DispOK(3);
}
void SetControlParameter(void)
{
byte bTemp=0;
if(fWorkMode){
AutoReadPara(46);
if(bParaByte!=0)
bTemp|=0x01;
AutoReadPara(45);
if(bParaByte!=0)
bTemp|=0x02;
AutoReadPara(44);
if(bParaByte!=0)
bTemp|=0x04;
AutoReadPara(43);
if(bParaByte!=0)
bTemp|=0x08;
AutoReadPara(31);
if(iParaWord!=400)
bTemp|=0x10;
bParaByte=bTemp;
SetParameter(5,NEW_CONTROL_PARA);
bTemp=bParaByte;
if((bTemp&0x01)!=0)
bParaByte=1;
else
bParaByte=0;
AutoWritePara(46);
if((bTemp&0x02)!=0)
bParaByte=1;
else
bParaByte=0;
AutoWritePara(45);
if((bTemp&0x04)!=0)
bParaByte=1;
else
bParaByte=0;
AutoWritePara(44);
if((bTemp&0x08)!=0)
bParaByte=1;
else
bParaByte=0;
AutoWritePara(43);
if((bTemp&0x10)!=0)
iParaWord=320;
else
iParaWord=400;
AutoWritePara(31);
}
else{
AutoReadPara(51);
SetParameter(5,OLD_CONTROL_PARA);
AutoWritePara(51);
}
}
void SetParameter(byte bLen,byte bWhich)
{
bool fFirstKey=0;
byte bTemp;
byte bStatus=0;
byte bOnOff;
byte code *p;
while(1){
switch(bWhich){
case SSD:
p=&aSSd[bStatus];
bTemp=aSSdLocation[bStatus]; //location of the control word
break;
case OLD_CONTROL_PARA:
p=&aOldCont[bStatus];
bTemp=aOldContLoc[bStatus];
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -