Searching \ for '[PIC]: PS+ problem programming a 16F628' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devprogs.htm?key=programming
Search entire site for: 'PS+ problem programming a 16F628'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: PS+ problem programming a 16F628'
2002\08\23@075952 by John Walshe

flavicon
face
Hi Folks,
   has anyone had problems programming a 16F628 with Picstart (V3.00
firmware) via MPLAB (v5.7). For some reason the PS+ is sending the same
config word ( all 1's )to the device no matter what selection I set in
MPLAB. It is  like MPLAB is failing to pick up the settings from the
configuration bits dialog box.
I see this with two different PS+ programmers so I don't suspect the
programmer, although having said that they both are V3.00 firmware so
maybe.....

John
***************************************************************
spam_OUTJohn.WalsheTakeThisOuTspaminpactmicro.com

INPACT MICROELECTRONICS (Irl) Ltd
21A Pouladuff Road,
Cork,
Ireland,

Tel: +353 21 4318296
Fax: +353 21 4318980

WWW.INPACTMICRO.COM
***************************************************************

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


2002\08\23@080824 by James.Hyslop

flavicon
face
You might want to try manually setting the config. bits in the code. When
you say "configuration bits dialog box" are you referring to the
"development mode" menu?  I believe this is for simulation and debugging,
and does not actually set the bits.

James Hyslop



{Original Message removed}

2002\08\23@083610 by Olin Lathrop

face picon face
> You might want to try manually setting the config. bits in the code. When
> you say "configuration bits dialog box" are you referring to the
> "development mode" menu?  I believe this is for simulation and debugging,
> and does not actually set the bits.

The dialog that pops up when you try to program with a Picstart+ does effect
the config word.  That's its job.  It allows you to specify the production
settings in the code, but override them for individualy programming sessions
for the purpose of debugging.  The settings in the code then become the
default for the dialog.  I find that a handy way of verifying that the
config word is specified properly in the code.

However, I'm not sure what happens if the config word is not specified at
all (no __CONFIG directive).  Perhaps then it's left alone, which would
leave it all 1s after the erase.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

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


2002\08\23@102540 by John Walshe

flavicon
face
Hi Olin,
   As you suspect I don't have the config directive - I usually use the
picstart dialog box. So seeing your comment I went to the PICC manual and
got the format. I tried this in my code just to see
#include <pic16f6x.h>
__CONFIG( PWRTE|MCLRE|UNPROTECT );

and it won't compile! saying I'm missing a )
I can't for the life of me see where it is missing!
any ideas?

John

oh btw, I'm using HiTech PICC v7.86PL3 so the pipe symbol is correct in the
command I believe
***************************************************************
.....John.WalsheKILLspamspam.....inpactmicro.com

INPACT MICROELECTRONICS (Irl) Ltd
21A Pouladuff Road,
Cork,
Ireland,

Tel: +353 21 4318296
Fax: +353 21 4318980

WWW.INPACTMICRO.COM
***************************************************************

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


2002\08\23@110456 by myke predko

flavicon
face
Hi John,

Which column does the "__CONFIG(" statement start on - it cannot be the
first one, it should be the second or another one.

Three other things to be aware of:

1.  Where did you get the constants in the config statement?  Looking at my
copy of pic16f6x.h, I see:

/*watchdog*/

#define WDTEN 0xFFFF // enable watchdog timer

#define WDTDIS 0xFFFB // disable watchdog timer

/*power up timer*/

#define PWRTEN 0xFFF7 // enable power up timer

#define PWRTDIS 0xFFFF // disable power up timer

/*MCLRE section*/

#define MCLREN 0xFFFF // memory clear enable

#define MCLRDIS 0xFFDF // disable memory clear

//alternately

#define MCLRIO 0xFFDF // use MCLRDIS

/*brown out reset*/

#define BOREN 0xFFFF // enable brown out reset

#define BORDIS 0xFFBF // disable brown out reset

/*low voltage programming*/

#define LVPEN 0xFFFF // low voltage programming enable

#define LVPDIS 0xFF7F // low voltage programming disabled

/*data code protection*/

#define DP 0xFEFF // protect the data code

// alternative definitions

#define DATPROT 0xFEFF // use DP

#define DATUNPROT 0xFFFF // use UNPROTECT

/*code protection*/

#define UNPROTECT 0xFFFF // do not protect the code

#define PROTECT 0xC3FF // protect the program code

/* Code protection for 2K program memory */

#ifdef _16F628

#define PROTECT75 0xD7FF /* Protects from 0200h-07ffh */

#define PROTECT50 0xEBFF /* Protects from 0400h-07ffh */

#else /* Code protection for 1K program memory */

#define PROTECT50 0xD7FF /* Protects from 0200h-03ffh */

#endif

/*osc configurations*/

#define ER 0xFFFF /* external resistor, CLKOUT on CLKOUT pin, R on CLKIN */

#define ERIO 0xFFFE /* external resistor, IO fn on CLKOUT pin, R on CLKIN */

#define INT 0xFFFD /* internal resistor/capacitor, CLKOUT on CLKOUT pin, IO
on CLKIN */

#define INTIO 0xFFFC /* internal resistor/capacitor, IO fn on CLKOUT pin, IO
on CLKIN */

#define EC 0xFFEF /* external clock in, IO fn on CLKOUT pin, CLKIN on CLKIN
*/

