完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
|
相关推荐
13 个讨论
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PCB 的尺寸图也上传;希望快些拿到IC 哦
|
|
|
|
|
|
|
|
|
|
|
|
终于可以松口气了,不过我们是把帖片的IC 用夹具转换 成DIP 了,呵呵, 这点很给力啊。还好多研究了以下, 现在调试差不多了, 这两天就上图。瞧瞧
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
读卡源码:
/* ****************************************************************************************** //函数名称:uchar fun_RF_Check(void) //调用函数: no //功能: 探测IC 卡 //入口参数:. //出口参数: //修改记录: //日期: ******************************************************************************************* */ uchar fun_RF_Check(void) { uchar st; static bit Find_IC =FALSE; if(bufTime.RF_Cnt <2) //_10*8ms return 1; bufTime.RF_Cnt =0; OE_OFF(); if( !Find_IC) { init_fm1702nl(); } for(st =0; st<6; st++) { KeyB[st] =bufRF.syskey[st] ; } //bufWork.Find_IC_State =CON_IC_STATE_0; fanNo =bufRF.fanNo; //读CON_ADDR_FAN号扇区数据 st=FindCard(&serial_num[0]); if(st!=MI_OK) { bufRF.money.sum=0; bufWork.IC_Coin_Judge =0; bufFlag.BB.SaveRF_Money =FALSE; bufFlag.BB.RF_WriteKey =FALSE; Find_IC =FALSE; for(st=0;st<5;st++) bufRF.sn[st]=0; return 1; } Find_IC =TRUE; bufWork.Find_IC_State =CON_IC_STATE_0; st=ChPwd(fanNo,&serial_num[0]); if(st!=MI_OK) return 2; if(bufFlag.BB.RF_WriteKey ) { //写卡密码块3 st=Write_RF_Key(fanNo ); if(st==MI_OK) { for(st =0; st<6; st++) bufRF.syskey[st]= bufRF.newkey[st]; } else bufWork.Find_IC_State =CON_IC_STATE_Error8; bufFlag.BB.RF_WriteKey =FALSE; } else { st= Read_RF_Key(fanNo ); if(st !=MI_OK) { bufWork.Find_IC_State =CON_IC_STATE_Error9; return 2; } } if(bufFlag.BB.SaveRF_Money) { //写卡数据块0,1,2 st=write_RF_Money(fanNo ); if(st!=MI_OK) bufWork.Find_IC_State =CON_IC_STATE_Error6; bufFlag.BB.SaveRF_Money =FALSE; } else { st=read_RF_Money(fanNo ); if(st !=MI_OK) { bufWork.Find_IC_State =CON_IC_STATE_Error7; return 2; } } for(st=0;st<5;st++) { bufRF.sn[st]=serial_num[st]; } if(bufWork.IC_Coin_Judge ==0) { findIC_send_char(); } bufWork.IC_Coin_Judge =CON_IC_OK; bufFlag.BB.GS=TRUE; bufTime.GS_Delay=0; return MI_OK; } |
|
|
|
|
|
显示源码:
static idata uchar Money[4]=0; static idata uchar Water[4]=0; static idata uchar Mdot[4]=0; static idata uchar Wdot[4]=0; //============================================================================ //============================================================================ //函数名称:void seg_driver( uchar code ) //功能:4094串行数据 (8位) //入口参数:1. 串行数据 //出口参数:无 //日期: //============================================================================= void Seg_driver( uchar SegData ) { uchar count; OE_OFF() ; DATA_ON(); for ( count = 0; count < 8; count ++ ) //8bits { if ( (SegData & 0x80)) { DATA_OFF(); } else { DATA_ON(); } CLK_OFF(); NOP(); CLK_ON(); SegData <<=1; } OE_ON() ; } //============================================================================ //函数名称:void fun_led_display (void) //功能: //入口参数: //出口参数:无 //日期:2006/10/10 //============================================================================= void fun_display (void) { static uchar ScanCnt=0; if(bufTime.Dsp_Delay <2) return ; bufTime.Dsp_Delay =0; COM_OFF(); switch ( ScanCnt) { case 0: //Money千位 COM_8_ON(); if (Money[3] ==0 ) { Seg_driver(0x00); } else { Seg_driver(LEDDispCode[Money[3]] |Mdot[3]); } break; case 1: //Money百位 COM_7_ON(); if( Money[3] ==0&&Money[2]==0&&bufWork.IC_Coin_Judge ==0) { Seg_driver(0x00); } else { Seg_driver(LEDDispCode[Money[2]] |Mdot[2]); } break; case 2: //Money十位 COM_6_ON(); if( Money[3] ==0&&Money[2]==0&&Money[1]==0&&bufWork.IC_Coin_Judge ==0) { Seg_driver(0x00); } else { Seg_driver(LEDDispCode[Money[1]] |Mdot[1]); } break; case 3: //Money个位 COM_5_ON(); if( Money[3] ==0&&Money[2]==0&&Money[1]==0&&Money[0]==0&&bufWork.IC_Coin_Judge ==0) { Seg_driver(0x00); } else { Seg_driver( LEDDispCode[Money[0]] |Mdot[0]) ; } break; case 4: COM_4_ON(); Seg_driver(LEDDispCode[Water[3]]|Wdot[3]) ; break; case 5: COM_3_ON(); Seg_driver(LEDDispCode[Water[2]]|Wdot[2]) ; break; case 6: COM_2_ON(); Seg_driver(LEDDispCode[Water[1]] |Wdot[1]) ; break; case 7: COM_1_ON(); Seg_driver(LEDDispCode[Water[0]]|Wdot[0]) ; break; case 8: bufTime.RF_Cnt++; default: break; } if(++ScanCnt>=9) { ScanCnt=0; } } //============================================================================ //函数名称: MoneyWater_Cal(void) //功能: //入口参数: //出口参数:无 //日期:2006/10/10 //============================================================================= void Money_Calculate(float m) { uint x,y; if( m <100.0) { Mdot[3] = 0x00; Mdot[2] = 0x80; Mdot[1] = 0x00; Mdot[0] = 0x00; m = m *100; } else if ( m <1000) { Mdot[3] = 0x00; Mdot[2] = 0x00; Mdot[1] = 0x80; Mdot[0] = 0x00; m = m *10; } else if (m <10000) { Mdot[3] = 0x00; Mdot[2] = 0x00; Mdot[1] = 0x00; Mdot[0] = 0x80; m = m *1; } else { Mdot[3] = 0x00; Mdot[2] = 0x00; Mdot[1] = 0x00; Mdot[0] = 0x00; m = m *0.1; } Money[3] = (uint) (m)/1000; x = (uint) (m) %1000; Money[2] = x/100; y= x %100; Money[1] = y/10; Money[0] = y%10; } void find_IC_error_dsp_e111 (void) { Money[3] =16;//dsp "_ _ _ _" Money[2] =16; Money[1] =16; Money[0] =16; Mdot[3]= 0x00; Mdot[2]= 0x00; Mdot[1]= 0x00; Mdot[0]= 0x00; } void find_IC_error_dsp (uchar IC_state) { Money[3] =14;//dsp "E" Money[2] =IC_state%1000/100; Money[1] =IC_state%1000%100/10; Money[0] =IC_state%1000%100%10; Mdot[3]= 0x00; Mdot[2]= 0x00; Mdot[1]= 0x00; Mdot[0]= 0x00; } void RF_fan_block_dsp (void) { Water[3] =0x0F; // display "F" Water[2] =bufRF.fanNo; //_1---15 Water[1] =0x0B;//display "b" Water[0] =bufRF.blockNo; //_0---2 Wdot[3]= 0x00; //Wdot[2]= 0x80; Wdot[1]= 0x00; //Wdot[0]= 0x80; if(bufWork.Menu1_1==1) { Wdot[2]= 0x80; Wdot[0]= 0x00; } else if(bufWork.Menu1_1==2) { Wdot[2]= 0x00; Wdot[0]= 0x80; } else { Wdot[2]= 0x80; Wdot[0]= 0x80; } } //============================================================================ //函数名称:void seg_driver( uchar code ) //功能:164串行数据 (8位) //入口参数:1. 串行数据 //出口参数:无 //日期: //============================================================================= void fun_menu_dsp(void) { if (bufTime.Cal_Delay<50) return; bufTime.Cal_Delay=0; WatchDog_Reset(); if(bufFlag.BB.Sys_Rst) { Money[3] =Money[2] =Money[1] =Money[0] =8; Mdot[3]= Mdot[2]= Mdot[1]= Mdot[0]= 0x80; Water[3] =Water[2] =Water[1] =Water[0] =8; Wdot[3]= Wdot[2]= Wdot[1]= Wdot[0]= 0x80; } else { RF_fan_block_dsp(); if ( bufWork.Find_IC_State ==111 ) { find_IC_error_dsp_e111(); } else if ( bufWork.Find_IC_State >0 ) { find_IC_error_dsp (bufWork.Find_IC_State); } else if( bufWork.IC_Coin_Judge ==CON_IC_OK) { Money_Calculate(bufRF.money.sum); } else if (bufWork.Menu1_1>0) { //IC充值,扣款 Money_Calculate(bufRF.money.sum); } else { // bufWork.SysKeyCnt =0; bufFlag.BB.RunLimitKey_OK =FALSE; bufFlag.BB.Sys_WriteICMoney_Key =FALSE; Money_Calculate(bufRF.money.sum); } } } |
|
|
|
|
|
只有小组成员才能发言,加入小组>>
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-22 04:00 , Processed in 0.647830 second(s), Total 73, Slave 60 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号