You are right!
I use a 16f88 to control 7 pots connected at the 7 ad pin and 3 bottons, one to calibrate the pots and the other to send midi control change messages.The pots, when rotated, must send midi continuos change message through the ausart.The ausart is configured comply with the midi protocol(31250 baud).this is an example of the midi message:
define osc 20
define HSER_TXSTA 20h ' enable TX register
DEFINE HSER_RCSTA 90h ' enable RX register
define HSER_BAUD 31250 ' midi baud rate
for j = 0 to 6
RESULT[J] = NEW[j]
ADCON0 = %11000001 + (J*8) 'SET A/D rC + A/D = ON
PAUSEus 10 'PAUSE 10uS FOR CHANNEL SETUP
ADCON0.2 = 1 'SET GO/DONE-BIT + START CONVERSION
PAUSEus 10 'PAUSE 10uS FOR CONVERSION
RESULT[J] = ADRES
RESULT[J] = RESULT[J] >> 1
'read j, NEW[j]
if RESULT[J] <> NEW[j] then
'write j, NEW[j]
hserout [$b0, j, RESULT[J]]
endif
next j
goto loop
RESULT is the value of the controller comply with midi,it must be 0-127
$bo is the statusbyte, j the channel.
The problem is that the program sends midi messages continuously,i want it sends midi only when the pot is rotated, sending all the values untill i stop to rotate!
Also i want to limit the range of the pot with the calibrate button,when i first press the button i set the min value to 0, then i rotate the pot to set another value corresponding to 127 pressing the button.
Thanks
Bookmarks