[dorkbotpdx-blabber] (2nd try) Programming Help Needed Please

Donald Delmar Davis ddelmardavis at gmail.com
Sun Apr 5 22:24:59 EDT 2009


Sorry the sintax on the define below is wrong.

#define WIRING_ECHO_SERIAL=1

should be

#define WIRING_ECHO_SERIAL 1

Also since this is in the core you will need to reselect the board if  
you are using the arduino to do your compilation.
This should force it to recompile the core and extraneous libraries.
And if you are not sure what it is doing change the build.verbose  
setting in preferences.txt to give yo more diagnostics.

Don.



On Apr 5, 2009, at 6:15 PM, Hans Lindauer wrote:

> Thanks Don,
>
> I'm guessing that making this change to the core allows the data to  
> take the most direct route from Rx to Tx?
>
> Unfortunately, it's still not passing data thru.  Do I have this  
> correct?  Am I missing curly braces or something?
>
> #if defined(__AVR_ATmega8__)
>     unsigned char c = UDR;
> #else
>     unsigned char c = UDR0;
>       #if defined(WIRING_ECHO_SERIAL)
>             UDR0=c; // write c back to the usart for transmission
>       #endif
> #endif
>
> Thanks,
> -Hans
>
> From: Donald Delmar Davis <ddelmardavis at gmail.com>
> To: "A discussion list for dorkbot-pdx (portland, or)" <dorkbotpdx-blabber at dorkbot.org 
> >
> Sent: Sunday, April 5, 2009 11:25:50 AM
> Subject: Re: [dorkbotpdx-blabber] (2nd try) Programming Help Needed  
> Please
>
> Hans,
>
> Since you are only passing the data through without processing it  
> you should intercept and retransmit the bytes in the serial  
> interrupt routine.
>
> In wiring_serial.c
>
> change
> 	unsigned char c = UDR0;
> to
> 	unsigned char c = UDR0;
> #ifdef WIRING_ECHO_SERIAL
> 	UDR0 = c; //write c back to the Usart Data Register for transmission.
> #endif
>
> and #define WIRING_ECHO_SERIAL=1 somewhere.
>
> 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.
>
> Don.
>
>
>
>
> On Apr 5, 2009, at 11:07 AM, Hans Lindauer wrote:
>
>> Let's try this again, without the attachments.  You can find them  
>> at the provided link.
>>
>> ----- Forwarded Message ----
>> From: Hans Lindauer <armatronix at sbcglobal.net>
>> To: dorkbotpdx-blabber at dorkbot.org
>> Sent: Sunday, April 5, 2009 10:41:47 AM
>> Subject: Programming Help Needed Please
>>
>> 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.
>>
>> In my old program, I just did a Serial.read follower by a  
>> Serial.print, as follows:
>>
>> void loop () {
>>   if (Serial.available() > 0) {
>>     newbyte = Serial.read(); // read the incoming byte
>>     Serial.print(newbyte); // echo the incoming byte
>> ...
>>
>> 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):
>>
>>
>> // Try to read data at serial port & pass anything read to  
>> processing function
>> void Midi::poll(void)
>> {
>>     int c;
>>
>>     // Just keep sucking data from serial port until it runs out,  
>> processing
>>     //  MIDI messages as we go
>>     while((c = serial_.read()) != -1) {
>>         recvByte(c);
>>         serial_.print(c); // ***** pass MIDI data THRU *****
>>     }
>> }
>>
>>
>> // Send Midi NOTE OFF message to a given channel, with note 0-127  
>> and velocity 0-127
>> void Midi::sendNoteOff(unsigned int channel, unsigned int note,  
>> unsigned int velocity)
>> {
>>     int status = STATUS_EVENT_NOTE_OFF | ((channel - 1) & 0x0f);
>>
>>     if (sendFullCommands_ || (lastStatusSent_ != status)) {
>>         serial_.print(status, BYTE);
>>     }
>>
>>     serial_.print(note & 0x7f, BYTE);
>>     serial_.print(velocity & 0x7f, BYTE);
>> }
>>
>>
>> If it helps to see the full library code from http://timothytwillman.com/?page_id=240 
>> , 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).
>>
>> Thanks,
>> -Hans
>> _______________________________________________
>> dorkbotpdx-blabber mailing list
>> dorkbotpdx-blabber at dorkbot.org
>> http://music.columbia.edu/mailman/listinfo/dorkbotpdx-blabber
>
> _______________________________________________
> dorkbotpdx-blabber mailing list
> dorkbotpdx-blabber at dorkbot.org
> http://music.columbia.edu/mailman/listinfo/dorkbotpdx-blabber

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://music.columbia.edu/pipermail/dorkbotpdx-blabber/attachments/20090405/bc44b4ad/attachment.html


More information about the dorkbotpdx-blabber mailing list