Re: help!!!!! with pic 12f675

Started by Paul James E. August 1, 2003

electromechy1,

Make sure you change the ADCON register to make the AD inputs Digital
I/O's instead of the analog inputs.

Regards,

Jim
> hi guys,
> just wtitten 1st prog as per data sheet,builds ok, problem is when i
> run it in simulator (mplab), trisio loading ok but gpio won't load
> value from w reg....i know i am doing something wrong...but can't find
> sample progs for 12f675...anyway heres my prog
>
> cmcon equ 19h
> gpio equ 05h
>status equ 03h
> trisio equ 85h
>
> bcf status,5 ;goto bank 0
> clrf gpio ;clear gen purp in/out port
> movlw 07h ;load w reg
> movwf cmcon ;set pin 0,1,2 to digital i/o
> bsf status,5 ;goto bank 1
> movlw 8h ;make pins 0,1,2,4,5 outputs
> movwf trisio ;pin 3 can only be input
> bcf status,5 ;back to bank 0
> movlw 3fh ;load w reg
> movwf gpio ;switch on pins
> end ;end program
>
> regards
>
>shaun >
>
> ------------------------ Yahoo! Groups Sponsor
> ---------------------~--> Free shipping on all inkjet cartridge &
> refill kit orders to US & Canada. Low prices up to 80% off. We have
> your brand: HP, Epson, Lexmark & more.
> http://www.c1tracking.com/l.asp?cidU10
> http://us.click.yahoo.com/GHXcIA/n.WGAA/ySSFAA/dN_tlB/TM
> ---------------------------------~->
>
> to unsubscribe, go to http://www.yahoogroups.com and follow the
> instructions
>
> ">http://docs.yahoo.com/info/terms/



hi guys,
just wtitten 1st prog as per data sheet,builds ok, problem is when i
run it in simulator (mplab), trisio loading ok but gpio won't load
value from w reg....i know i am doing something wrong...but can't
find sample progs for 12f675...anyway heres my prog

cmcon equ 19h
gpio equ 05h
status equ 03h
trisio equ 85h

bcf status,5 ;goto bank 0
clrf gpio ;clear gen purp in/out port
movlw 07h ;load w reg
movwf cmcon ;set pin 0,1,2 to digital i/o
bsf status,5 ;goto bank 1
movlw 8h ;make pins 0,1,2,4,5 outputs
movwf trisio ;pin 3 can only be input
bcf status,5 ;back to bank 0
movlw 3fh ;load w reg
movwf gpio ;switch on pins
end ;end program

regards

shaun




hi jim,
thanx for reply, adcon register defaults to zero, i.e, off

regards

shaun


Attachment (not stored)
Sixties Sunflowers .jpg
Type: image/jpeg

Why are you clearing gpio prior to setting up the port?

Note 08h is not 8h, is it?

This works for me on a 12F629 & 675

bcf status,5
movlw 0x07
movwf cmcon
bsf status,5
movlw 0x08
movwf trisio
bcf status,5
clrf gpio

Also, I think the 675 needs to have the ansel setup for analog,
cleared for digital I/O.

Regards, John.
--- In , "shaunundergrad" <electromechy1@a...>
wrote:
> hi guys,
> just wtitten 1st prog as per data sheet,builds ok, problem is when
i
> run it in simulator (mplab), trisio loading ok but gpio won't load
> value from w reg....i know i am doing something wrong...but can't
> find sample progs for 12f675...anyway heres my prog
>
> cmcon equ 19h
> gpio equ 05h
> status equ 03h
> trisio equ 85h
>
> bcf status,5 ;goto bank 0
> clrf gpio ;clear gen purp in/out port
> movlw 07h ;load w reg
> movwf cmcon ;set pin 0,1,2 to digital i/o
> bsf status,5 ;goto bank 1
> movlw 8h ;make pins 0,1,2,4,5 outputs
> movwf trisio ;pin 3 can only be input
> bcf status,5 ;back to bank 0
> movlw 3fh ;load w reg
> movwf gpio ;switch on pins
> end ;end program
>
> regards
>
> shaun




cheers john,
yes your right about the ansel having to be cleared, have it working now (on simulation anyway), i was clearing gpio because this was given as example in data sheet, don't forget i'm a newbie. one thing i haven't sussed yet...does the internal oscillator configured to come when powered up....and how do you know when you've blown a chip??

regards

shaun


Attachment (not stored)
Sixties Sunflowers .jpg
Type: image/jpeg


I'm not sure I understand you question, if you configure the internal
oscillator to run then it runs when the chip powers up. b) I know
I've cooked a chip usually after I've done something stupid like put
15vdc on it instead of 5. Else you can fry a port or an I/O, but
they seem pretty hearty.

Regards, John.

--- In , electromechy1@a... wrote:
> cheers john,
> yes your right about the ansel having to be cleared, have it
working now (on
> simulation anyway), i was clearing gpio because this was given as
example in
> data sheet, don't forget i'm a newbie. one thing i haven't sussed
yet...does
> the internal oscillator configured to come when powered up....and
how do you
> know when you've blown a chip??
>
> regards
>
> shaun




You have to include config word
__CONFIG _CP_OFF & _INTRC_OSC_NOCLKOUT & _PWRTE_ON &
_WDT_OFF & _MCLRE_OFF

Just cut and paste other wise it won't work.

Burt
--- In , "Paul James E." <jamesp@i...> wrote:
>
> electromechy1,
>
> Make sure you change the ADCON register to make the AD inputs
Digital
> I/O's instead of the analog inputs.
>
> Regards,
>
> Jim >
> > hi guys,
> > just wtitten 1st prog as per data sheet,builds ok, problem is
when i
> > run it in simulator (mplab), trisio loading ok but gpio won't
load
> > value from w reg....i know i am doing something wrong...but
can't find
> > sample progs for 12f675...anyway heres my prog
> >
> > cmcon equ 19h
> > gpio equ 05h
> >status equ 03h
> > trisio equ 85h
> >
> > bcf status,5 ;goto bank 0
> > clrf gpio ;clear gen purp in/out port
> > movlw 07h ;load w reg
> > movwf cmcon ;set pin 0,1,2 to digital i/o
> > bsf status,5 ;goto bank 1
> > movlw 8h ;make pins 0,1,2,4,5 outputs
> > movwf trisio ;pin 3 can only be input
> > bcf status,5 ;back to bank 0
> > movlw 3fh ;load w reg
> > movwf gpio ;switch on pins
> > end ;end program
> >
> > regards
> >
> >shaun
> >
> >
> >
> >
> > ------------------------ Yahoo! Groups Sponsor
> > ---------------------~--> Free shipping on all inkjet cartridge &
> > refill kit orders to US & Canada. Low prices up to 80% off. We
have
> > your brand: HP, Epson, Lexmark & more.
> > http://www.c1tracking.com/l.asp?cidU10
> > http://us.click.yahoo.com/GHXcIA/n.WGAA/ySSFAA/dN_tlB/TM
> > ------------------------------
---~->
> >
> > to unsubscribe, go to http://www.yahoogroups.com and follow the
> > instructions
> >
> > ">http://docs.yahoo.com/info/terms/