<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>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.&nbsp; Do I have this correct?&nbsp; Am I missing curly braces or something?<br><br>#if defined(__AVR_ATmega8__)<br>&nbsp;&nbsp;&nbsp; unsigned char c = UDR;<br>#else<br>&nbsp;&nbsp;&nbsp; unsigned char c = UDR0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #if defined(WIRING_ECHO_SERIAL)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UDR0=c; // write c back to the usart for transmission<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #endif<br>#endif<br><br>Thanks,<br>-Hans<br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><div style="font-family: times new roman,new
 york,times,serif; font-size: 12pt;"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Donald Delmar Davis &lt;ddelmardavis@gmail.com&gt;<br><b><span style="font-weight: bold;">To:</span></b> "A discussion list for dorkbot-pdx (portland,  or)" &lt;dorkbotpdx-blabber@dorkbot.org&gt;<br><b><span style="font-weight: bold;">Sent:</span></b> Sunday, April 5, 2009 11:25:50 AM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [dorkbotpdx-blabber] (2nd try) Programming Help Needed Please<br></font><br>
Hans,<div><br></div><div>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><br></div><div>In wiring_serial.c</div><div><br></div><div>change&nbsp;</div><div><div style="margin: 0px; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10px; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;"><span class="Apple-tab-span" style="white-space: pre;">        </span><span style="color: rgb(170, 13, 145);">unsigned</span> <span style="color: rgb(170, 13, 145);">char</span> c = UDR0;</div><div><font class="Apple-style-span" size="2" face="Monaco"><span class="Apple-style-span" style="font-size: 10px;">to&nbsp;</span></font></div><div><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><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><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>#endif</div><div>&nbsp;</div><div>and #define WIRING_ECHO_SERIAL=1 somewhere.</div><div><br></div><div>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.&nbsp;</div><div><br></div><div>Don.</div><div><br></div><div><br></div><div><br></div><div><br><div><div>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><div style="margin: 0px; font-family: 'times new roman','new york',times,serif; font-size: 12pt;"><div style="margin: 0px;">Let's try this again, without the attachments.&nbsp; You can find them at the provided link.<br></div><div style="margin: 0px; font-family: 'times new roman','new york',times,serif; font-size: 12pt;"><br><div style="margin: 0px; font-family: 'times new roman','new york',times,serif; font-size: 12pt;"><font size="2" face="Tahoma">----- Forwarded Message ----<br><b><span style="font-weight: bold;">From:</span></b><span class="Apple-converted-space">&nbsp;</span>Hans Lindauer &lt;<a
 rel="nofollow" ymailto="mailto:armatronix@sbcglobal.net" target="_blank" href="mailto:armatronix@sbcglobal.net">armatronix@sbcglobal.net</a>&gt;<br><b><span style="font-weight: bold;">To:</span></b><span class="Apple-converted-space">&nbsp;</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">&nbsp;</span>Sunday, April 5, 2009 10:41:47 AM<br><b><span style="font-weight: bold;">Subject:</span></b><span class="Apple-converted-space">&nbsp;</span>Programming Help Needed Please<br></font><br><div style="margin: 0px; font-family: 'times new roman','new york',times,serif; font-size: 12pt;"><div style="margin: 0px; font-family: 'times new roman','new york',times,serif; font-size: 12pt;"><div style="margin: 0px;">OK, I have (hopefully) one line to program to
 finish my re-write of my MIDI lights firmware.&nbsp; 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>&nbsp; if (Serial.available() &gt; 0) {<br>&nbsp;&nbsp;&nbsp; newbyte = Serial.read(); // read the incoming byte<br>&nbsp;&nbsp;&nbsp; Serial.print(newbyte); // echo the incoming byte<br>...<br><br>I tried that again here, but with no luck.&nbsp; 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).&nbsp; So I tried adding that instead, as follows.&nbsp; I've included an extra snippet that shows how they're doing it, for context.&nbsp; My line is the one with the asterisks.&nbsp; I assumed that I could ignore the type argument, since I'm just passing the (int) variable c straight
 thru.&nbsp; (I also tried it as INT and BYTE types):<br><br><br>// Try to read data at serial port &amp; pass anything read to processing function<br>void Midi::poll(void)<br>{<br>&nbsp;&nbsp;&nbsp; int c;<br><br>&nbsp;&nbsp;&nbsp; // Just keep sucking data from serial port until it runs out, processing<br>&nbsp;&nbsp;&nbsp; //&nbsp; MIDI messages as we go<br>&nbsp;&nbsp;&nbsp; while((c = serial_.read()) != -1) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; recvByte(c);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; serial_.print(c); // ***** pass MIDI data THRU *****<br>&nbsp;&nbsp;&nbsp; }<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>&nbsp;&nbsp;&nbsp; int status = STATUS_EVENT_NOTE_OFF | ((channel - 1) &amp; 0x0f);<br>&nbsp;&nbsp;&nbsp;<span
 class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; if (sendFullCommands_ || (lastStatusSent_ != status)) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; serial_.print(status, BYTE);<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; serial_.print(note &amp; 0x7f, BYTE);<br>&nbsp;&nbsp;&nbsp; serial_.print(velocity &amp; 0x7f, BYTE);<br>}<br><br><br><span>If it helps to see the full library code from<span class="Apple-converted-space">&nbsp;</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).&nbsp; Please let me know if you have any ideas.&nbsp; 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></body></html>