#define HS 0xFFEE /* high speed crystal */

#define XT 0xFFED /* crystal/resonator */

#define LP 0xFFEC /* low power crystal */

From this, I would be expecting that you would want to be using: PWRTEN,
MCLREN and UNPROTECT.  Only the last one matches what I have.



2.  You must AND the values in the __CONFIG statement together, not OR them.
If you OR them (see the values above), you will get the 0x03FFF that you're
seeing now.



3.  You should always define *EVERY* configuration fuse, even if you're not
using them.  For the PS+, I would recommend something like:



__CONFIG(WDTDIS & PWRTEN & MCLREN & BORDIS & LVPDIS & DATUNPROT & UNPROTECT
& XT)



In this, I have defined the WDT, PWRTE, _MCLR Enabled (comments in
pic16F627.h are wrong), Brown out Reset Disabled, Low Voltage Programming
Disabled, No protection for Data EEPROM, No Code Protection and XT
oscillator.



Hopefully this helps.



Good luck,



myke

{Original Message removed}

2002\08\23@115712 by John Walshe

flavicon
face
Hi Mike,
   The first _ was on the first column so I shifted it progressively to the
right, compiling with each step, but to no avail.
The reason for the different terms is because I am using an older version of
PICC than the one you are using - I've got 7.87PL3 and I'm guessing you are
lucky enough to have V8PL4!

I've just fixed it!

The cause was that I was including pic16f6x.h which didn't have the __CONFIG
macro defined - this is in pic.h.
When I included pic.h (and having already defined the processor at the top
of my code), it pulled in the pic16f6x.h for me. Thus I now have my __config
macro and all the normal declarations and everything compiles again as it
should.

The example in the manual is misleading in that it shows the inclusion of
the device include file but says nothing about the pic.h needing to be
included also. The error callout didn't help because it was trying to
indicate that I had an error in a function declaration!

Thanks to everyone for their help, now I can get back to seeing if I can
successfully program the chip again!
John
***************************************************************
John.Walshespamspam_OUTinpactmicro.com

INPACT MICROELECTRONICS (Irl) Ltd
21A Pouladuff Road,
Cork,
Ireland,

Tel: +353 21 4318296
Fax: +353 21 4318980

WWW.INPACTMICRO.COM
***************************************************************

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


2002\08\23@161948 by Olin Lathrop

face picon face
> __CONFIG( PWRTE|MCLRE|UNPROTECT );
>
> and it won't compile! saying I'm missing a )
> I can't for the life of me see where it is missing!
> any ideas?

Not for C.  It has always worked fine for me in assembler.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

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


2002\08\23@170928 by Eisermann, Phil [Ridg/CO]

flavicon
face
       I missed the start of this thread. But if this is HiTech, three
observations.

       First, its PWRTEN, not PWRTE. Second, i do not see any declaration
for MCLRE or MCLREN. The definitions are found in the PIC1662x.h file.
Third, you need AND the FLAGS, not OR them. Again, looking at the include
file and the datasheet, it's easy to see. For example, PRWTEN = 0xFFF7. the
datasheet says bit 3 of of configuration word has to be CLEAR to enable
PWRT. so the CONFIG(); directive selectively turns bits off. Thats why you
need to AND insead or OR. make sense?



{Quote hidden}

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


2002\08\26@103531 by John Walshe

flavicon
face
Hi guys,
   Having gotten over the hurdle of the __config macro I am still coming up
with the programming bumpstop. I'm keeping this thread separate from the
other 16f628 programming thread 'cos my problem is with the Picstart+ using
high voltage programming.

At this stage I have two programming set-ups - PS+ with v3.00.00 and PS+
with v 2.30.00. Two mplabs v5.20.00 and v5.70.00.And of course I have
ive( yes 5!) 16f628s all showing the same problem!

When the IC is empty (read as virgin IC) the programming process works fine
(and the chip runs - apart for a bug!). configbits HS,PWRTon,code prot OFF,
MCLR enabled, everything else disabled.
When I try to reprogramme the IC with a new programme, it fails saying that
the processor is code protected!. I try read the device and the config bits
are read as LP,codeprot all, mclr disabled,PWRTon &everything else disabled.
BUT however I can still read out the code!
The Program memory window is not an artifact of the previous programming
cycle 'cos I purposefully cleared it to check this.
So it would appear that the code protection is failing on these ICs ( that
should get microchip's attention ! )

Using the "Erase Flash Device" button has no effect.

Now if I force the reprogramme cycle, what happens is that new code is
written in , in blocks of 16 words interspersed with blocks of 16 "0810".
This is very regular all the way up through the IC.

This one has me baffled. Has anyone got any ideas of what might be going on
here.

John

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\08\27@064727 by John Walshe

flavicon
face
Hi y'all,
   Fixed it ! The problem was caused by a 100nF decoup cap across the +5V
to gnd. Cap in -> no program, Cap out -> program!
I have had this in for many other projects (usually '877 or '876) without
any problems but I guess the line on the PS+ driving the +5v  for the '628
just hasn't got what it takes. The logic analyser indicated the timing was
right but I guess it's trip level and that required by the 628 were not the
same.

Anyway it is just something to watch out for when using a PS+ to "ICSP"
program a '628. (I know - the PS+ is not meant for ICSP - but I have had no
problems until now because I keep my lines very short ~1-2cm).

John

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


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