I’m separating the controller for the 7 channel audio selector as it’s own build… since it has issues of it’s own to note.
It’s using (from pc to micro logical view) a usb-to-serial converter and pic microcontroller. Also on the pc side is the interface app.
The usb-to-serial converter is a module from DLP design, which uses the FTDI’s FT232BM ic. This is what I had from a while ago, and it still works nicely (haven’t blown it up yet). It allows the use of usb port with the microcontrollers on a pc without the serial/rs232 port. The module is connected in bus powered mode, so it doesn’t require additional power pin hookup. It only needs the rx, tx and gnd (for reference). Since the module is already powered with logic level power, it spits out the serial information that way too. No additional level interface ic’s are needed, just plug in straight into the microcontroller of choice (at least in my case, since they’re both 5V logic).
The simples way to use the usb-to-serial converter on the pc side, is to open up the hyperterminal (or any terminal application). To get this working a bit spiffier (don’t ask), I whipped out a small vb app, using serial port.
I choose to go make a gui app for a few reasons (ranting commences a in a few). Since I still haven’t gotten a handle on the C++ gui, i reverted back to the vb line. It seems that in their wisdom, m$ decided to add back the support for the serial port. I heard the rumors about it after vb6, but haven’t touched it since back in the day. The app was done with the free IDE vb2008express. The commands that I choose to implement and the meanings will be noted a bit later on.
spkr control v1 (340)
(just the app. it is assumed that there are no warranties or guarantees whatsoever. not releasing the source just yet, but should be easy enough to reproduce if you need something for yourself. good luck )
When the app starts up, if it’s 1st time in that location, and/or there’s no .ini setup file, it will create one, and fill it in with the defaults. This will also dump a few hidden settings, that can be manually altered/enabled. The information for the convenient explanation of what is connected to which port is stored in the .ini. It has to be manually edited to change it from defaults. This allows to have a way to alter the information displayed by the app, without recompiling the application. (Hopefully this all makes sense, and it seemed like common sense that I would like to have.)
Another (raw) interface mode is the hyperterminal (or any terminal application), as mentioned previously. For that, simply type in a number, and you get a response. The annoying thing with the hyperterminal is that if you don’t care about the stupid modem dialup, and don’t type in some bs area code, it keeps on harassing you about it on startup. Then when you want to exit it, it keeps on annoying you even more about ‘are you sure that you want to close the connection?’. Well no shit, I clicked the exit button for a reason. Also, there is no indication/reminder what do you have connected where, as opposed in the app. Anyways, enough ranting for now. As mentioned, the command set is noted later.
Lastly, the end of the line interface is the 16f628a microchip pic microcontroller. I have been using this guy on and off for a while now, and had a few still around. In order to minimize power use but not setting it totally in the sleep mode with interrupt wakeups, I set it to run with it’s internal oscillator at 48kHz. This works nice, since it’s still responsive, but I haven’t confirmed the power draw difference yet. The downside to this choice is that the uart is clocked off the ic’s main oscillator… Long story short, I got it to communicate at 300 baud rate. It took some tweaking to the spbrg register, compared to the calculations, but for what I need, it works. With the setup as is, there was just enough i/o pins to get it all done for this version and implementation of the overall project.
spkr controller compiled v4a (322)
(the compiled code to run on the microcontroller. no source just yet. compiled in the microchip’s new mplab-x ide. hope it works for you )
This ic has 18 pins, so roughly the i/o implementation is as follows:
- 2 – power (vcc, and gnd/common)
- 2 – uart (tx, rx, and tap to gnd)
- 7 – input switches, pulled high with external resistors. went with port A, since mclr/reset is on there, and can be used as input only.
- 7 – outputs, spread across remaining port A and port B.
Also the appropriate pins are tapped for the ICSP header. But to use that, it’s a good idea to disconnect the relay connections, so that the relays don’t go chattering to the programming serial/data streams.