In keeping with tradition, I will reply to my own post again.
There are three AIN example files posted, ain_example1_v1_3.zip, ain_example2_v1_3.zip, and ain_example3_v1_3.zip.
ain_example1_v1_3.zip
Purpose:
;Â Â -> Sends a MIDI event (CC #7) when first pot (#0) is moved
;Â Â -> Prints the value on LCD
This example turns off multiplexing. If you have AIN inputs A0-A5 wired as shown in the AIN PDF, and you run this
program hoping to check your AIN board, you will find that it only responds when you apply a signal to pin 13 on
the 4051 chip. This is input A6, NOT A0. I thought I had a wiring problem, but if you look at the datasheet for the
CD4051B, pin thirteen is channel 0. In fact, the channel assignments are all mucked up relative to their designation
in MBHP_AINX4_V2a.pdf.
Now, I thought I had to rewire everything… unless the _software_ untangled this mess for me. So I modified
ain_example1_v1_3.zip in the following way so that it would be relevant to the midibox SID.
USER_Init
movlw 0x06 ; enable the first 6 analog inputs
call MIOS_AIN_NumberSet
;; use the AIN 4051 multiplexers
movlw 0x03 ; 8 bit resolution
call MIOS_AIN_Muxed
I ran the program, and put an LFO into each input A0-A5 as identified in the AIN PDF, and what do you know
- it works beautifully! I can watch the input value oscillate slowly, exactly as it should, and it gets the input
channel number right. So - multiplexed, the A0-A5 inputs are labeled properly. Unmuxed, they’re quite different.
I modified the Midibox SID v1.7 input from
#if ENABLE_AIN_LFO_WAVEFORM
movlw 0x06 ; enable the first 6 analog inputs
call MIOS_AIN_NumberSet
call MIOS_AIN_UnMuxed ; not multiplexed
movlw 0x03 ; 8 bit resolution
#endif
to
#if ENABLE_AIN_LFO_WAVEFORM
movlw 0x06 ; enable the first 6 analog inputs
call MIOS_AIN_NumberSet
movlw 0x03 ; 8 bit resolution
call MIOS_AIN_Muxed ; multiplexed
#endif
Minor changes, but… why would you enable 6 inputs, and then have it unmuxed? And, shouldn’t the
movlw come before the call statement?
Now my SID is capable of being modulated, and the inputs are numbered correctly.
I wish that everything were running perfectly, but… it sounds like the modulation is hopping
values from 0 to the AIN input value and back. For example - if I run a ramp into AIN0, with
values
0,5,10,15,20,25,30,35,40,45 etc.
It seems to be modulating the pitch like this:
0,5,0,10,0,15,0,20,0,25, etc.
Really rough sounding. The modified ain_example1_v1_3.zip shows that the CORE is getting the
input right, so I would guess that somehow, it just isn’t sending exactly these values to the pitch
of the oscillator. I can hear the pitch rise and fall, with the un-shifted note underlying it. Kind of
like wavetable arpeggios on a SID, oscillating between pitches really fast.
Since my posts on this subject have been met with silence - I’m beginning to wonder if anyone
uses the AIN inputs as LFO’s on their SID?
-gerald