Ladies and Gentleman,
I'm trying to route a Stream of MIDI Data thru a 20x2 (probably upgrade to 28x2@64MHz) using this code:
While it runs fine if there is nothing to forward and/or nothing much going on in the main part of the Program it seems to drop a bit of Data under load.
I implemented Code in the Interrupt Routine that stops execution if there is a Buffer overrun but as it never occurred i removed this so i am pretty shure that this is not the case.
So sorry if I bother you with questions as i am on tour and have a bit of time to think about it while being on the train, heres what i think i could change to make it work better:
• Maybe it jumps into the Interrupt while the hserout Command is cranking out some bytes with "hserout 0,(b0, b1, pot value)", thus disabling the interrupt while sending Data would help
• Same thoughts as above for sending Data to the Display with "serout display, N2400_16, (b1, b2, b3)". Maybe integrate the Display into the 28X2s code and saving the 2nd PicAxe and save sending Data serially (which is a bit glacieresque...)
• Main Concern: should i better read the buffer circular (with overflow) rather than resetting the serial Pointer?
• Or is it just the 20X2 being to slow at 16MHz?
Any thoughts highly welcome - and please apologize my bad english!
Thanks in advance,
Frank
I'm trying to route a Stream of MIDI Data thru a 20x2 (probably upgrade to 28x2@64MHz) using this code:
Code:
init:
hsersetup B31250_16, %001 '31500baud, background receive
hserptr = 0 'SET POINTER TO BUFFER START (NECESSARY??)
setintflags %00100000, %00100000 'SET INTERRUPT FOR BREAKING AT BACKGROUND RECEIVE
main:
'doing some pot scanning, processing and sending MIDI data vie hserout
interrupt:
midicounter = 0 'SET COUNTER TO 0
DO UNTIL midicounter = hserptr 'DO UNTIL BUFFER END
GET midicounter, midibyte 'READ A BYTE FROM THE BUFFER
HSEROUT 0, (midibyte) 'WRITE THIS TO PORT
midicounter = midicounter +1 'INCREASE COUNTER
LOOP
hserptr = 0 'RESET BUFFER POINTER
hserinflag = 0 'RESET FLAG
SETINTFLAGS %00100000, %00100000 'REENABLE INTERRUPT
RETURN
I implemented Code in the Interrupt Routine that stops execution if there is a Buffer overrun but as it never occurred i removed this so i am pretty shure that this is not the case.
So sorry if I bother you with questions as i am on tour and have a bit of time to think about it while being on the train, heres what i think i could change to make it work better:
• Maybe it jumps into the Interrupt while the hserout Command is cranking out some bytes with "hserout 0,(b0, b1, pot value)", thus disabling the interrupt while sending Data would help
• Same thoughts as above for sending Data to the Display with "serout display, N2400_16, (b1, b2, b3)". Maybe integrate the Display into the 28X2s code and saving the 2nd PicAxe and save sending Data serially (which is a bit glacieresque...)
• Main Concern: should i better read the buffer circular (with overflow) rather than resetting the serial Pointer?
• Or is it just the 20X2 being to slow at 16MHz?
Any thoughts highly welcome - and please apologize my bad english!
Thanks in advance,
Frank