Hi Malcolm. I did something similar a while back with a 12F675 and a portable radio. This program flashes several LED's with the beat of the music. Audio was taken from the audio feed to the volume control. The use of the ADC command automatically converts the port to analog.
ANSEL = 0 'all inputs digital
CMCON = 7 'comparators off
DEFINE OSCCAL_1K 1 ' Set OSCCAL for 1K device to accurize osc
@ DEVICE MCLR_OFF, INTRC_OSC, WDT_ON, BOD_ON, PWRT_ON, PROTECT_ON
TRISIO = %11111111 ' all inputs for now
'high & low commands convert to outputs
X VAR BYTE 'adc variable
START:
ADCIN 0, X
IF X > 2 Then High GPIO.2 'TURN ON LED'S ON GPIO.2
IF X <=2 Then Low GPIO.2 'OFF LED'S
GOTO START




Bookmarks