Hi,
I'm trying to receive midi input using the pic18f452.
I guess I would use HSERIN. Are there any examples? Has anyone here done this?
Thanks for any info.
Tony
Hi,
I'm trying to receive midi input using the pic18f452.
I guess I would use HSERIN. Are there any examples? Has anyone here done this?
Thanks for any info.
Tony
Here's an example using serin2, you have to use a 20MHz crystal:
It reads in MIDI data and sends it out to a serial port, worked fine for me.
@ device pic16F628A, pwrt_on, mclr_on, protect_off, wdt_on, HS_OSC
INCLUDE "modedefs.bas"
DEFINE OSC 20
CMCON = 7 ' PortA = digital I/O
PORTA = %00000001
TRISA = %00000000
PORTB = %00000000
TRISB = %00000000
test1 VAR BYTE
test2 VAR BYTE
mdata VAR BYTE
loop:
SerIn2 PORTA.0,12,[test1,test2,mdata]
SerOut PORTB.7,N9600,[" midi : ",#test1," ",#test2," ",#mdata,10,13]
GoTo loop
end
Last edited by Kees Reedijk; - 13th July 2006 at 22:48.
do a google search and you'll find, at least the right baudrate
Search with MIDI in the forum search tool and you'll find some info
Same for HSERIN
It can definately be done using a PIC and PBP, some homework have to be done first.
If your PIC have a USART, there's no reason to use SERIN or else software solution.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hi,
Thanks. Why not use HSERIN? Isn't that more appropriate?
Yes, the google search will only yield midi output examples, nothing on midi input for picbasic pro (unless I'm overlooking something).
Thanks again for the help, I appreciate it very much.
Tony
Sorry if it wasn't really clear, Sure HSERIn is appropriate where SERIN it's not really to reach the baudrate you want @4MHZ.
The internal USART also offer you the Interrupts where the software SERIN,DEBUG don't
Usefull when your software have to do something else than wait... Even the Timeout of SERINx may be used but with the MIDI baudrate i can't say you'll never miss any character.
HSERIN within a ISR is the way to go.
The Kees Reedijk example is something to play 'round.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hi,
Thanks. Yes, I'm going to need 20 Mhz osc. for midi.
Any examples on how to set up hserin code?
Thanks again, I appreciate.
Tony
Bookmarks