POV-Ray : Newsgroups : povray.off-topic : For a price : Re: For a price Server Time
5 Sep 2024 15:24:30 EDT (-0400)
  Re: For a price  
From: Sabrina Kilian
Date: 20 Aug 2009 11:26:05
Message: <4a8d6b0d@news.povray.org>
Invisible wrote:
>>> You realise that MIDI is a serial communications protocol, right? It's
>>> not like you just connect each sensor to a different pin on the plug;
>>> you need some fairly elaborate electronics in there.
>>
>> At the very simplest form, one input pin on any ol' micro-controller for
>> each pedal.
> 
> Micro-controller? Ouch.
> 
>> Controller can just poll each
>> pin, or batches of pins where speed is an issue, and create the MIDI
>> packet to send.
> 
> Not quite.
> 
> MIDI sends note-on and note-off messages, so the controller needs to
> "remember" the previous pin state to decide whether anything has changed.
> 

So, you need RAM, no problem. Poll the pins, compare the state, and
construct the packets to send. Even without RAM, a few bytes of cache
would be enough. Even with 25 pedals and 10-bit ADC, that is still only
250 bits.

>> Just make sure to have an optoisolator on
>> . . . crud, it has been forever since I did anything MIDI, I don't
>> remember if it is on the TX or RX wire.
> 
> MIDI is simplex, not duplex. A single MIDI cable carries messages in one
> direction only. And I'm pretty sure it's the receiving end that's
> supposed to be opto-isolated. (I.e., I don't have to do anything.)
> 

> 

Shows how long it's been since I've done anything with MIDI. But if you
have a controller, why not have it capable of receiving MIDI
instructions? May want to use it for something else later.

>> Elaborate? $8 micro-controllers are absurdly powerful now, and very easy
>> to program. Granted, most of the time it is assembly or some odd looking
>> java-esque language, but GCC will cross-compile to AVR and ARM chips.
>> The soldering might be tough, but for a prototype just breadboard it.
> 
> 1. I'd be very surprised if you can buy any sort of microcontroller for

> 

Atmel's ATmega168 in DIP form are under $3 each. The 128, which has
enough digital I/O pins for 25 pedals is under $10. For 25 analog pins,
you may have to look elsewhere. Off hand I can't think of any, so
multiplexers might be the only way. Still, a $3 controller and a few $1
mux chips.

> 2. A microcontroller on its own isn't going to do much good - unless I
> also go out and buy a RAM ship and either a PROM and burner or some
> flash RAM. I would think a PIC would be the way to go.
> 

Most of them, now days, have built in flash memory for code, EEPROM that
the code can store stuff in over power loss, and built in RAM. The 168
has 1kB of RAM, 512B EEPROM, built in serial and 16kB of flash.

For programing, serial to a simple JTAG programmer (6 wires, right from
the serial port to certain pins) works great. If you prefer USB, look at
something like the Arduino, with built in USB, a custom bootloader, and
an development environment.

> 3. Even a PIC is probably vastly too difficult to program. And if it
> doesn't work? It's not like you can debug it...

Why can't you debug them? Connect it to a PC via USB or serial, throw
some printf statements in to chat over the serial conncetion, and watch
what happens. Or use an in circuit debugger. It isn't what programmers
normally think of as debugging, but you could have it print blocks of
memory out, and only work through the next step of code when you send a
certain command. Takes longer to program that way. Some chips probably
have in chip debuggers, I think I have seen that on some Motorola or
another.

For easy programing, assuming C doesn't feel too low-level, take a look
at the Arduino. Lots of different forms, from really small breadboard
units, to full programers, a variety of chips for various pin counts,
with or without USB and headers for lots of external devices, and for
the most part they are around $30; 10 for breadboard kits, around 50 or
60 for larger pre-made boards with lots of I/O pins and RAM.


All prices are in USD, and as you can guess I use AVRs a lot more than
most of the other chips. I don't want to start the avr/pic/arm/mips holy
war here, those are just the chips I know.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.