I forgot the darn code! My bad! (re: Slightly bigger MIDI question)
stupid me... sorry 'bout that.
'constants, shouldn't change these
midibaudmode CON 32780 '31.25kb, 8n1, non-inverted, open collector
'for 14-bit controllers - controller 32 is lsb of controller 0, etc.
controllerLSBoffset CON 32
'MIDI status bytes:
controller CON %10110000 + 0
noteon CON %10010000 + 0
pitchbend CON %11100000 + 0
'declare variables
value VAR Word 'holds the 16-bit value read from the pot
pin VAR Nib 'which pin/pot we are reading at the moment
statusbyte VAR Byte 'MIDI status; controller, noteon, or pitchbend
data1 VAR Byte 'first data byte, eg. controller or note
number
data2 VAR Byte 'second MIDI data byte, eg. value or velocity
'user configuration - adjust these to suit you
'DANGER - check your circuitry and configure pins accordingly!!
'set unused pins to outputs
DIRS = %1111111111111111 'all outs
OUTS = %0000000000000000 'all low
midichannel CON 1 'MIDI transmit channel
midioutpin CON 0 'pin connected to MIDI out connector
'check the MIDI spec for a list of controller numbers you can use
controlleroffset CON 0 'add to pot's pin # to get MIDI controller #
hipot CON 1 'highest pin with a pot to measure
lowpot CON 1 'lowest pin with a pot to measure
doit:
DEBUG HOME
FOR pin = lowpot TO hipot
'read the value of the pot
HIGH 1
PAUSE 0
RCTIME 1, 1, value
DEBUG value, DEC pin, " reads ", DEC value, CR
value = value >> 1 'drop the least significant bit
'send most significant 7 bits as continuous controller msg
statusbyte = controller 'sending controller message
data1 = pin + controlleroffset 'controller #
data2 = value.HIGHBYTE
SEROUT data1, data2,[noparse][[/noparse]statusbyte, data1, data2]
'uncomment this section to send 14-bit controller data
'send least significant 7 bits
data1 = data1 + controllerLSBoffset
data2 = value.LOWBYTE
data2 = data2 >> 1 'convert to 7 bits
'use running status byte (can leave it out if unchanged)
SEROUT data1, data2, [noparse][[/noparse]data1, data2]
NEXT
GOTO doit
--- In basicstamps@yahoogroups.com, "r_couldrey" <r_couldrey@y...>
wrote:
> okie dokie, currently have a bunch of wires all over my desk, and
have
> lost several thousand strands of hair in frustration over this midi
> setup. Scratched the idea of 15 potentiometers due to cost (about
> 5$CAN per POT and plastic knob, !!!!) Trying to get a flex sensor on
a
> stamp to be recognized as a midi controller within Reason, and
cannot
> for the life of me get it working. I've tried altering the
parameters
> within the code, but it isn't sending out any midi through pin 0
from
> the flex sensor on pin 1. I'm certain I have the hardware set up
> correctly, but I'm pretty uncertain about how I've butchered this
> code. Reason itself isn't detecting any midi information that I can
> see. If I've really blatantly messed anything up, it'd be great to
> know, as I can't figure this out at all.
>
> a great many thanks in advance for any help. With any l,uck, I won't
> short circuit my Quattro in the meantime...
>
> ryan
'constants, shouldn't change these
midibaudmode CON 32780 '31.25kb, 8n1, non-inverted, open collector
'for 14-bit controllers - controller 32 is lsb of controller 0, etc.
controllerLSBoffset CON 32
'MIDI status bytes:
controller CON %10110000 + 0
noteon CON %10010000 + 0
pitchbend CON %11100000 + 0
'declare variables
value VAR Word 'holds the 16-bit value read from the pot
pin VAR Nib 'which pin/pot we are reading at the moment
statusbyte VAR Byte 'MIDI status; controller, noteon, or pitchbend
data1 VAR Byte 'first data byte, eg. controller or note
number
data2 VAR Byte 'second MIDI data byte, eg. value or velocity
'user configuration - adjust these to suit you
'DANGER - check your circuitry and configure pins accordingly!!
'set unused pins to outputs
DIRS = %1111111111111111 'all outs
OUTS = %0000000000000000 'all low
midichannel CON 1 'MIDI transmit channel
midioutpin CON 0 'pin connected to MIDI out connector
'check the MIDI spec for a list of controller numbers you can use
controlleroffset CON 0 'add to pot's pin # to get MIDI controller #
hipot CON 1 'highest pin with a pot to measure
lowpot CON 1 'lowest pin with a pot to measure
doit:
DEBUG HOME
FOR pin = lowpot TO hipot
'read the value of the pot
HIGH 1
PAUSE 0
RCTIME 1, 1, value
DEBUG value, DEC pin, " reads ", DEC value, CR
value = value >> 1 'drop the least significant bit
'send most significant 7 bits as continuous controller msg
statusbyte = controller 'sending controller message
data1 = pin + controlleroffset 'controller #
data2 = value.HIGHBYTE
SEROUT data1, data2,[noparse][[/noparse]statusbyte, data1, data2]
'uncomment this section to send 14-bit controller data
'send least significant 7 bits
data1 = data1 + controllerLSBoffset
data2 = value.LOWBYTE
data2 = data2 >> 1 'convert to 7 bits
'use running status byte (can leave it out if unchanged)
SEROUT data1, data2, [noparse][[/noparse]data1, data2]
NEXT
GOTO doit
--- In basicstamps@yahoogroups.com, "r_couldrey" <r_couldrey@y...>
wrote:
> okie dokie, currently have a bunch of wires all over my desk, and
have
> lost several thousand strands of hair in frustration over this midi
> setup. Scratched the idea of 15 potentiometers due to cost (about
> 5$CAN per POT and plastic knob, !!!!) Trying to get a flex sensor on
a
> stamp to be recognized as a midi controller within Reason, and
cannot
> for the life of me get it working. I've tried altering the
parameters
> within the code, but it isn't sending out any midi through pin 0
from
> the flex sensor on pin 1. I'm certain I have the hardware set up
> correctly, but I'm pretty uncertain about how I've butchered this
> code. Reason itself isn't detecting any midi information that I can
> see. If I've really blatantly messed anything up, it'd be great to
> know, as I can't figure this out at all.
>
> a great many thanks in advance for any help. With any l,uck, I won't
> short circuit my Quattro in the meantime...
>
> ryan