资源描述:
《基于pic单片机的火车数据记录仪的程序》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、;基于PIC16F877火车数据记录仪程序INDFEQU0HTMR0EQU1HPCLEQU2HSTATUSEQU3HFSREQU4HRAEQU5HRBEQU6HRCEQU7HR0EQU8HR1EQU9HR2EQU0AHR3EQU0BHR4EQU0CHR5EQU0DHR6EQU0EHR7EQU0FH;***************************************CEQU0DCEQU1ZEQU2PDEQU3TOEQU4PS0EQU5PS1EQU6PS2EQU7;***************************************ORG00HGOTOStart;000Wr
2、iteByteTo256:MOVWF1DHBTFSC1AH,1GOTOStartCALLIICStartConditionMOVF1AH,WMOVWF1EHRLF1BH,WRLF1EH,FRLF1EH,FMOVLW00EHANDWF1EH,FMOVLW0A0HADDWF1EH,WCALLWriteIICWMOVF1BH,WANDLW07FHCALLWriteIICWMOVF1CH,WCALLWriteIICWMOVF1DH,WCALLWriteIICWCALLIICStopConditionCALLDelay6.5msINCFSZ1CH,FRETLW000HINCFSZ1BH,FRETLW0
3、00HINCF1AH,FBTFSC1AH,1GOTOStartRETLW000HIICStartCondition:IICSC020:BSFRB,4GOTOIICSC022IICSC022:BSFRB,5GOTOHIICSC024HIICSC024:GOTOIICSC025IICSC025:GOTOIICSC026IICSC026:BCFRB,4GOTOIICSC028IICSC028:GOTOIICSC029IICSC029:GOTOIICSC02AIICSC02A:BCFRB,5RETLW000HIICStopCondition:IICSTC02C:BCFRB,4GOTOIICSTC02
4、EIICSTC02E:GOTOIICSTC02FIICSTC02F:BSFRB,5GOTOHIICSTC031HIICSTC031GOTOIICSTC032IICSTC032:GOTOIICSTC033IICSTC033:BSFRB,4GOTOIICSTC035IICSTC035:GOTOIICSTC036IICSTC036:GOTOIICSTC037IICSTC037:BCFRB,5RETLW000HWriteIICW:WIICW039:MOVWFR6MOVLW008HMOVWFR7WIICW03C:BCFRB,4;SDABTFSCR6,7BSFRB,4GOTOWIICW040WIICW0
5、40:BSFRB,5;SCLRLFR6,FGOTOHWIICW43HWIICW43:GOTOWIICW044WIICW044:BCFRB,5DECFSZR7,FGOTOWIICW03CMOVLW01EHTRISRB;waittoacknowledgeGOTOWIICW04AWIICW04A:GOTOWIICW04BWIICW04B:BSFRB,5GOTOHWIICW4DHWIICW4D:GOTOWIICW04EWIICW04E:BTFSSRB,4GOTOWIICW052;acknowledge-->BSFSTATUS,PS2GOTOStart;noacknowledge-->WIICW052
6、:BCFRB,5MOVLW00EHTRISRB;tobereadyRETLW000HReadIICByteTo1DH:MOVLW01EHTRISRBMOVLW008HMOVWFR7ReadByte105A:BSFRB,5RLF1DH,FGOTOReadByte105DReadByte105D:BCF1DH,0BTFSCRB,4BSF1DH,0GOTOReadByte1061ReadByte1061:BCFRB,5GOTOReadByte1063ReadByte1063:GOTOReadByte1064ReadByte1064:DECFSZR7,FGOTOReadByte105AMOVLW00
7、EHTRISRBNOPBSFRB,4GOTOReadByte106BReadByte106B:GOTOReadByte106CReadByte106C:BSFRB,5GOTOReadByte106EReadByte106E:GOTOReadByte106FReadByte106F:GOTOReadByte1070ReadByte1070:BCFRB,5RETLW000HGet232ByteTo1DH:MOVL