Midi JUNO 60 (DCB to MIDI converter) need help

Dear Diyers,

I would like to control the JUNO60 in MIDI This old syntheziser use DCB protocol http://en.wikipedia.org/wiki/Digital_Control_Bus

i connect the arduino like this -DCB Tx Data -----> Arduino Rx -DCB ground ------> Arduion Ground

I use this program to read the data who send the juno 60

int Led = 13;
int data = 0;
int count=0;


///////////////////////////////////////////////////////////////
//Initialisation de la sorite de la Led et du port Rx en Midi//
void setup() {

}
////////////////////////////////////////////////////////////////
///////////////////////debut de la boucle///////////////////////
void loop() {
  Serial.begin(31250);
  delay(100);
  if(Serial.available() > 0){// un info est elle presente en Rx
    data = Serial.read();// enregistrer cette info dans la variable Data
    
    Serial.begin (9600);
    
    Serial.print (data, HEX);
    Serial.println (" ");
    count ++;
    if (count == 7){
      Serial.print("/n");
      count =0;
    }
  } 
}

That what i read on the serial monitor

I don't understand this data because at the beginning the data seem to ok and when i try to push a key the datra change and never be the same as the beginning Is there anybody who are "friendly" with the type of protocol or maybe i dont interface it correctly

Thank you for your help Xarolium

Hi,

I don’t know the DVB protocol but are you sure about your baud rate ?
Because usually this kind of bad data can comes from incorrect baud rate

Edit : after checking the wikipedia page you added, it seems that the protocol have 2 stop bit.
“LSB first, 8 data bits, 2 stop bits, odd parity, and a Baud rate of 31.25kHz.”

This could be the cause of your data errors
There is a post on midibox forum about this protocol (but no solution) you can maybe find useful info :

xray303

thank you for your help Xray303

I learned a little bit more of the UART protocol and it work like that. A byte is composing with: -first one start bit = 0 -after Data bits between 5 and 9 -then a parity bit -finaly one stop bit = 1

the different between the DCB protocol and UART is that the start in DCB is 1 and stop Bit is 0 Do you think it's possible to change this on the Arduino UART.

Hi,

It’s a good question, i never tried (never needed) maybe some Arduino Guru here could respond to that.

you can try to look at this it could help :
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1243894373/15
http://code.google.com/p/arduino/issues/detail?id=573
http://www.arduino.cc/en/Tutorial/SoftwareSerial

thank you the last link is very useful on this page he said:

Definitions Needed: #define bit9600Delay 84 * *#define halfBit9600Delay 42 #define bit4800Delay 188 #define halfBit4800Delay 94

But how he can find 84 microseconds to generate 9600baud f=1/T F= 1/0,000084 = 11905 hz approximately

How can i find the right frequency to generate 31250baud ? Maybe he add the time of each action on his fonction , i'm right??

Now, with your help i know what i need to do to send data in my JUNO60 Arduino must generate a clock at 31250hz on one PIN a second PIN must send DATA (Start bit, Data Bits,Parity Bit and Stop Bit) in Serial at the same frequency and synhcro with the clock And a third PIN to latch the hardwareflow control. Then i could use this part of code to generate the right "polarity" of my bit

void SWprint(int data)
{
  byte mask;
  //startbit
  digitalWrite(tx,LOW);
  delayMicroseconds(bit9600Delay);
  for (mask = 0x01; mask>0; mask <<= 1) {
    if (data & mask){ // choose bit
     digitalWrite(tx,HIGH); // send 1
    }
    else{
     digitalWrite(tx,LOW); // send 0
    }
    delayMicroseconds(bit9600Delay);
  }
  //stop bit
  digitalWrite(tx, HIGH);
  delayMicroseconds(bit9600Delay);
}

Hi Xarolium

Did you ever get this project working? I am trying to do the same thing at the moment, and I'm having quite a bit of problems, so if you've had any luck, I'd like to hear about it. (See http://forum.arduino.cc/index.php?topic=174173.msg1295934#msg1295934 for details)

Cheers Mikkel