Searching \ for '[PIC:] Problems with PIC18F2220' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/microchip/devices.htm?key=18F
Search entire site for: 'Problems with PIC18F2220'.

Exact match. Not showing close matches.
PICList Thread
'[PIC:] Problems with PIC18F2220'
2004\06\08@125628 by Serge Maheu

picon face
I been using PIC16F84A with no problem. All i want to do is a simple program to
light up a led on a port (any ports, A, B or C). It seems like my code is not
working at all, and really don't know what is the mistake, anyone could help ?
I'm using an external crystal. I'm just not sure about those __CONFIG lines....
could it be the problem? Or is there any special registers to initialise?



     list p=18f2220
     include "P18F2220.INC"

     __CONFIG  _CONFIG1H, _IESO_ON_1H & _FSCM_OFF_1H & _HS_OSC_1H
     __CONFIG  _CONFIG2L, _PWRT_OFF_2L & _BOR_OFF_2L & _BORV_20_2L
     __CONFIG  _CONFIG2H, _WDT_OFF_2H & _WDTPS_32K_2H
     __CONFIG  _CONFIG3H, _MCLRE_ON_3H & _PBAD_DIG_3H & _CCP2MX_C1_3H
     __CONFIG  _CONFIG4L, _DEBUG_OFF_4L & _LVP_OFF_4L & _STVR_OFF_4L

     __CONFIG  _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L
     __CONFIG  _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
     __CONFIG  _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L
     __CONFIG  _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H
     __CONFIG  _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L
     __CONFIG  _CONFIG7H, _EBTRB_OFF_7H


       org     00000h
       goto    Start

       org     00020h
Start

   movlw 0x07
   movwf CMCON     ;turn comparators off

   movlw  0x00
   movwf  ADCON0
   movlw  0x0F
   movwf  ADCON1   ;initialise ports for digital

   clrf PORTA
   clrf PORTB
   clrf PORTC

   clrf TRISA
   clrf TRISB
   clrf TRISC

Loop

   movlw  0xFF
   movwf  PORTA
   movwf  PORTB
   movwf  PORTC

   goto        Loop
   END         ; directive indicates end of code

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body

2004\06\08@135813 by Mike Hord

picon face
Near as I can tell, that's a-okay code-wise and config-wise.
Looks pretty similar to the code I have for a 2220.

All that's left now is to check up on the circuit...

Do you have a bypass capacitor between Vdd and Vss?
Do you have 'MCLR pulled high?
Is your oscillator oscillating?
Capacitors to ground on the OSC pins?

You MAY be overdriving the crystal...The HS osc setting
is usually for higher crystal frequencies; try XT if you have
a 4 MHz in your circuit.

Mike H.

{Quote hidden}

_________________________________________________________________
Getting married? Find great tips, tools and the latest trends at MSN Life
Events. http://lifeevents.msn.com/category.aspx?cid=married

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamKILLspammitvma.mit.edu with SET PICList DIGEST in the body

2004\06\08@155943 by Serge Maheu

picon face
I'm using a 8MHz crystal. I use the same crystal to drive another PIC
(PIC16F84A) on my circuit board which is working pretty fine, except that when
i connect this crystal for the PIC18F2220, it seems to do nothing. 'MCLR is set
to 5V, and got capacitor between Vdd and VSS, and got capacitors on ground for
the crystal. So I'm assuming that the problem has something to do with
registers in the micro. I'm looking for some code examples over the web for
this micro, but cannot find any. Anybody could provide me a simple code example
in assembler working fine for a PIC18f2220 ?  I'm using MPLAB with the picstart
plus programmer...

Thanks in advance!


Serge







Selon Mike Hord <.....gaidinmdKILLspamspam.....HOTMAIL.COM>:

{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email @spam@listservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body

2004\06\08@203626 by Mike Hord

picon face
Do you have an o-scope?  Can you verify oscillation?

One other thing I spot:  use of PORTx instead of LATx.  Writes for
output ports should go to the respective LAT register, and reads
should come from the PORT register.

Also, try writing a '10101010' to the registers instead of 0xFF.

Mike H.

{Quote hidden}

_________________________________________________________________
Get fast, reliable Internet access with MSN 9 Dial-up   now 3 months FREE!
http://join.msn.click-url.com/go/onm00200361ave/direct/01/

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservspamTakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body

More... (looser matching)
- Last day of these posts
- In 2004 , 2005 only
- Today
- New search...