PIC 18F6620 don't work

Thread Starter

a21

Joined Mar 24, 2010
8
Hi,
I have a simple program for testing PIC 18F6620:

void main()
{
SET_TRIS_G(0x00);
OUTPUT_HIGH(PIN_G3);
while(1);
}

It is done in CCS. I am using 20Mhz crystal with 16pF capacitors. The oscillator is set to HS. The problem is that the PIC is not working. G3 is low. I tried to insert NOP in 0x00, but this didn't help.

EDIT: I checked OSC1 and OSC2 with oscilloscope and there is 80mV constant level.
 
Last edited:

Thread Starter

a21

Joined Mar 24, 2010
8
Here is my .h file

Rich (BB code):
#include <18F6620.h>
#device adc=8

#build (reset = 0x0002)
#ROM 0 = {0x0000} 

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
#FUSES HS                       //High speed osc
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOOSCSEN                 //Oscillator switching is disabled, main oscillator is source
#FUSES NOBROWNOUT               //No brownout reset
#FUSES BORV25                   //Brownout reset at 2.5V
#FUSES PUT                      //No Power Up Timer
#FUSES NOCPD                    //No EE protection
#FUSES STVREN                   //Stack full/underflow will cause reset
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT                    //Program memory not write protected
#FUSES NOWRTD                   //Data EEPROM not write protected
#FUSES NOCPB                    //No Boot Block code protection
#FUSES NOEBTRB                  //Boot block not protected from table reads
#FUSES NOEBTR                   //Memory not protected from table reads
#FUSES NOWRTC                   //configuration not registers write protected
#FUSES NOWRTB                   //Boot block not write protected

#use delay(clock=20000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,stop=1)
 

t06afre

Joined May 11, 2009
5,934
Then you program your device with a PICKIT 2, I am almost sure a verify is performed after the writing. If any error you will be warned. If you can perform a write cycle you can be pretty sure the MCU is OK. I would look for problems in the coding. And of course the hardware setup.
 
Last edited:

Thread Starter

a21

Joined Mar 24, 2010
8
I made new PCB and checked all connection, but it doesn't work. Here is my asm code (generated from CCS)
 

Attachments

Top