Midi input, using hserin?


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    Join Date
    Apr 2006
    Posts
    92

    Default Midi input, using hserin?

    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

  2. #2
    Kees Reedijk's Avatar
    Kees Reedijk Guest


    Did you find this post helpful? Yes | No

    Default MIDI in

    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.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    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.

  4. #4
    Join Date
    Apr 2006
    Posts
    92


    Did you find this post helpful? Yes | No

    Default

    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

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    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.

  6. #6
    Join Date
    Apr 2006
    Posts
    92


    Did you find this post helpful? Yes | No

    Default

    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

Similar Threads

  1. Sony LanC Program
    By l_gaminde in forum Code Examples
    Replies: 2
    Last Post: - 25th September 2009, 18:51
  2. How to HSERIN and MIDI code?
    By francolok in forum Serial
    Replies: 1
    Last Post: - 18th December 2008, 16:59
  3. Midi, Interrupts and Pic better than SX28?
    By Lajko in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 27th September 2008, 00:26
  4. Timing input pulses and re-outputting them
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th February 2007, 01:50
  5. Using LEDs as light sensors
    By skimask in forum Code Examples
    Replies: 3
    Last Post: - 30th December 2006, 22:19

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts