Im doing a project containing AD conversions...basically I have a Microphone running thru a 741 op Amp chip and then into a Pic16f877, out to som LEDS...Basically whats supposed to happen is I speak into the mic and the LED is to act as a sound meter bridge.
here's a picture....
My LED ports are hooked into PORTD of my pic16 the port numbers are 19, 20, 21, 22, 27, 28, 29, 30....
My Mic is hooked into PORTA pin number 2
What I want is for the signal from portA to display on the LEDs in portD
I know i have a signal coming from the mic becuase i hooked up a oscillator to the output to show me the voltage wave forms.
heres my code so far, PLEASE HELP ME IF IM WRONG
Thankyou...
here's a picture....
My LED ports are hooked into PORTD of my pic16 the port numbers are 19, 20, 21, 22, 27, 28, 29, 30....
My Mic is hooked into PORTA pin number 2
What I want is for the signal from portA to display on the LEDs in portD
I know i have a signal coming from the mic becuase i hooked up a oscillator to the output to show me the voltage wave forms.
heres my code so far, PLEASE HELP ME IF IM WRONG
Thankyou...
THANKS TO ALL WILL CONTRIBUTElist p=16f877
#include <p16f877.inc>
org 0x00
goto Start
org 0x04 ;interupt reset address
goto ISR
Start
MOVLW B'00000000' ;PORTD = output
MOVWF TRISD
bsf STATUS, 5 ;bank 1
bcf STATUS, 6 ;bank 0
movlw H'00'
movwf TRISD ;portd outputs
clrf ADCON1 ;left justified, all inputs a/d
bcf STATUS, 5 ;bank 0
movlw B'01000001' ;Fosc/8 [7-6], A/D ch0 [5-3], a/d on [0]
movwf ADCON0
Main
call Anadigi
goto Main
Anadigi
bsf ADCON0,GO ;Start A/D conversion
btfsc ADCON0,GO ;Wait for conversion to complete
movf ADRESH,W ;write A/D result to PORTD
movwf PORTD ;LEDs
return
ISR
movfw ADRESH ;moves results into register
movwf Count1
bcf PIR1, ADIF ; reset int.
bsf ADCON0,2
retfie
Count1 equ 0x30
end