HCS编码
|
||||
---|---|---|---|---|
初級會員
|
有一个案子,要用PIC12F629模拟HCS301.哪位知道这个编码是怎么编的.谢谢!可有参考程式.
發表於: 2008/10/10 16:03
|
|||
|
关于PIC模拟报警声音的问题
|
||||
---|---|---|---|---|
初級會員
|
请问用PIC模拟六声报警声音程式要怎么做,比如模拟RT0608这个要怎么写?谢谢指教!!
發表於: 2005/6/17 12:03
|
|||
|
Re: 关天PIC16C54定时器的问题
|
||||
---|---|---|---|---|
初級會員
|
如果在定时期间要做其它事情要怎么弄??
發表於: 2005/5/8 10:06
|
|||
|
关天PIC16C54定时器的问题
|
||||
---|---|---|---|---|
初級會員
|
PIC16C54定时器没有中断,只能是查最高位有没有溢出!
我要在定时的期间做其它事情,请问程序要怎么写?以下这样写为什么不行? loop clrwdt clrf tmr0 loop1 BTFSC PORTA,GP2 ;是否有信号输入 GOTO MAIN ;有信号,到别的地方去, btfss tmr0,7 ;查定时器的第七位有没有溢出,有溢出表时定时器满了 goto loop1 ;还没到,继续去查 rtelw 0
發表於: 2005/5/7 22:30
|
|||
|
Re: 關於FM接收IC MC3362
|
||||
---|---|---|---|---|
初級會員
|
3361 3362在无绳电话与对讲机上面应用很广,可以参考相关电路的.....
發表於: 2005/5/7 11:56
|
|||
|
Re: 请教 RF 315M,433M 之 EV1527接收解码
|
||||
---|---|---|---|---|
初級會員
|
其实你只要看波形就可以解码了...发表一个程序给你看看:
;=============================================== ; Auther : RATO (RTI-063) RECEIVE SOFT ; Modify Date: 03-28-2001 ; Defaule : PIC16C57C main clock = 4MHZ ;=============================================== ; P=16C57C ; PIC16C57 is the target processor #include "p16c5x.inc" ; Include header file ; ; Define Page Base-Address for Program-Memory used PAGE_0 equ 0x00 PAGE_1 equ H'0200' PAGE_2 equ H'0400' PAGE_3 equ H'0600' ;Define Reset Vectors PIC54 equ H'01FF' PIC55 equ H'01FF' PIC56 equ H'03FF' PIC57 equ H'07FF' ResetVector equ PIC57 ; Define Special Register INDF equ 0x00 RTCC equ 0x01 PCL equ 0x02 STATUS equ 0x03 ; F3 Reg is STATUS Reg. FSR equ 0x04 PORT_A equ 0x05 ; I/O Port-A Assignment PORT_B equ 0x06 ; I/O Port-B Assignment PORT_C equ 0x07 ; I/O Port-C Assignment ; Define STATUS Register Bits C equ 0x00 ; Carry Bit is Bit.0 of F3 DC equ 0x01 Z equ 0x02 ; Zero Bit is Bit.2 of F3 PD equ 0x03 TO equ 0x04 PA0 equ 0x05 ;16C5X Status bits PA1 equ 0x06 ;16C5X Status bits ; Define OPTION register bits PS0 equ 0x00 PS1 equ 0X01 PS2 equ 0x02 PSA equ 0x03 TOSE equ 0x04 TOCE equ 0x05 ;======Define======== W equ 0x00 F equ 0x01 null equ 0x00 ; #DEFINE CS PORTA,0 #DEFINE CLK PORTA,1 #DEFINE DIO PORTA,2 #DEFINE RFIN PORTA,3 ; #DEFINE LRNLED PORTB,5 #DEFINE LRNKEY PORTB,0 #DEFINE K0 PORTB,1 #DEFINE K1 PORTB,2 #DEFINE K2 PORTB,3 #DEFINE K3 PORTB,4 #DEFINE SP PORTB,6 ; #DEFINE STR PORTC,0 #DEFINE D_FF PORTC,1 #DEFINE CK PORTC,2 ; ;++++++++++++++++++++++++++++++++++++++++ ; Define BANK_0 Register for Program used. ;++++++++++++++++++++++++++++++++++++++++ JUMP_F equ 0x08 FLAG equ 0x09 #DEFINE KEYRP FLAG,7 #DEFINE RECERR FLAG,5 #DEFINE LRN_F FLAG,6 #DEFINE RE_LRN FLAG,4 #DEFINE TMP FLAG,2 ;------------------------ TCNT0 equ 0x0A TCNT10 equ 0x0B TCNT11 equ 0x0C BIT_CNT equ 0x0D DELAY_DATA equ 0x0E RTCNTL equ 0x0F RTCNTH equ 0x10 H_LEVEL equ 0x11 ; high pulse duration L_LEVEL equ 0x12 ; low pulse duration RECB33B40 equ 0x13 RECB25B32 equ 0x14 RECB17B24 equ 0x15 RECB09B16 equ 0x16 RECB01B08 equ 0x17 H_TIME equ 0x18 L_TIME equ 0X19 TEMP equ 0X1A R1 equ 0X1C R2 equ 0X1D TMP7 equ 0x1E OUTBYT equ 0x1F KEYFLAG EQU 0X1B DECR3340 EQU H_TIME DECR2532 EQU L_TIME DP_Index equ DELAY_DATA RD1 EQU BIT_CNT RD2 EQU R1 LD1 EQU R2 LD2 EQU DELAY_DATA R7 EQU BIT_CNT d0 EQU H_TIME d1 EQU L_TIME pd33d40 EQU R1 pd25d32 EQU R2 pd17d24 EQU OUTBYT pd09d16 EQU H_TIME pd01d08 EQU L_TIME catch_time EQU JUMP_F ADDR3340 EQU 0X30 ADDR2532 EQU 0X31 ADDR1724 EQU 0X32 ADDR0916 EQU 0X33 ADDR0108 EQU 0X34 DEC3340 EQU 0X35 DEC2532 EQU 0X36 ; ;----- EEPROM REGISTER DEFINE ------- TMP1 EQU H_LEVEL TMP2 EQU L_LEVEL EEPADDR EQU DELAY_DATA #DEFINE R1_FLAG JUMP_F,4 #DEFINE R2_FLAG JUMP_F,5 #DEFINE R3_FLAG JUMP_F,6 #DEFINE R4_FLAG JUMP_F,7 ; TRISBWR EQU B'11111000' TRISBRD EQU B'11111100' IDCODE EQU B'01001001' ;=============================================== ; PAGE-0 BASE-EEPADDR FOR PROGRAM MEMORY ;=============================================== ORG 0X00 GOTO RESET0 ;=============================================== TST_TIME0 BSF STATUS,PA0 CALL TST_TIME1 BCF STATUS,PA0 RETLW 00H ;=============================================== INIT_PRO INIT_PORT MOVLW B'00000110' ;Fop/128 to rtcc OPTION MOVLW B'00000000' TRIS PORTC CLRF PORTA MOVLW B'00000011' TRIS PORTB MOVLW B'00111100' MOVWF PORTB MOVLW B'1000' ;clr all output TRIS PORTA MOVLW TRISBRD TRIS PORTA MOVLW 0XFF MOVWF TMP7 MOVLW 0X02 MOVWF catch_time RETLW 00H ;=============================================== RESET0 CALL INIT_PRO ;after reset RESET_ALL CLRF TCNT0 CLRF KEYFLAG BCF TMP CLRF TEMP CLRF JUMP_F ;=============================================== CLRF RTCC KEYSCAN KEYSCAN_CO CLRF TCNT0 BTFSS LRNKEY GOTO $+3 BSF STATUS,PA0 GOTO TEST_LRN MOVLW 0X02 MOVWF catch_time BSF STATUS,PA0 GOTO RECEIVE0 SCEND GOTO KEYSCAN_CO ;************************************************ ORG 200H ;================================================ TST_TIME1 TST_RTCCP1 CLRWDT BTFSS RTCC,7 RETLW 00H BCF RTCC,7 INCF TCNT0,F INCFSZ TCNT10,F GOTO INC_RTIME2 INCF TCNT11,F INC_RTIME2 INCFSZ RTCNTL,F RETLW 00H INCF RTCNTH,F RETLW 00H ;----------------------------------------------- SENDC CLRWDT MOVLW B'11111000' ANDWF PORTA,F MOVLW TRISBWR S1 TRIS PORTA GOTO $+1 BSF CS BSF STATUS,C MOVLW .9 MOVWF BIT_CNT SENDC2 SKPC BCF DIO SKPNC BSF DIO GOTO $+1 RLF OUTBYT,F BSF CLK GOTO $+1 GOTO $+1 BCF CLK DECFSZ BIT_CNT,F GOTO SENDC2 BCF DIO BTFSC R1_FLAG GOTO SENDC_R1 BTFSC R2_FLAG GOTO SENDC_R2 BTFSC R3_FLAG GOTO SENDC_R3 GOTO SENDC_R4 ;------------------------------------------------ EECLEAR CLRF TMP1 CLRF TMP2 EEWRITE MOVLW 30H ;EEPROM WRITE ENABLE MOVWF OUTBYT CLRF JUMP_F BSF R1_FLAG GOTO SENDC SENDC_R1 BCF CS WRITE1 MOVFW EEPADDR MOVWF OUTBYT BSF OUTBYT,6 CLRF JUMP_F BSF R2_FLAG GOTO SENDC SENDC_R2 MOVLW .16 MOVWF BIT_CNT WRITE2 BTFSS TMP1,7 BCF DIO BTFSC TMP1,7 BSF DIO GOTO $+1 RLF TMP2,F BSF CLK GOTO $+1 RLF TMP1,F BCF CLK DECFSZ BIT_CNT,F GOTO WRITE2 BCF CS MOVLW TRISBRD TRIS PORTA BSF CS WRITE5 BTFSS DIO GOTO WRITE5 WRITE6 BCF CS CLRF JUMP_F BSF R3_FLAG GOTO SENDC SENDC_R3 BCF CS INCF EEPADDR,F RETLW 0H ;------------------------------------------------ EEREAD MOVFW EEPADDR MOVWF OUTBYT BSF OUTBYT,7 CLRF JUMP_F BSF R4_FLAG MOVLW TRISBRD GOTO SENDC SENDC_R4 MOVLW TRISBRD TRIS PORTA MOVLW .16 MOVWF BIT_CNT READ0 BSF CLK RLF TMP2,F BCF TMP2,0 BTFSC DIO BSF TMP2,0 BCF CLK RLF TMP1,F DECFSZ BIT_CNT,F GOTO READ0 BCF CS RETLW 0H ;=============================================== DELAY_150US MOVLW .43 DELAY_TP GOTO SHORT_DELAY DELAY_50US MOVLW .10 NOP SHORT_DELAY MOVWF DELAY_DATA DELAY_LP DECFSZ DELAY_DATA,F GOTO DELAY_LP RETLW 00H CHK_HI BCF RECERR BCF STATUS,C MOVLW .239 ADDWF H_LEVEL,W BTFSS STATUS,C GOTO CHK_LOW MOVLW .224 ADDWF H_LEVEL,W BTFSC STATUS,C GOTO REC_ERR SET_HI CLRF H_LEVEL CLRF L_LEVEL BSF STATUS,C TRANS_DATA RRF RECB33B40,F RRF RECB25B32,F RRF RECB17B24,F RRF RECB09B16,F RRF RECB01B08,F btfss catch_time,1 GOTO INC_CT movf RECB33B40,W movwf pd33d40 movf RECB25B32,W movwf pd25d32 movf RECB17B24,W movwf pd17d24 movf RECB09B16,W movwf pd09d16 movf RECB01B08,W movwf pd01d08 INC_CT INCF BIT_CNT,F RETLW 00H ;---------------------------- CHK_LOW MOVLW .251 ;===> _ ADDWF H_LEVEL,W ; _| |_________ BTFSS STATUS,C ; "8~A"--"18H~19H" GOTO REC_ERR ; LOW_BIT=" 5 ~ 12" ; HI_BIT ="24 ~ 30" MOVLW .244 ADDWF H_LEVEL,W BTFSC STATUS,C GOTO REC_ERR SET_LO CLRF L_LEVEL CLRF H_LEVEL BCF STATUS,C GOTO TRANS_DATA REC_ERR BSF RECERR RETLW 00H ;=============================================== RECEIVE0 CLRF TCNT0 RECEIVE CLRF RECB33B40 CLRF RECB25B32 CLRF RECB17B24 CLRF RECB09B16 CLRF RECB01B08 ;-------------------------------------- WAIT_SYNC CLRF BIT_CNT ;---------------------------- DATABIT0 CLRF L_LEVEL CLRF H_LEVEL DATABIT BTFSS RFIN GOTO DELAY_SYNC ADDLOP CLRWDT CALL TST_TIME1 CALL DELAY_50US CLRF L_LEVEL INCF H_LEVEL,F BTFSC RFIN GOTO ADDLOP MOVLW 0X01 XORWF H_LEVEL,W BTFSC STATUS,Z GOTO DATABIT MOVLW 0X02 XORWF H_LEVEL,W BTFSC STATUS,Z GOTO DATABIT ADLOP1 CLRWDT CALL TST_TIME1 CALL DELAY_50US INCF L_LEVEL,F MOVLW .150;======>SYNC=5.3ms,106 times ADDWF L_LEVEL,W BTFSC STATUS,C GOTO CHK_SYNC BTFSS RFIN GOTO ADLOP1 MOVLW 0X01 XORWF L_LEVEL,W BTFSC STATUS,Z GOTO DATABIT MOVLW 0X02 XORWF L_LEVEL,W BTFSC STATUS,Z GOTO DATABIT CALL CHK_HI BTFSC RECERR GOTO EXIT_RECEIVE GOTO DATABIT DELAY_SYNC CLRWDT CALL TST_TIME1 CALL DELAY_50US INCF L_LEVEL,F MOVLW .96 ;====>8ms , 160times ADDWF L_LEVEL,W BTFSC RFIN GOTO ADDLOP BTFSS STATUS,C GOTO DELAY_SYNC GOTO EXITREC CHK_DATA BCF STATUS,PA0 GOTO CHK_Data EXIT_RECEIVE1 CLRF KEYFLAG GOTO EXITREC ;----------------------------------------------- CHK_SYNC CALL CHK_HI BTFSC RECERR GOTO EXIT_RECEIVE1 BCF STATUS,Z MOVLW .25 SUBWF BIT_CNT,W BTFSS STATUS,Z GOTO $+7 BTFSS LRN_F GOTO $+4 DECFSZ catch_time,F GOTO RECEIVE CALL CHK_DATA GOTO FP527 GOTO WAIT_SYNC FP527 MOVLW .15 MOVWF RD1 ROT RRF RECB33B40,F RRF RECB25B32,F RRF RECB17B24,F RRF RECB09B16,F RRF RECB01B08,F DECFSZ RD1,F GOTO ROT MOVLW 0X00 MOVWF DECR3340 MOVWF DECR2532 ;----------------------- CCC MOVLW 00H MOVWF EEPADDR REC_COMP CALL EEREAD MOVFW RECB01B08 XORWF TMP1,W BTFSS STATUS,Z GOTO COMP_NEXT MOVFW RECB09B16 NOP XORWF TMP2,W BTFSS STATUS,Z GOTO COMP_NEXT INCF EEPADDR,F CALL EEREAD MOVFW RECB17B24 XORWF TMP1,W ANDLW 0FH BTFSS STATUS,Z GOTO COMP_NEXT BTFSC LRN_F GOTO LRN_STORE GOTO CHK_HOP COMP_NEXT BTFSC EEPADDR,3 GOTO CHK_4 BTFSC EEPADDR,2 GOTO CHK_4 CHK_2 MOVLW B'00000011' ANDWF EEPADDR,W BTFSS STATUS,Z GOTO CHK_3 MOVLW 03H GOTO CHK_REG CHK_3 MOVLW 06H GOTO CHK_REG CHK_4 MOVLW B'00001001' ANDWF EEPADDR,W BTFSS STATUS,Z GOTO FUAL_SERIAL MOVLW 09H CHK_REG MOVWF EEPADDR GOTO REC_COMP FUAL_SERIAL BTFSS LRN_F GOTO EXIT_RECEIVE GOTO LRN_STORE CHK_HOP KEY_CK BTFSC LRN_F GOTO LRN_LP MOVFW KEYFLAG ANDLW 0X0F BTFSC STATUS,Z GOTO KEY SWAPF RECB17B24,W ANDLW 0FH ANDWF KEYFLAG,W BTFSS STATUS,Z GOTO SAME_KEY KEY SWAPF RECB17B24,W MOVWF KEYFLAG MOVLW 0FH ANDWF KEYFLAG,F EXITKEY GOTO RETURN_SYSTEM ;------------------------------------------------ SAME_KEY CLRF TCNT0 BTFSC LRN_F GOTO LRN_LP EXITREC BSF TMP EXIT_RECEIVE BTFSC LRN_F GOTO LRN_LP GOTO RETURN_SYSTEM ;----------------------------------------------- TEST_LRN BCF LRN_F BCF RE_LRN CLRF RTCNTH CLRF RTCNTL ENS_LRN BTFSS LRNKEY GOTO EXIT_LEARN CALL TST_RTCCP1 BTFSS RTCNTL,2 GOTO ENS_LRN ENSURED_LRN CLRF PORTA CLRF RTCNTH CLRF RTCNTL BCF LRNLED BSF LRN_F CHK_ERASE BTFSS LRNKEY GOTO LRN_LP CALL TST_RTCCP1 BTFSS RTCNTL,2 GOTO CHK_ERASE ERASE_ALL BCF LRNLED MOVLW 00H MOVWF EEPADDR CALL EECLEAR CALL EECLEAR CALL EECLEAR MOVLW 03H MOVWF EEPADDR CALL EECLEAR CALL EECLEAR CALL EECLEAR MOVLW 06H MOVWF EEPADDR CALL EECLEAR CALL EECLEAR CALL EECLEAR MOVLW 09H MOVWF EEPADDR CALL EECLEAR CALL EECLEAR CALL EECLEAR ERASE_OK BTFSC LRNKEY GOTO ERASE_OK ;------------------------------------------------ LRN_LP CALL TST_RTCCP1 BTFSC RTCNTH,1 GOTO EXIT_LEARN BTFSC LRNKEY;=================<<< GOTO ENSURED_LRN MOVLW 0X02 MOVWF JUMP_F GOTO RECEIVE LRN_STORE BTFSS TMP GOTO RECEIVE BCF TMP CLRF EEPADDR CALL EEREAD INCF TMP7,F CALL EEWRITE CLRF EEPADDR CALL EEREAD BTFSC TMP7,1 GOTO CK_SEL BTFSC TMP7,0 GOTO SEL_2 GOTO SEL_1 CK_SEL BTFSS TMP7,0 GOTO SEL_3 GOTO SEL_4 SEL_1 MOVLW 00H GOTO START_LRN SEL_2 MOVLW 03H GOTO START_LRN SEL_3 MOVLW 06H GOTO START_LRN SEL_4 MOVLW 09H START_LRN MOVWF EEPADDR MOVFW RECB01B08 MOVWF TMP1 MOVFW RECB09B16 MOVWF TMP2 CALL EEWRITE MOVFW RECB17B24 MOVWF TMP1 CALL EEWRITE LRN_HOP: MOVFW DECR2532 MOVWF TMP1 MOVFW DECR3340 MOVWF TMP2 CALL EEWRITE CLRF RTCNTL CLRF RTCNTH LRN_OK: BTFSC OUTBYT,1 GOTO $+6 BTFSC OUTBYT,2 GOTO LRN_K2 BTFSS OUTBYT,0 GOTO LRN_K3 GOTO LRN_K4 BTFSC OUTBYT,3 GOTO LRN_K4 LRN_K1 ; BCF K2 CALL TST_RTCCP1 BCF LRNLED BTFSC RTCNTL,4 BSF LRNLED BTFSC RTCNTH,0 GOTO EXIT_LEARN BTFSC RE_LRN GOTO LRN_OK BTFSS RTCNTL,7 GOTO LRN_OK BSF LRNLED ; BSF K1 ; BSF K2 ; BSF RE_LRN ; MOVLW 0X01 ; MOVWF TMP7 GOTO LRN_LP LRN_K4 BSF RE_LRN BCF LRNLED LRN_K3 ;BCF K3 ;BCF K1 GOTO $+3 LRN_K2 ;BCF K1 MOVLW 0X01 MOVWF TMP7 GOTO LRN_K1 ;------------------------------------------------ LRN_FAUL: EXIT_LEARN: MOVLW 0XFF MOVWF TMP7 CLRF TCNT0 CLRF PORTA ; BSF K1 ; BSF K2 ; BSF K3 BSF LRNLED BCF LRN_F BCF RE_LRN ;=============================================== RETURN_SYSTEM CALL TST_TIME1 BTFSC RFIN GOTO RECEIVE BTFSC TCNT0,1 CLRF KEYFLAG BTFSS TCNT0,2 GOTO $-6 BSF TMP CLRF KEYFLAG BCF STATUS,PA0 GOTO KEYSCAN ;=============================================== ORG 1D0H CHK_Data MOVF RECB33B40,W ;addr33_40-pd33d40=0 for pass SUBWF pd33d40,W BTFSS STATUS,Z GOTO SCEND MOVF RECB25B32,W SUBWF pd25d32,W BTFSS STATUS,Z GOTO SCEND MOVF RECB17B24,W SUBWF pd17d24,W BTFSS STATUS,Z GOTO SCEND MOVLW 0X02 MOVWF JUMP_F BSF STATUS,PA0 retlw null ;================================================================ ; Reset Vector ;=============================================================== org ResetVector bcf STATUS,PA0 ;Set PAGE_0 Program Memory END
發表於: 2005/5/6 12:01
|
|||
|
PIC16635 639的汽车双向报警器
|
||||
---|---|---|---|---|
初級會員
|
听朋友说,pic16F639在网上公布了汽车双向报警器的方案,不知道哪位朋友有下载到,麻烦共享一下好吗?谢谢!
發表於: 2005/4/28 22:27
|
|||
|
Re: minusone 斑主请进
|
||||
---|---|---|---|---|
初級會員
|
谢谢斑主,太感谢你了!!
不知道有没有中文的资料啊,E文实在累啊~~~ 谢谢谢谢!! 下次斑主有空来福建省泉州,我向你好好请教哦!
發表於: 2005/4/3 1:08
|
|||
|
Re: minusone 斑主请进
|
||||
---|---|---|---|---|
初級會員
|
谢谢斑主,我那些工具没有,其它的两个条件都可以,希望能得到斑主的mail.
發表於: 2005/3/31 11:18
|
|||
|