<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">That is exactly what I meant as long as you <div>#define WIRING_ECHO_SERIAL 1<div>somewhere before this block of code.</div><div><br><div><div>On Apr 5, 2009, at 6:15 PM, Hans Lindauer wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Thanks Don,<br><br>I'm guessing that making this change to the core allows the data to take the most direct route from Rx to Tx?<br><br>Unfortunately, it's still not passing data thru. Do I have this correct? Am I missing curly braces or something?<br><br>#if defined(__AVR_ATmega8__)<br> unsigned char c = UDR;<br>#else<br> unsigned char c = UDR0;<br> #if defined(WIRING_ECHO_SERIAL)<br> UDR0=c; // write c back to the usart for transmission<br> #endif<br>#endif<br><br>Thanks,<br>-Hans<br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold; ">From:</span></b><span class="Apple-converted-space"> </span>Donald Delmar Davis <<a href="mailto:ddelmardavis@gmail.com">ddelmardavis@gmail.com</a>><br><b><span style="font-weight: bold; ">To:</span></b><span class="Apple-converted-space"> </span>"A discussion list for dorkbot-pdx (portland, or)" <<a href="mailto:dorkbotpdx-blabber@dorkbot.org">dorkbotpdx-blabber@dorkbot.org</a>><br><b><span style="font-weight: bold; ">Sent:</span></b><span class="Apple-converted-space"> </span>Sunday, April 5, 2009 11:25:50 AM<br><b><span style="font-weight: bold; ">Subject:</span></b><span class="Apple-converted-space"> </span>Re: [dorkbotpdx-blabber] (2nd try) Programming Help Needed Please<br></font><br>Hans,<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Since you are only passing the data through without processing it you should intercept and retransmit the bytes in the serial interrupt routine.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">In wiring_serial.c</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">change </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><div style="font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10px; line-height: normal; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="Apple-tab-span" style="white-space: pre; ">        </span><span style="color: rgb(170, 13, 145); ">unsigned</span><span class="Apple-converted-space"> </span><span style="color: rgb(170, 13, 145); ">char</span><span class="Apple-converted-space"> </span>c = UDR0;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font class="Apple-style-span" size="2" face="Monaco"><span class="Apple-style-span" style="font-size: 10px; ">to </span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font class="Apple-style-span" size="2" face="Monaco"><span class="Apple-style-span" style="font-size: 10px; "><span class="Apple-tab-span" style="white-space: pre; ">        </span>unsigned char c = UDR0;</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font class="Apple-style-span" size="2" face="Monaco"><span class="Apple-style-span" style="font-size: 10px; ">#ifdef WIRING_ECHO_SERIAL</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font class="Apple-style-span" size="2" face="Monaco"><span class="Apple-style-span" style="font-size: 10px; "><span class="Apple-tab-span" style="white-space: pre; ">        </span>UDR0 = c; //write c back to the Usart Data Register for transmission.<br></span></font></div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">#endif</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "> </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">and #define WIRING_ECHO_SERIAL=1 somewhere.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">To do it right you should class serial or create a new core, its a bit invasive but its actually what you really want here. </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Don.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">On Apr 5, 2009, at 11:07 AM, Hans Lindauer wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Let's try this again, without the attachments. You can find them at the provided link.<br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font size="2" face="Tahoma">----- Forwarded Message ----<br><b><span style="font-weight: bold; ">From:</span></b><span class="Apple-converted-space"> </span>Hans Lindauer <<a rel="nofollow" ymailto="mailto:armatronix@sbcglobal.net" target="_blank" href="mailto:armatronix@sbcglobal.net">armatronix@sbcglobal.net</a>><br><b><span style="font-weight: bold; ">To:</span></b><span class="Apple-converted-space"> </span><a rel="nofollow" ymailto="mailto:dorkbotpdx-blabber@dorkbot.org" target="_blank" href="mailto:dorkbotpdx-blabber@dorkbot.org">dorkbotpdx-blabber@dorkbot.org</a><br><b><span style="font-weight: bold; ">Sent:</span></b><span class="Apple-converted-space"> </span>Sunday, April 5, 2009 10:41:47 AM<br><b><span style="font-weight: bold; ">Subject:</span></b><span class="Apple-converted-space"> </span>Programming Help Needed Please<br></font><br><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">OK, I have (hopefully) one line to program to finish my re-write of my MIDI lights firmware. It's the line that modifies the MIDI library so that it passes any incoming bytes to the THRU port.<br><br>In my old program, I just did a Serial.read follower by a Serial.print, as follows:<br><br>void loop () {<br> if (Serial.available() > 0) {<br> newbyte = Serial.read(); // read the incoming byte<br> Serial.print(newbyte); // echo the incoming byte<br>...<br><br>I tried that again here, but with no luck. Then I looked at how they send data to the serial port for MIDI OUT in the library, and saw that they use a slightly different syntax: serial_.print (b, TYPE). So I tried adding that instead, as follows. I've included an extra snippet that shows how they're doing it, for context. My line is the one with the asterisks. I assumed that I could ignore the type argument, since I'm just passing the (int) variable c straight thru. (I also tried it as INT and BYTE types):<br><br><br>// Try to read data at serial port & pass anything read to processing function<br>void Midi::poll(void)<br>{<br> int c;<br><br> // Just keep sucking data from serial port until it runs out, processing<br> // MIDI messages as we go<br> while((c = serial_.read()) != -1) {<br> recvByte(c);<br> serial_.print(c); // ***** pass MIDI data THRU *****<br> }<br>}<br><br><br>// Send Midi NOTE OFF message to a given channel, with note 0-127 and velocity 0-127<br>void Midi::sendNoteOff(unsigned int channel, unsigned int note, unsigned int velocity)<br>{<br> int status = STATUS_EVENT_NOTE_OFF | ((channel - 1) & 0x0f);<br> <span class="Apple-converted-space"> </span><br> if (sendFullCommands_ || (lastStatusSent_ != status)) {<br> serial_.print(status, BYTE);<br> }<br> <span class="Apple-converted-space"> </span><br> serial_.print(note & 0x7f, BYTE);<br> serial_.print(velocity & 0x7f, BYTE);<br>}<br><br><br><span>If it helps to see the full library code from<span class="Apple-converted-space"> </span><span><a target="_blank" href="http://timothytwillman.com/?page_id=240">http://timothytwillman.com/?page_id=240</a>, it's attached (this snippet is in midi.cpp). Please let me know if you have any ideas. By the way, this MIDI library seems to work pretty well otherwise (with only one light).</span></span><br><br>Thanks,<br>-Hans<br></div></div></div></div></div></div>_______________________________________________<br>dorkbotpdx-blabber mailing list<br><a rel="nofollow" ymailto="mailto:dorkbotpdx-blabber@dorkbot.org" target="_blank" href="mailto:dorkbotpdx-blabber@dorkbot.org">dorkbotpdx-blabber@dorkbot.org</a><br><span><a target="_blank" href="http://music.columbia.edu/mailman/listinfo/dorkbotpdx-blabber">http://music.columbia.edu/mailman/listinfo/dorkbotpdx-blabber</a></span></div></span></blockquote></div><br></div></div></div></div>_______________________________________________<br>dorkbotpdx-blabber mailing list<br><a href="mailto:dorkbotpdx-blabber@dorkbot.org">dorkbotpdx-blabber@dorkbot.org</a><br><a href="http://music.columbia.edu/mailman/listinfo/dorkbotpdx-blabber">http://music.columbia.edu/mailman/listinfo/dorkbotpdx-blabber</a></div></span></blockquote></div><br></div></div></body></html>