i have written an adc program for pic12f675 PLEASE CHECK

Started by vaishnavi236 February 18, 2004
I am not sure whether this works but I have made a sincere attempt

FOR ADC

CMCON equ 19h
GPIO equ 05h
STATUS equ 03h
TRISIO equ 85h
ADCON0 equ 1Fh
ANSEL equ 9Fh
ADRESL equ 9Eh
ADRESH equ 1Eh
PIR1 equ 0Ch
Bcf STATUS ,5 ; bit clear file register rpo bank 0(00-7fh)
Clrf gpio
Movlw 07h ; loads w reg with 07h
Movwf cmcon ;sets 0,1,2 to digital o/p & o/p non
inverted
Bsf status,5 ; goto bank 1
Movlw 0Ch ;loads w reg with 0c
Movwf trisio ;pins 3 & 2 are i/ps
; 1=gpio pin as an i/p & 0= gpio pin
as an o/p
bcf status,5 ;back to bank 0
movlw 3Fh
movwf gpio ; switching on pins 0-5
ansel 0h ; a/d rc clock source for 4 mhz
adcon0h ; I AM NOT SURE IF I CAN USE = OR EQU
ADC : bsf ADCON0,1
BTFSC ADCON0, 1; BIT TEST F SKIP IF CLEAR
GOTO ADC
Bcf PIR1,6
% the result should be stored in ADRESL AND ADRESH BUT I DON'T KNOW
HOW TO WRITE IT IN THE PROGRAMMING PLEASE HELP ME WITH LAST PART OF MY PROGRAM AND ALSO PLEASE CHECK IF
THE PROGRAM IS WRITE
PLEASE SEND ME UR VALUABLE SUGGESTIONS
THIS IS MY FIRST PROJECT .

REGARDS, VAISHNAVI



What are you trying to do?
What kind of analog signal are u feeding?
once the coversion is done what are u trying to do with the result?
Since it is only 8 pin IC, are u trying to get the word out?
(serially), or control a heater or something? tell us more.

--- In , "vaishnavi236" <vaishnavi236@y...>
wrote:
> I am not sure whether this works but I have made a sincere attempt
>
> FOR ADC
>
> CMCON equ 19h
> GPIO equ 05h
> STATUS equ 03h
> TRISIO equ 85h
> ADCON0 equ 1Fh
> ANSEL equ 9Fh
> ADRESL equ 9Eh
> ADRESH equ 1Eh
> PIR1 equ 0Ch
> Bcf STATUS ,5 ; bit clear file register rpo bank 0(00-
7fh)
> Clrf gpio
> Movlw 07h ; loads w reg with 07h
> Movwf cmcon ;sets 0,1,2 to digital o/p & o/p non
> inverted
> Bsf status,5 ; goto bank 1
> Movlw 0Ch ;loads w reg with 0c
> Movwf trisio ;pins 3 & 2 are i/ps
> ; 1=gpio pin as an i/p & 0= gpio pin
> as an o/p
> bcf status,5 ;back to bank 0
> movlw 3Fh
> movwf gpio ; switching on pins 0-5
> ansel 0h ; a/d rc clock source for 4 mhz
> adcon0h ; I AM NOT SURE IF I CAN USE = OR EQU
> ADC : bsf ADCON0,1
> BTFSC ADCON0, 1; BIT TEST F SKIP IF CLEAR
> GOTO ADC
> Bcf PIR1,6
> % the result should be stored in ADRESL AND ADRESH BUT I DON'T
KNOW
> HOW TO WRITE IT IN THE PROGRAMMING > PLEASE HELP ME WITH LAST PART OF MY PROGRAM AND ALSO PLEASE CHECK
IF
> THE PROGRAM IS WRITE
> PLEASE SEND ME UR VALUABLE SUGGESTIONS
> THIS IS MY FIRST PROJECT .
>
> REGARDS, > VAISHNAVI





hello,
the solar energy falls on solar array is converted to
electrical energy & a switching regulator is used to regulate the o/p
battery charger is used and its levels/ conditions are sampled by the
adc in pic12f675 and its value is fed to pwm timer0 n timer1 then its
fed to the led for display .it is also fed to mosfet switch .SO
BASICALLY ADC VALUES ARE FED TO TIMERS SO THIS IS JUST A MODULE
WRITTEN FOR ADC ......THE NEXT I HAD SENT FOR PWM ALSO.
PLEASE CHECK THE PROGRAM AND HELP ME MODIFY IT -- In , "burt0072003" <burt007@i...> wrote:
> What are you trying to do?
> What kind of analog signal are u feeding?
> once the coversion is done what are u trying to do with the result?
> Since it is only 8 pin IC, are u trying to get the word out?
> (serially), or control a heater or something? tell us more. >
>
> --- In , "vaishnavi236" <vaishnavi236@y...>
> wrote:
> > I am not sure whether this works but I have made a sincere
attempt
> >
> > FOR ADC
> >
> > CMCON equ 19h
> > GPIO equ 05h
> > STATUS equ 03h
> > TRISIO equ 85h
> > ADCON0 equ 1Fh
> > ANSEL equ 9Fh
> > ADRESL equ 9Eh
> > ADRESH equ 1Eh
> > PIR1 equ 0Ch
> > Bcf STATUS ,5 ; bit clear file register rpo bank 0(00-
> 7fh)
> > Clrf gpio
> > Movlw 07h ; loads w reg with 07h
> > Movwf cmcon ;sets 0,1,2 to digital o/p & o/p non
> > inverted
> > Bsf status,5 ; goto bank 1
> > Movlw 0Ch ;loads w reg with 0c
> > Movwf trisio ;pins 3 & 2 are i/ps
> > ; 1=gpio pin as an i/p & 0=
gpio pin
> > as an o/p
> > bcf status,5 ;back to bank 0
> > movlw 3Fh
> > movwf gpio ; switching on pins 0-5
> > ansel 0h ; a/d rc clock source for 4 mhz
> > adcon0h ; I AM NOT SURE IF I CAN USE = OR EQU
> > ADC : bsf ADCON0,1
> > BTFSC ADCON0, 1; BIT TEST F SKIP IF CLEAR
> > GOTO ADC
> > Bcf PIR1,6
> > % the result should be stored in ADRESL AND ADRESH BUT I DON'T
> KNOW
> > HOW TO WRITE IT IN THE PROGRAMMING
> >
> >
> > PLEASE HELP ME WITH LAST PART OF MY PROGRAM AND ALSO PLEASE
CHECK
> IF
> > THE PROGRAM IS WRITE
> > PLEASE SEND ME UR VALUABLE SUGGESTIONS
> > THIS IS MY FIRST PROJECT .
> >
> > REGARDS,
> >
> >
> > VAISHNAVI