News:

Let's find out together what makes a PIC Tick!

Main Menu

Splitting an 8-bit port in two

Started by glenlivet, May 02, 2025, 07:33 PM

Previous topic - Next topic

glenlivet

I'm designing a 5-octave (61-notes) keyboard for an analog synthesizer project. The Demux part of the actual keybed to determine which key/note was pressed is pretty straight forward. Here's where it starts to get hairy. I want the output of the keyboard to be old school 1-Volt/Octave analog- standard for all synth VCO's.
The way I achieved this is to use a voltage divider made up of a string of 0.01% resistors (12 per octave) driven by a fixed current source that will set the division of the voltage divider at 1/12 volt per step or 0.08333 volts. The way I pick off the correct note voltage from the divider is with four 16 to 1 analog demultiplexers. I'm attempting to keep the pin count on the PIC as low as possible. Each demultiplexer rquires four address lines and one enable line to put the voltage on the common buss. So finally- is there a way to configure the lower four bits b0 to b3 of a port as a four bit data bus to set the value of the demux input pin and assign a port name to it and also assign an alias to the remaining upper four bits that will be used as an enable for each of the four demux chips? I have the prototype working on an 8-bit port by using the lower 4-bits as the demux address and the upper 4-bits assigned as an enable to each of the four demultiplexers. I output the value of the input pin on the demux that has the selected note and then do an "and" to set the enable bit b4-b7 for the correct demuxer that has the note but the code is really getting unwieldy and I only have 2 octaves up and running.