I can't get the USART to bring in MIDI DATA. It could be hardware, but I think that is correct so I am want to know if it's the code instead. Any ideas?
Paul
Code: (A0 led flashes on start up A1 is supposed to flash when midi bytes come in but it never does)
LIST P=16F628A
#include "P16F628A.INC"
__CONFIG _INTRC_OSC_NOCLKOUT & _LVP_OFF & _WDT_OFF & _PWRTE_ON & _BODEN_ON & _MCLRE_ON
CBLOCK 0x20
Loop1,Loop2
ENDC
radix hex
ORG 0x000
bcf STATUS,RP0
clrf PORTA
clrf PORTB
movlw 0x07
movwf CMCON
BSF STATUS,RP0
clrf TRISB
bsf TRISB,1
clrf TRISA
movlw 0x09
movwf SPBRG ; 31250 baud
bcf TXSTA,SYNC
bcf STATUS,RP0
bsf RCSTA,SPEN
bsf RCSTA,CREN
BSF PORTA,0 ; Blink LED to show chip is working
CALL delay
BCF PORTA,0
CALL delay
LOOP
btfss PIR1,RCIF ;Wait for RX flag
goto LOOP ;wait for USART byte
MOVF RCREG,W
BSF PORTA,1 ;flash second led to show usart in data
BCF PORTA,1
goto LOOP
delay MOVLW 0xf0
MOVWF Loop1
Outer MOVLW 0xc8
MOVWF Loop2
Inner NOP
NOP
DECFSZ Loop2,F
GOTO Inner
DECFSZ Loop1,F
GOTO Outer
RETURN
END
Paul
Code: (A0 led flashes on start up A1 is supposed to flash when midi bytes come in but it never does)
LIST P=16F628A
#include "P16F628A.INC"
__CONFIG _INTRC_OSC_NOCLKOUT & _LVP_OFF & _WDT_OFF & _PWRTE_ON & _BODEN_ON & _MCLRE_ON
CBLOCK 0x20
Loop1,Loop2
ENDC
radix hex
ORG 0x000
bcf STATUS,RP0
clrf PORTA
clrf PORTB
movlw 0x07
movwf CMCON
BSF STATUS,RP0
clrf TRISB
bsf TRISB,1
clrf TRISA
movlw 0x09
movwf SPBRG ; 31250 baud
bcf TXSTA,SYNC
bcf STATUS,RP0
bsf RCSTA,SPEN
bsf RCSTA,CREN
BSF PORTA,0 ; Blink LED to show chip is working
CALL delay
BCF PORTA,0
CALL delay
LOOP
btfss PIR1,RCIF ;Wait for RX flag
goto LOOP ;wait for USART byte
MOVF RCREG,W
BSF PORTA,1 ;flash second led to show usart in data
BCF PORTA,1
goto LOOP
delay MOVLW 0xf0
MOVWF Loop1
Outer MOVLW 0xc8
MOVWF Loop2
Inner NOP
NOP
DECFSZ Loop2,F
GOTO Inner
DECFSZ Loop1,F
GOTO Outer
RETURN
END