[PD] Pduino: change read speed

Roman Haefeli reduzierer at yahoo.de
Sun Jan 14 21:40:22 CET 2007


On Sun, 2007-01-14 at 14:31 -0500, Hans-Christoph Steiner wrote:
> On Jan 13, 2007, at 12:27 PM, Roman Haefeli wrote:
> 
> > On Sat, 2007-01-13 at 10:50 -0500, Martin Peach wrote:
> >
> >> Also you could try changing the checkForInput function so that it  
> >> stays
> >> there longer:
> >> Change:
> >> void checkForInput() {
> >>     if(Serial.available()) {
> >>         while(Serial.available()) {
> >>             processInput( (byte)Serial.read() );
> >>         }
> >>     }
> >> }
> >>
> >> to:
> >> void checkForInput() {
> >>     int i = 100;
> >>     while (--i) {
> >>         if(Serial.available()) {
> >>             while(Serial.available()) {
> >>                 processInput( (byte)Serial.read() );
> >>             }
> >>         }
> >>     }
> >> }
> >
> > this worked for me. messages TO the board don't get delayed anymore.
> > many thanks again.
> >
> > :-)
> 
> Did this cause any added latency?  I have seen the problems that you  
> have pointed out, but I haven't had a chance to debug them.  I think  
> the key is to find ways to make things work at the full speed, rather  
> than find workarounds.
> 
> The processInput() stuff should probably be handled using an  
> interrupt so output messages don't get dropped.  The tricky part  
> there is to handle output messages without causing jitter in the  
> input messages.  That's the ultimate goal.
> 
> .hc

here a short (but a bit more detailed) report from my side:

i applied the proposed changes to the firmware-code and uploaded the new
version to the arduino board. after enabling analogIns it was still
possible to send messages to digitalOuts without any additional jitter.
but when i enable more than 3 analogIns, i have the same situation again
(as for now i can live with that). when 4 or more analogIns are enabled,
messages TO the board don't come through anymore and sometimes i even
need to close the connection in order to switch the analogIns off again
(closing [comport] has immediate effect, whereas turning analogIns off
might take up to 10s or more).
i measured again with the patched version, how many values i receive in
pd from the analogIns. Interestingly, i still get around 968 values per
seconds. that means, that martin peach's patch doesn't affect
performance of the arduino board, but increases the amount of enabled
analogIns whitout having jitter from 0 (original version) to 3 (martin
peach's version).

maybe it looks stupid from a coder perspective, but i will test if i can
make it work with all analogIns enabled by increasing the while loop to
200 iterations (1 iteration = no analogIn; 100 iterations = 3 analogIns;
200 iterations = 6 analogIns?)

roman
 







		
___________________________________________________________ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de





More information about the Pd-list mailing list