wie schon mal in einem älteren Topic von mir geschrieben will ich nen Gate Signal umwandeln in Midi Clock.
Ich hab gedacht das das CV/Gate2Midi Projekt dafür funktioniert. dann ist mir ja eingefallen das das dann ja nur
Note On/Off ist
Jetzt müsste ich halt den Quellentext der hex. File ändern, aber von sowas hab ich ja nunmal keine Ahnung.
Was muss ich jetzt hier ändern? :D
Ich hab gedacht das das CV/Gate2Midi Projekt dafür funktioniert. dann ist mir ja eingefallen das das dann ja nur
Note On/Off ist
Jetzt müsste ich halt den Quellentext der hex. File ändern, aber von sowas hab ich ja nunmal keine Ahnung.
Was muss ich jetzt hier ändern? :D
Code:
; WRITTEN BY: TOM SCARFF
; DATE: 18/5/2004
; ITERATION: 1.0
; FILE SAVED AS: cv2midi.ASM
; FOR: PIC16F877
; CLOCK: 4.00 MHz CRYSTAL
; INSTRUCTION CLOCK: 1.00 MHz T= luS
; PROGRAMME FUNCTION: cv to midi
list p=16F877 ; tells the assembler which PIC
#include "p16F877.inc" ; general register file
__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _XT_OSC & _WRT_ENABLE_OFF & _LVP_OFF & _DEBUG_OFF & _CPD_OFF
; '__CONFIG' directive is used to embed configuration data within .asm file.
; The lables following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.
#DEFINE PAGE0 BCF 3,5
#DEFINE PAGE1 BSF 3,5
;********************************
; Constant Assignments
;********************************
;********************************
; Variable Assignment Addresses
;***t****************************
; 20h Start of General purpose registers
AD_DATA EQU 21h
midich equ 22h
note equ 25h
val1 equ 26h
val2 equ 27h
value1 equ 28h
; 7fh end of data area
;************************************
; PROGRAMME Reset Point
;************************************
org 00 ; reset vector
goto init
;*********************************************
; Start A/D conversion Subroutine
;*********************************************
convert bsf ADCON0,2 ;set GO/DONE Bit
btfsc ADCON0,2
goto $-1
rrf ADRESH,W
andlw 07Fh
movwf AD_DATA
return
;******************************************
; transmission complete subroutine
;***************+**************************
txchar bsf STATUS,RP0
btfss TXSTA,1 ; test for end of transmission
goto $-1
bcf STATUS,RP0
return
;*********************************#***
; Output MIDI note-on data
;**************************************
noteon movf midich,W
addlw 090h ; note-on ch. from midich
movwf TXREG ; send chazacter from W
call txchar
movf note,W
movwf TXREG ; send character from W
call txchar
movlw .64
movwf TXREG ; send character from W
call txchar
return
;*********************************#***
; Output MIDI note-off data
;**************************************
noteoff movf midich,W
addlw 080h ; note-off ch. from midich
movwf TXREG ; send chazacter from W
call txchar
movf note,W
movwf TXREG ; send character from W
call txchar
movlw .64
movwf TXREG ; send character from W
call txchar
return
;***********************************************
; initalise software
;***********************************************
init bcf STATUS,RP0 ;page 0
clrf PORTA
clrf PORTB
clrf PORTC
clrf PORTD
clrf PORTE
PAGE1
movlw 0FFh
movwf TRISB ;all pins inputs
movwf TRISA ;all inputs
movlw 0Eh
movwf ADCON1 ; Set porta AN0 as analogue I/P's
movwf TRISD ;all inputs
movlw 07h
movwf TRISE
PAGE0
; Set up USART
PAGE1
bsf STATUS,RP0 ; goto page 1
movlw b'10001111' ; RC7 is RX input
movwf TRISC
movlw 01h ; 31250 baud for MIDI
movwf SPBRG
movlw b'00100000' ; async tx 8 bit
movwf TXSTA
bcf STATUS,RP0 ; return to page 0
movlw b'10010000' ; async rx 8 bit
movwf RCSTA
bsf STATUS,RP0 ; enable weak pull-up resistors
movlw 07h ; rtcc/256
movwf OPTION_REG
bcf STATUS,RP0
movfw PORTC
andlw 0Fh
movwf midich
goto main
;**************************************************************
main btfsc PORTC,7
goto main
ch0 movlw B'01000001' ; channel 0
movwf ADCON0
call convert
movfw AD_DATA
addlw .24 ; shift up two octaves
movwf note
call noteon
btfss PORTC,7
goto $-1
call noteoff
goto main
end
;================================================================