; Morse Code Generator - Générateur de message en Morse - ; Origin : QST article Oct 1998 by W2FS, for PIC 16F84 ; Modified by DF1NF in 2006 for PIC 16F627 ; Slightly modified by F1LVT in 2013 for PIC 16F628 ; V-G4 - Exemple de message : transmission de 'F1XYZ' - Temporisation entre 2 messages T = 40s list p=16F628 radix hex __config 0x3FF1 ; Oscillator RC Interne dahlen equ d'99' ;<== L1 : Controle la longueur des 'dah' ditlen equ d'33' ;<== L2 : Controle la longueur des 'dit' org 0x000 ; A augmenter (en restant<255) pour réduire la vitesse MOVLW 00 ; A réduire pour accroitre la vitesse MOVWF 0A ; Conserver L1 = L2 x 3 GOTO start ; NOP NOP time MOVF 30,W BTFSC 03,2 GOTO endtime uptop MOVLW 01 MOVWF 2D upagn CLRF 2C doagn DECFSZ 2C,F GOTO doagn DECFSZ 2D,F GOTO upagn MOVLW 4A MOVWF 2C upone DECFSZ 2C,F GOTO upone DECFSZ 30,F GOTO uptop endtime RETLW 00 dah MOVLW 01 ; Subroutine pour faire 'dah' MOVWF 2E agn3dah MOVLW dahlen SUBWF 2E,W BTFSC 03,0 GOTO enddah BSF 06,1 ; turn on pin B1 MOVLW 01 MOVWF 30 CALL time ; wait 1 millisecond BCF 06,1 ; turn off pin B1 MOVLW 01 MOVWF 30 CALL time ; wait 1 millisecond MOVF 2E,W INCF 2E,F GOTO agn3dah ; loop up to do it again. enddah MOVLW 3C ; add a small delay MOVWF 30 CALL time ; wait 1 millisecond RETLW 00 dit MOVLW 01 ; subroutine pour faire 'dit' MOVWF 2E agn3dit MOVLW ditlen SUBWF 2E,W BTFSC 03,0 GOTO enddit BSF 06,1 ; turn on Pin B1 MOVLW 01 MOVWF 30 CALL time ; wait 1 millisecond BCF 06,1 ; turn off Pin B1 MOVLW 01 MOVWF 30 CALL time ; wait 1 millisecond MOVF 2E,W INCF 2E,F GOTO agn3dit ; loop up and do it again enddit MOVLW 3C ; add a small delay MOVWF 30 CALL time ; wait 1 millisecond RETLW 00 lspace MOVLW 0xB4 ; subroutine to make a MOVWF 30 ; letter space CALL time RETLW 00 start CLRF 04 ; ***** Le programme principal commence ici ***** MOVLW 0xF9 ; Definir Port B, Bit 1 et Bit 2 comme des sorties TRIS 6 top BSF 06,2 ; turn on pin B2 (PTT on, wait 3 spaces) CALL lspace CALL lspace CALL lspace CALL dit ;<== Message à transmettre 'F1XYZ' CALL dit ;<== 'F'..-. CALL dah ;<== CALL dit ;<== CALL lspace CALL dit ;<== '1'.---- CALL dah ;<== CALL dah ;<== CALL dah ;<== CALL dah ;<== CALL lspace CALL dah ;<== 'X' -..- CALL dit ;<== CALL dit ;<== CALL dah ;<== CALL lspace CALL dah ;<== 'Y' -.-- CALL dit ;<== CALL dah ;<== CALL dah ;<== CALL lspace CALL dah ;<== 'Z' --.. CALL dah ;<== CALL dit ;<== CALL dit ;<== CALL lspace CALL lspace CALL lspace BCF 06,2 ; turn off pin B2 (PTT off) MOVLW 01 MOVWF 2E loop MOVLW d'10' ;<== D : Controle la période T entre deux envois du message ; T = D x 4 (en secondes) ; Valeur initiale D = 10 pour période T de 40 secondes ; D= 50 pour 3 min (200 s) SUBWF 2E,W BTFSC 03,0 GOTO bottom MOVLW 10 MOVWF 2F again MOVLW 0xFA MOVWF 30 CALL time DECFSZ 2F,F GOTO again MOVF 2E,W INCF 2E,F GOTO loop bottom GOTO top END