Hallo alle zusammen!
Ich habe mir eine 4-Kanal IR Fernbedinung nachgebaut. Diese Funktieoniert aber immer noch nicht. Der Empfänger geht aber der Sender nicht richtig. Jetzt habe ich den Verdacht das der Quellcode falsch ist, bzw. falschprogrammiert ist. Ich habe keine Ahnung von Assembler.
Des wegen die Frage, sieht einer von euch einen Fehler?
Wäre schön wenn mir helfen könnte, da die Bauteile sehr teuer wahren.
MFG
Andreas
Sender:
Code:
Code:;********************************************** ; * ; sender.asm - 4-Kanal-Fernbedienung - Sender * ; * ;********************************************** ; * ; (c) 2003 by Kai Uwe Schmidt * ; * ;********************************************** list p=12F629 include <p12f629.inc> d1 EQU 0x20 d2 EQU 0x21 d3 EQU 0x22 w_temp EQU 0x23 status_temp EQU 0x24 org 0x00 clrf PCLATH goto main org 0x04 movwf w_temp swapf STATUS, w bcf STATUS, RP0 movwf status_temp bsf STATUS, RP0 ; Bank 1 bcf INTCON, 7 ; Alle Interrupts aus bcf STATUS, RP0 ; Bank 0 btfss GPIO, 0 goto kanal1 btfss GPIO, 1 goto kanal2 btfss GPIO, 2 goto kanal3 btfss GPIO, 4 goto kanal4 swapf status_temp, w movwf STATUS swapf w_temp, f swapf w_temp, w goto main Delay_1s movlw 0x07 movwf d1 movlw 0x2F movwf d2 movlw 0x03 movwf d3 Delay_0 decfsz d1, f goto $+2 decfsz d2, f goto $+2 decfsz d3, f goto Delay_0 goto $+1 goto $+1 goto $+1 return send_ir bsf GPIO, 5 goto $+1 goto $+1 goto $+1 goto $+1 goto $+1 goto $+1 bcf GPIO, 5 goto $+1 goto $+1 goto $+1 goto $+1 decfsz d1, f goto send_ir ; 40 KHz Burst call Delay_1s ; 1 s Pause return main bcf STATUS, RP0 ; Bank 0 clrf GPIO movlw 0x07 movwf CMCON ; GP0..GP2 digital input bsf STATUS, RP0 ; Bank 1 movlw B'00010111' movwf TRISIO ; GP5 Ausgang, GP0..GP4 Eingang bcf STATUS, RP0 ; Bank 0 bsf GPIO, 5 bcf GPIO, 5 bsf STATUS, RP0 ; Bank 1 bcf INTCON, 7 clrf INTCON bsf INTCON, 3 movlw B'00010111' movwf IOC bsf INTCON, 7 ; GPIO Interrupt On Change bcf STATUS, RP0 ; Bank 0 loop sleep nop goto loop kanal1 movlw 0x56 movwf d1 call send_ir ; 8 * 255 goto main kanal2 movlw 0x7F movwf d1 call send_ir ; 12 * 255 goto main kanal3 movlw 0xA8 movwf d1 call send_ir ; 16 * 255 goto main kanal4 movlw 0xD1 movwf d1 call send_ir ; 20 * 255 goto main goto main end
und der
Empfänger:
Code:Code: ;********************************************** ; * ; sender.asm - 4-Kanal-Fernbedienung - Sender * ; * ;********************************************** ; * ; (c) 2003 by Kai Uwe Schmidt * ; * ;********************************************** list p=12F629 include <p12f629.inc> d1 EQU 0x20 d2 EQU 0x21 d3 EQU 0x22 w_temp EQU 0x23 status_temp EQU 0x24 org 0x00 clrf PCLATH goto main org 0x04 movwf w_temp swapf STATUS, w bcf STATUS, RP0 movwf status_temp bsf STATUS, RP0 ; Bank 1 bcf INTCON, 7 ; Alle Interrupts aus bcf STATUS, RP0 ; Bank 0 btfss GPIO, 0 goto kanal1 btfss GPIO, 1 goto kanal2 btfss GPIO, 2 goto kanal3 btfss GPIO, 4 goto kanal4 swapf status_temp, w movwf STATUS swapf w_temp, f swapf w_temp, w goto main Delay_1s movlw 0x07 movwf d1 movlw 0x2F movwf d2 movlw 0x03 movwf d3 Delay_0 decfsz d1, f goto $+2 decfsz d2, f goto $+2 decfsz d3, f goto Delay_0 goto $+1 goto $+1 goto $+1 return send_ir bsf GPIO, 5 goto $+1 goto $+1 goto $+1 goto $+1 goto $+1 goto $+1 bcf GPIO, 5 goto $+1 goto $+1 goto $+1 goto $+1 decfsz d1, f goto send_ir ; 40 KHz Burst call Delay_1s ; 1 s Pause return main bcf STATUS, RP0 ; Bank 0 clrf GPIO movlw 0x07 movwf CMCON ; GP0..GP2 digital input bsf STATUS, RP0 ; Bank 1 movlw B'00010111' movwf TRISIO ; GP5 Ausgang, GP0..GP4 Eingang bcf STATUS, RP0 ; Bank 0 bsf GPIO, 5 bcf GPIO, 5 bsf STATUS, RP0 ; Bank 1 bcf INTCON, 7 clrf INTCON bsf INTCON, 3 movlw B'00010111' movwf IOC bsf INTCON, 7 ; GPIO Interrupt On Change bcf STATUS, RP0 ; Bank 0 loop sleep nop goto loop kanal1 movlw 0x56 movwf d1 call send_ir ; 8 * 255 goto main kanal2 movlw 0x7F movwf d1 call send_ir ; 12 * 255 goto main kanal3 movlw 0xA8 movwf d1 call send_ir ; 16 * 255 goto main kanal4 movlw 0xD1 movwf d1 call send_ir ; 20 * 255 goto main goto main end
Hier ist der Link (Seite ganz unten!)
http://elektronik.kai-uwe-schmidt.de..._fernbedienung







Zitieren
Lesezeichen