Serial object and custom controllers

    Jan 08 2007 | 6:42 am
    Hello all,
    I’m wondering what experience people have with the serial object. I have a midi/USB control board (home-made) that will eventually have a number of potentiometers, rotary encoders, and buttons. The chip programming is in C and everything (so far, two pots, two rotaries) works fine in Hyperterminal on XP.
    I send all controller data with two indices preceding: board number (as there will eventually be multiple ones in a USB hub) and controller number. Then comes the 8-bit value. Like I said, seems to work fine in Hyperterminal. However, the Max patch I have for reading the data has serious latency issues. Output comes only once per second, even though I’m banging the serial object much more often than that. Also it essentially locks up the patch (not entirely but it’s beyond sluggish).
    Anyone have any ideas where the problem might be? I would post the patch but without the control board it’s not so useful.
    Also wondering if anyone has tips on how to deal with the incoming data—that is, to make sure they are received in the correct list size / chunk. I sent serial a “chunk 3” but it’s very inconsistent. I thought maybe zl group 3, however the incoming data is so sluggish that this doesn’t work either. The serial *characters received* value indicates that it’s getting a ton of data, but all I see are the once-per-second updates. Perhaps a termination character other than a new line / line feed?
    The data in is ASCII—so I thought I’d use atoi to convert to the correct integer value. However, atoi converts *each character* in the ASCII value to its corresponding integer value, which was a bit unexpected…
    If this doesn’t work out I’ll use the MIDI port on the board instead, which I imagine Max is better-equipped for. However, using USB has many advantages like speed and using cheap hubs instead of MIDI merges.
    4.6.2, XP, baud rate 115200
    Thanks! --CJ