Hi,
I'm developing a disco light rig and need some advice. I want to connect the device to the line out from a CD player (typically 1v RMS peak to peak) via a lowpass filter that is then fed through a peak filter (CCt can be supplied if required) to pin RA2 of a 16F628a PIC
As I already have switches on some PORT A so I only want to set AN2 (RA2) to analogue.
Now I did try and use the POT comamnd, but realised that this wouldn't work as there is no real means of charging acapacitor, so I looked at the ADCIN command, and this is where my lack of experience shows. Here is the top section of my code
Code:
PORTA = 0 ' declare port level BEFORE port direction = safe power-on
CMCON = 7 ' PortA Digital inputs
DEFINE ADC_BITS 8
CCP1CON = 0 ' PWM off
VRCON = 0 ' Voltage reference disabled
OPTION_REG.7 = 0
ADCIN 2, M
As I was using switches on port A I had used CMCON = 7 to make all ports didgital, so how do I change this so that RA2 is analogue and the rest digital. I also assume that I have the correct syntax ADCIN 2, M to put the resulting value (0 - 255) into M? The idea then is to include a line that states if the value of M is above a threshold it will run to the step in the pattern, if its below it simply loops until M is above the threshold.
I welcome your comments
Bookmarks