Grant Brown | 6 Sep 08:36
Picon

[PIC] RS232 serial example code for a PIC16F84A

Hi List,

Could any one please point me to a RS232 serial example in "C" for a 
PIC16F84A

I have been googling heaps and seem to only find assembler code,

However I need an example suitable for the MicroChip C18 compiler

-- 
Kind Regards
Grant Brown

SiteDoc Pty Ltd
mob: 0412 926 995
www.sitedoc.com.au

--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Xiaofan Chen | 6 Sep 09:12
Picon

Re: [PIC] RS232 serial example code for a PIC16F84A

On Sat, Sep 6, 2008 at 2:37 PM, Grant Brown <grant <at> sitedoc.com.au> wrote:
> Hi List,
>
> Could any one please point me to a RS232 serial example in "C" for a
> PIC16F84A.
>
> I have been googling heaps and seem to only find assembler code,
>
> However I need an example suitable for the MicroChip C18 compiler

Forget about 16F84A if you want to use MPLAB C18. It is only
for PIC18. You can use 18F1320 or similar as good start PICs
if you go for PIC18 and MPLAB C18.

Xiaofan
--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Jan-Erik Soderholm | 6 Sep 10:55
Picon

Re: [PIC] RS232 serial example code for a PIC16F84A

Xiaofan Chen wrote:
> On Sat, Sep 6, 2008 at 2:37 PM, Grant Brown <grant <at> sitedoc.com.au> wrote:
>> Hi List,
>>
>> Could any one please point me to a RS232 serial example in "C" for a
>> PIC16F84A.
>>
>> I have been googling heaps and seem to only find assembler code,
>>
>> However I need an example suitable for the MicroChip C18 compiler
> 
> Forget about 16F84A if you want to use MPLAB C18. It is only
> for PIC18. You can use 18F1320 or similar as good start PICs
> if you go for PIC18 and MPLAB C18.
> 
> Xiaofan

And forget the 84A even if you'd want to say with the PIC16 line...
--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Grant Brown | 6 Sep 15:44
Picon

Re: [PIC] RS232 serial example code for a PIC16F84A

Hi Guys,

Its not so much that I am looking to use a PIC16F84A for a new product.

Its a case of thats the pic that I have on  a demo board so I want to 
use it as a learning curve tool to get myself up to speed programing PIC's.

I just need a couple of 'C" example codes and that will get me started.

Don't want to learn assembler just "C" for PICs.

If I can not use the C18 compiler (as I already have it) which "C" 
compiler should I use for the PIC16F84A device.

Kind Regards
Grant Brown

Jan-Erik Soderholm wrote:
> Xiaofan Chen wrote:
>   
>> On Sat, Sep 6, 2008 at 2:37 PM, Grant Brown <grant <at> sitedoc.com.au> wrote:
>>     
>>> Hi List,
>>>
>>> Could any one please point me to a RS232 serial example in "C" for a
>>> PIC16F84A.
>>>
>>> I have been googling heaps and seem to only find assembler code,
>>>
>>> However I need an example suitable for the MicroChip C18 compiler
(Continue reading)

Olin Lathrop | 6 Sep 15:58

Re: [PIC] RS232 serial example code for a PIC16F84A

Grant Brown wrote:
> Its a case of thats the pic that I have on  a demo board so I want to
> use it as a learning curve tool to get myself up to speed programing
> PIC's.

You could get a better project board, like my ReadyBoard-01
(http://www.embedinc.com/products/ready01).  You can plug in a variety of
PIC 16 and PIC 18, like 16F886, 18F2620, etc.

> I just need a couple of 'C" example codes and that will get me
> started.
>
> Don't want to learn assembler just "C" for PICs.

Really bad idea.  While it's fine to eventually program in C, on these small
systems you always need to be aware of the hardware realities that compilers
try to hide from you.  If you don't learn that first, you'll be constantly
bumping into seemlingly strange and inexplicable problems.  Starting with a
compiler will actually make the learning worse since the compiler will try
to hide the details from you that you need to learn.

If you are new to PICs and don't have a particular project in mind, I
wouldn't bother with the PCI 16 series, and definitely not the archaic and
obsolete 16F84.

********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000.
--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
(Continue reading)

Jan-Erik Soderholm | 6 Sep 21:45
Picon

Re: [PIC] RS232 serial example code for a PIC16F84A

Grant Brown wrote:
> Hi Guys,
> 
> Its not so much that I am looking to use a PIC16F84A for a new product.
> 
> Its a case of thats the pic that I have on  a demo board

Then that demo-board is just as out-dated as the 84A itself.
You are realy doing yourself a disservice by using it.

> so I want to 
> use it as a learning curve tool to get myself up to speed programing PIC's.
> 
> I just need a couple of 'C" example codes and that will get me started.
> 
> Don't want to learn assembler just "C" for PICs.

Now, you'll probably need to know some assembler anyway to be
able to write any reasonable good C code. At least on
the small devices such as the 84A.

> If I can not use the C18 compiler (as I already have it)

"If" ?
If you had done *any* homework at all, you should know
that the C18 compiler is targeted at the PIC18-series
of PIC processors.

> which "C" 
> compiler should I use for the PIC16F84A device.
(Continue reading)

Grant Brown | 7 Sep 08:37
Picon

Re: [PIC] RS232 serial example code for a PIC16F84A

Hi Jan and other's that replied,

Thank you for your feed back. Its a shame that its was so negative.

Whist the PIC16F84A maybe old its not completely useless.

Its interesting given your comments that NSW TAFFE still uses the 16F84A 
to teach MCU programming. Its actually where I got the test board from 
as I have a friend that works in that department.

I also wonder how much industrial equipment is still in use around the 
world that has 16F84A chips in them. Just because something is a bit 
older and slower than the latest u-bueat does not mean it should be 
discarded.

Over many years now I have tought a large number of appretices and that 
has shown me that one does not teach and or help new comers by being 
negative.

Anyway thank you for your assistance and I will take on-board your advice.

Kind Regards
Grant Brown

Jan-Erik Soderholm wrote:
> Grant Brown wrote:
>   
>> Hi Guys,
>>
>> Its not so much that I am looking to use a PIC16F84A for a new product.
(Continue reading)

Jan-Erik Soderholm | 7 Sep 09:17
Picon

Re: [PIC] RS232 serial example code for a PIC16F84A

Grant Brown wrote:
> Hi Jan and other's that replied,
> 
> Thank you for your feed back. Its a shame that its was so negative.

Just trying to help, which you asked for (and
seemed need).

It was not my intention to be "negative", just trying
to give you my point of view. It was free so it's
totaly up to you what you do with it... :-)

When I started with PIC's, I had seen an experimental
board in the paper Elektor using a 16F84A. This was
8-10 years ago. My first question on Piclist was about
the 16F84A, and the replies got me into more current
processors at once. I never wrote a single source
code line for the 84A...

Why someone would think that the 16F84A is the right
processor *today* escapes me.

Jan-Erik.
--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Grant Brown | 7 Sep 11:45
Picon

Re: [PIC] RS232 serial example code for a PIC16F84A

Hi Jan,

As I have said in other reply's, I did not say that the 16F84A is the 
right processor, buts its one that I have and as such I can without 
spending any further dollars start to explore the MCU world.

I have been down the track of spending endless hours and dollars setting 
up system hardware etc and really not achieving a great deal.

I now prefer to use what is on hand as a starting point and then build 
on as required.

20 years of system development and Win 32 programming teaches one a few 
gotchas.

I had a look at some "C" bit banged RS232 serial source code. The fact 
that its not using library macros and the codes more raw  makes it a bit 
easier to trace the logic through.

Kind Regards
Grant Brown

Jan-Erik Soderholm wrote:
> Grant Brown wrote:
>   
>> Hi Jan and other's that replied,
>>
>> Thank you for your feed back. Its a shame that its was so negative.
>>     
>
(Continue reading)

Re: [PIC] RS232 serial example code for a PIC16F84A

While I agree 100% with other's sentiments about the 'F84 being aged and 
not where I would start....

Download a copy of MikroC (or MikroBasic or MikroPascal, if either is 
more to your liking).  The free version is limited to 2kwords of program 
memory.  Since the 'F84 only has 1.75kwords, I don't see this as a 
limitation which will affect you.

Also, what are you using to program the 'F84 with?   The reason why I 
ask is that you should be able to simply pull the 'F84 off the board and 
replace it with a newer pin-compatible chip such as the 'F88 assuming 
your programmer is compatible.   This will cost you almost nothing since 
you can get 2-3 of pretty much any newer chip from Microchip for free 
through their sample program.  

-forrest

--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Wouter van Ooijen | 7 Sep 13:27
Picon

Re: [PIC] RS232 serial example code for a PIC16F84A

> Since the 'F84 only has 1.75kwords,

1k words. 1.75k is in bytes, which is IMHO marketing speak to make a 
chip look better.

-- 

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: www.voti.nl/hvu

--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

David Meiklejohn | 7 Sep 10:12
Picon

RE: [PIC] RS232 serial example code for a PIC16F84A

Grant Brown wrote:
>
> Its interesting given your comments that NSW TAFFE still uses the
> 16F84A to teach MCU programming.

State-run technical colleges aren't exactly dynamic.  It takes a long while
to update course materials, invest in new hardware, ensure that all
instructors are familiar with the new material, and to roll it out
consistently (e.g. assessment) in colleges across the state.

> I also wonder how much industrial equipment is still in use around the
> world that has 16F84A chips in them. Just because something is a bit
> older and slower than the latest u-bueat does not mean it should be
> discarded.

I agree that a lot of older hardware is doing a reliable job in industry.
But it's a different story when it comes to education.  Getting back on
topic, if someone was trying to teach "how to implement a serial port on a
PIC", and they were using a 16F84A, the students would never get to learn
how it's most commonly done in the real world (using a hardware USART
peripheral).  Technical education has to try to keep up with what students
will face when they leave college - always difficult to achieve.

David Meiklejohn
www.gooligum.com.au

--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
(Continue reading)

Byron Jeff | 8 Sep 00:14

Re: [PIC] RS232 serial example code for a PIC16F84A

On Sun, Sep 07, 2008 at 02:37:45AM -0400, Grant Brown wrote:
> Hi Jan and other's that replied,
> 
> Thank you for your feed back. Its a shame that its was so negative.

Grant,

I don't think that it was negative. It was hard won group experience that
members of the list were passing on to you.

> Whist the PIC16F84A maybe old its not completely useless.

I still have one working in a project I installed 10 years ago. I certainly
isn't useless.

> Its interesting given your comments that NSW TAFFE still uses the 16F84A
> to teach MCU programming. Its actually where I got the test board from
> as I have a friend that works in that department.

As Olin pointed out educational institutions often have significant
investments of time and money in their existing infrastrcture.

But as an instructor myself I would point out for the same reasons that
it's a poor starting point.

> I also wonder how much industrial equipment is still in use around the
> world that has 16F84A chips in them. Just because something is a bit
> older and slower than the latest u-bueat does not mean it should be
> discarded.

(Continue reading)

Byron Jeff | 7 Sep 02:46

Re: [PIC] RS232 serial example code for a PIC16F84A

On Sat, Sep 06, 2008 at 09:44:33AM -0400, Grant Brown wrote:
> Hi Guys,
> 
> Its not so much that I am looking to use a PIC16F84A for a new product.
> 
> Its a case of thats the pic that I have on  a demo board so I want to
> use it as a learning curve tool to get myself up to speed programing PIC's.

I understand. But the advice that you've been given is very good advice.
Your sample application is a perfect reason not to use a 16F84A.

Take a read of my comparison page on the subject:

http://www.finitesite.com/d3jsys/16F88.html

> 
> I just need a couple of 'C" example codes and that will get me started.

Again the issue is that because of the limitations on the part, the only
code that you'll find is bitbanged serial. And while that's probably fine
in special circumstances, under ordinary usage, using the hardware USART in
other parts is a much easier circumstance to handle.

> Don't want to learn assembler just "C" for PICs.

I'm not really talking about a language issue. This advice is true no
matter what language you are programming the part.

But as an aside, you should still learn assembly well enough to read it.
Often you'll only get a piece of code in assembly. So having a reading
(Continue reading)

Dario Greggio | 7 Sep 10:27
Picon

Re: [PIC] RS232 serial example code for a PIC16F84A

Byron Jeff wrote:

> For a sample of a SDCC based C application that seems to send morse code via the
> hardware USART, check this code out:
> 
> http://homepage3.nifty.com/ARTWEB/pic1.files/sac2.c

did they every hear of "switch()" ? :) or that compiler won't support it...

-- 
Ciao, Dario
--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Jon Chandler | 8 Sep 02:41
Picon

[PIC]Boot Loader Problems

I use the Mecanique Microcode Loader (version 3.3.0.1) with Swordfish 
Basic and also with Proton Basic.  It makes code development quick and 
easy.  Occasionally, the loader hangs during loading.  When this 
happens, the PIC micro may lock up entirely and not be programmable even 
using ICSP or a "real" programmer under MPLab.  I can't say why this 
happens, and it may happen after less than a dozen loads or not at all 
after 100.

I've recently destroyed 3 18F4550s this way....including the last one I 
had this morning!  The cost starts to add up quickly this way.  I've had 
the problem when using 16F628As too, so it's not limited to a particular 
part.

Any idea whats happening or how to avoid it?  Any idea how to recover 
the apparently dead parts?

As background information, the bootloader works via RS-232, and there is 
a MAX232 chip handling the conversions.  The bootloader is running on my 
desktop PC under WinXP.

Any ideas will be greatly appreciated,

Jon

--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

(Continue reading)

Marcel | 8 Sep 02:58
Picon

Re: [PIC]Boot Loader Problems

Jon Chandler wrote:
> I use the Mecanique Microcode Loader (version 3.3.0.1) with Swordfish 
> Basic and also with Proton Basic.  It makes code development quick and 
> easy.  Occasionally, the loader hangs during loading.  When this 
> happens, the PIC micro may lock up entirely and not be programmable even 
> using ICSP or a "real" programmer under MPLab.  I can't say why this 
> happens, and it may happen after less than a dozen loads or not at all 
> after 100.
> 
> I've recently destroyed 3 18F4550s this way....including the last one I 
> had this morning!  The cost starts to add up quickly this way.  I've had 
> the problem when using 16F628As too, so it's not limited to a particular 
> part.
> 
> Any idea whats happening or how to avoid it?  Any idea how to recover 
> the apparently dead parts?
> 
> As background information, the bootloader works via RS-232, and there is 
> a MAX232 chip handling the conversions.  The bootloader is running on my 
> desktop PC under WinXP.
> 
> Any ideas will be greatly appreciated,
> 
> 
> Jon
> 

No ideas here, sorry.  But what "real" programmers have you tried?  The 
idea that a bootloader can destroy a device is a bit unusual.  Have you 
tried a "real" programmer and clicked on ERASE ENTIRE DEVICE or some such?
(Continue reading)

Jon Chandler | 8 Sep 03:23
Picon

Re: [PIC]Boot Loader Problems

Marcel wrote:
> No ideas here, sorry.  But what "real" programmers have you tried?  The 
> idea that a bootloader can destroy a device is a bit unusual.  Have you 
> tried a "real" programmer and clicked on ERASE ENTIRE DEVICE or some such?
>
> I could see how a poorly performing bootloader could wipe "itself" out 
> and thus not program but being able to do it so well that a real 
> programmer can't fix it is a bit extraordinary. (I don't get to use that 
> word often)
>
>
>   
The "real" programmer is Picstart+ compataible USB from Olimex.  
Sparkfun sells it here:  
http://www.sparkfun.com/commerce/product_info.php?products_id=4

I've tried "reset device" or something like that, and the programmer 
never finishes.  Even after an hour or more, it shows it's still writing 
to the device.

Jon
--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Apptech | 8 Sep 03:02
Picon

Re: [PIC]Boot Loader Problems

> Occasionally, the loader hangs during loading.  When this
> happens, the PIC micro may lock up entirely and not be programmable even
> using ICSP or a "real" programmer under MPLab.

Bob Blick length answer:

If you are not feeding external clock to the clock -input pin then doing so 
may help.

________________

Russell length answer (short):

Such lockouts MAY be due to true death, which is hard to address without 
resorting to Metaphysics.

BUT it can be due to fusebits being set to expect a clocking mode 'which you 
do not have' present at the time. eg it may be wanting an external clock but 
you have a crystal present. Or it may want a crystal mode that will not work 
with the current crystal. Or it may desire external RC etc.

In my experience (non PIC) the most common desired and non present clock is 
an external feed. If your programmers are already feeding external clock to 
the clock in pin then this may not help you. if they aren't then doing so 
may help.

  kind regards

               Russell

(Continue reading)

Jon Chandler | 8 Sep 03:25
Picon

Re: [PIC]Boot Loader Problems

Apptech wrote:
>> Occasionally, the loader hangs during loading.  When this
>> happens, the PIC micro may lock up entirely and not be programmable even
>> using ICSP or a "real" programmer under MPLab.
>>     
>
> Bob Blick length answer:
>
> If you are not feeding external clock to the clock -input pin then doing so 
> may help.
>
> ________________
>
> Russell length answer (short):
>
> Such lockouts MAY be due to true death, which is hard to address without 
> resorting to Metaphysics.
>
> BUT it can be due to fusebits being set to expect a clocking mode 'which you 
> do not have' present at the time. eg it may be wanting an external clock but 
> you have a crystal present. Or it may want a crystal mode that will not work 
> with the current crystal. Or it may desire external RC etc.
>
> In my experience (non PIC) the most common desired and non present clock is 
> an external feed. If your programmers are already feeding external clock to 
> the clock in pin then this may not help you. if they aren't then doing so 
> may help.
>
>
>   kind regards
(Continue reading)

Apptech | 8 Sep 03:50
Picon

Re: [PIC]Boot Loader Problems


> Hmmm.....when using ICSP, no clock is needed is it?  I would think that
> the fuse bits get set during the ICSP process......

That was my point.
IF no clock is needed when things work well, then if it switches to a clock 
demanding mode and has no clock it is, or may be depending on design 
philosophy, dead in the water. This will vary with processor brand and 
probably model within brand. I know it is a real problem with some 
brands.You'd hope of course that an ICSP mode would not need a system clock 
for any reason.

  Russell 

--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Marc Nicholas | 8 Sep 04:13
Picon

Re: [PIC]Boot Loader Problems

Interesting. I use Swordfish but not the bootloader. I use a PICkit 2  
as a programmer most of the time.

I recently had a 20mhz program stop working via ICSP. Switched fuses  
to internal OSC and all was fine.

Did the original poster try this?

-marc

Sent from my iPhone

On 7-Sep-08, at 21:50, Apptech <apptech <at> paradise.net.nz> wrote:

>
>> Hmmm.....when using ICSP, no clock is needed is it?  I would think  
>> that
>> the fuse bits get set during the ICSP process......
>
> That was my point.
> IF no clock is needed when things work well, then if it switches to  
> a clock
> demanding mode and has no clock it is, or may be depending on design
> philosophy, dead in the water. This will vary with processor brand and
> probably model within brand. I know it is a real problem with some
> brands.You'd hope of course that an ICSP mode would not need a  
> system clock
> for any reason.
>
>
(Continue reading)

Wouter van Ooijen | 8 Sep 07:33
Picon

Re: [PIC]Boot Loader Problems

> BUT it can be due to fusebits being set to expect a clocking mode 'which you 
> do not have' present at the time. eg it may be wanting an external clock but 
> you have a crystal present. Or it may want a crystal mode that will not work 
> with the current crystal. Or it may desire external RC etc.

Nice try Watson, but ICSP does not require the 'normal' clock source.

-- 

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: www.voti.nl/hvu

--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Jon Chandler | 8 Sep 08:17
Picon

Re: [PIC]Boot Loader Problems

I tried reprogramming one of the "dead" parts. MPLab reports the following errors:

Configuration Setting           

Configuration Setting            Expected               Received
Oscillator                       HS: USB-HS             EC: EC+RA6, USB-EC

Fail Safe Clock Monitor          Enabled                Disabled

Internal External Switch Over    Enabled                Disabled

Configuration Bits Errors

Configuration Setting            Expected               Received

Brown Out Voltage                2.0V                   4.2V

Configuration Bits Errors

Configuration Setting            Expected               Received

Master Clear Enable              MCLR Enabled,RE3 Dis bledMCLR Disabled,RE3 En
bled

So, mong other things, /MCLR is disabled which is one reason the bootloader
won't function.

Under programmer, I've tried "erase flash device" which happens almost
instantly but does nothing.  Blank check says  the device is not blank.

(Continue reading)

Wouter van Ooijen | 8 Sep 08:41
Picon

Re: [PIC]Boot Loader Problems

Jon Chandler wrote:
> I tried reprogramming one of the "dead" parts. MPLab reports the following errors:

Dunno. Read the chip, does it return all 1's (or 0's)? Put a pulldown or 
pull-up resistor on the PGD pin. Does that affect what you read? If you 
I'd declare the chip dead, but IMHO more likely from mistreatment than 
from a bootloader malfunction.

What is the exact circuit you use at the MCLR pin? Maybe a nice big elco?

-- 

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: www.voti.nl/hvu

--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Jon Chandler | 8 Sep 09:18
Picon

Re: [PIC]Boot Loader Problems

Wouter van Ooijen wrote:
> Jon Chandler wrote:
>   
>> I tried reprogramming one of the "dead" parts. MPLab reports the following errors:
>>     
>
> Dunno. Read the chip, does it return all 1's (or 0's)? Put a pulldown or 
> pull-up resistor on the PGD pin. Does that affect what you read? If you 
> I'd declare the chip dead, but IMHO more likely from mistreatment than 
> from a bootloader malfunction.
>
> What is the exact circuit you use at the MCLR pin? Maybe a nice big elco?
>
>   
On the MCLR pin (on my dev board) there's a 10k pull-up to Vdd (5v), a 
momentary pushbutton to ground and a connection to Vpp on the ICSP 
connector.  There are 0.1 uf bypass caps adjacent to each pair of power 
terminals on the 40 pin DIP and near most of the other chips on the 
board and 100 uf and another 0.1 uf at the voltage regulator output.

The only mistreatment I can see is the possibility of Windows 
interrupting the RS-232 data flow.

When I said "real programmer" I meant a programmer using ICSP (either 
with the chip on the dev board or in the ZIF socket on the programmer) 
as opposed to using the bootloader. This is also the programmer I used 
to get the bootloader into the chip in the first place.

I must have been in error about the bootloader on a '628.  Would you 
believe an 18F242?  That's been a while ago.
(Continue reading)

Jan-Erik Soderholm | 8 Sep 09:39
Picon

Re: [PIC]Boot Loader Problems

Jon Chandler wrote:

> Wouter van Ooijen wrote:
>> Jon Chandler wrote:
>>   
>>> I tried reprogramming one of the "dead" parts. MPLab reports the following errors:
>>>     
>> Dunno. Read the chip, does it return all 1's (or 0's)? Put a pulldown or 
>> pull-up resistor on the PGD pin. Does that affect what you read? If you 
>> I'd declare the chip dead, but IMHO more likely from mistreatment than 
>> from a bootloader malfunction.
>>
>> What is the exact circuit you use at the MCLR pin? Maybe a nice big elco?
>>
>>   
> On the MCLR pin (on my dev board) there's a 10k pull-up to Vdd (5v), a 
> momentary pushbutton to ground and a connection to Vpp on the ICSP 
> connector.

And the ICSP programmer must support "Internal-MCLR" if you have
a chip with that enabled. Is there any particular reason
you do not want to say which programmer you use ?

> I must have been in error about the bootloader on a '628.  Would you 
> believe an 18F242?

I'd believe any modell with "self-write".

Jan-Erik.

(Continue reading)

Wouter van Ooijen | 8 Sep 10:22
Picon

Re: [PIC]Boot Loader Problems

> And the ICSP programmer must support "Internal-MCLR" if you have
> a chip with that enabled. Is there any particular reason
> you do not want to say which programmer you use ?

And besides that your programmer must support Vpp-before-Vdd it must 
also be compatible with your target circuit for this feature. The elco 
on the power might be a problem, depending on the programmer.

-- 

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: www.voti.nl/hvu

--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Picon

Re: [PIC]Boot Loader Problems


----- Original Message ----- 
From: "Jan-Erik Soderholm" <jan-erik.soderholm <at> telia.com>
To: "Microcontroller discussion list - Public." <piclist <at> mit.edu>
Sent: Monday, September 08, 2008 3:39 AM
Subject: Re: [PIC]Boot Loader Problems

> Jon Chandler wrote:
>
>> Wouter van Ooijen wrote:
>>> Jon Chandler wrote:
>>>
>>>> I tried reprogramming one of the "dead" parts. MPLab reports the 
>>>> following errors:
>>>>
>>> Dunno. Read the chip, does it return all 1's (or 0's)? Put a pulldown or
>>> pull-up resistor on the PGD pin. Does that affect what you read? If you
>>> I'd declare the chip dead, but IMHO more likely from mistreatment than
>>> from a bootloader malfunction.
>>>
>>> What is the exact circuit you use at the MCLR pin? Maybe a nice big 
>>> elco?
>>>
>>>
>> On the MCLR pin (on my dev board) there's a 10k pull-up to Vdd (5v), a
>> momentary pushbutton to ground and a connection to Vpp on the ICSP
>> connector.
>
> And the ICSP programmer must support "Internal-MCLR" if you have
> a chip with that enabled. Is there any particular reason
(Continue reading)

Wouter van Ooijen | 8 Sep 11:55
Picon

Re: [PIC]Boot Loader Problems

 > He did, but the posting gremlins must be working overtime.
> According to the time stamp, this response from Jon Chandler was received by 
> me about 7 hours ago:
> <<The "real" programmer is Picstart+ compataible USB from Olimex.
> Sparkfun sells it here:
> http://www.sparkfun.com/commerce/product_info.php?products_id=4

Those dead chips, are they dead when attempting ICSP or also when put in 
the ZIF socket?

(I am a bit unsure about this proggers' ability to do Vpp-before-Vdd ICSP)

-- 

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: www.voti.nl/hvu

--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Jon Chandler | 8 Sep 17:37
Picon

Re: [PIC]Boot Loader Problems

Wouter van Ooijen wrote:
>  > He did, but the posting gremlins must be working overtime.
>   
>> According to the time stamp, this response from Jon Chandler was received by 
>> me about 7 hours ago:
>> <<The "real" programmer is Picstart+ compataible USB from Olimex.
>> Sparkfun sells it here:
>> http://www.sparkfun.com/commerce/product_info.php?products_id=4
>>     
>
> Those dead chips, are they dead when attempting ICSP or also when put in 
> the ZIF socket?
>
> (I am a bit unsure about this proggers' ability to do Vpp-before-Vdd ICSP)
>
>   
I need to check what's actually in the chips after tying to reload the 
boot loader.  The only errors shown in MPLab are with the configuration 
bits.  This leads me to believe that the program has loaded successfully 
otherwise.

But the operative point here isn't about the USB programmer.  It works 
to load the boot loader code and anything else I've tried to load until 
the bootloader fails in the middle of a cycle.

For some reason, the bootloader hiccups in the middle of a load cycle 
once in a while (not related to the number of times a chip has been 
programmed) and after that, the bootloader no longer works and I get 
errors when I try to reload the bootloader using the conventional 
programmer.
(Continue reading)

Wouter van Ooijen | 8 Sep 19:14
Picon

Re: [PIC]Boot Loader Problems

 > I get
> errors when I try to reload the bootloader using the conventional 
> programmer.

So it is about the programmer?

-- 

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: www.voti.nl/hvu

--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Jon Chandler | 8 Sep 20:16
Picon

Re: [PIC]Boot Loader Problems

No, the programmer works fine until a boot load cycle fails.  Then the 
boot loader won't work again and trying to reload the boot loader using 
the programmer fails as well.  When the boot loader fails in a cycle, 
the PIC is damaged or bits set in a way that I can't reprogram the chip.

Thanks for any ideas,

Jon

Wouter van Ooijen wrote:
>  > I get
>   
>> errors when I try to reload the bootloader using the conventional 
>> programmer.
>>     
>
> So it is about the programmer?
>
>   

--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Jon Baker | 8 Sep 22:11
Picon

Re: [PIC]Boot Loader Problems

2008/9/8 Jon Chandler <chandler <at> seanet.com>:
> No, the programmer works fine until a boot load cycle fails.  Then the
> boot loader won't work again and trying to reload the boot loader using
> the programmer fails as well.  When the boot loader fails in a cycle,
> the PIC is damaged or bits set in a way that I can't reprogram the chip.
>
> Thanks for any ideas,

What do you measure on Vdd while the programmer is erasing the chip?

< 4.5v and Bulk Erase won't work.

 --
Jon Baker
--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Wouter van Ooijen | 8 Sep 22:39
Picon

Re: [PIC]Boot Loader Problems

Jon Chandler wrote:
>  When the boot loader fails in a cycle, 
> the PIC is damaged or bits set in a way that I can't reprogram the chip.

Neither is supposed to be possible by software alone. The two much more 
likely causes are
- some error in your hardware, so the chip is fried
- a problem with your programmer, which shows only in some very specific 
circumstances

Maybe send a dead chip to someone with an original PS+? I can give it a 
try, but I'm in the Netherlands.

-- 

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: www.voti.nl/hvu

--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

piclist3 | 9 Sep 00:28

Re: [PIC]Boot Loader Problems

On Mon, 8 Sep 2008, Wouter van Ooijen wrote:

> Jon Chandler wrote:
>>  When the boot loader fails in a cycle,
>> the PIC is damaged or bits set in a way that I can't reprogram the chip.
>
> Neither is supposed to be possible by software alone.

If the bootloader is buggy, it could be getting stuck in an
erase/program loop that exceeds the flash's cell endurance and
destroys the flash.

--
John W. Temples, III
--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Wouter van Ooijen | 9 Sep 07:34
Picon

Re: [PIC]Boot Loader Problems

> If the bootloader is buggy, it could be getting stuck in an
> erase/program loop that exceeds the flash's cell endurance and
> destroys the flash.

That's a good one. The programmer would be able to recognise the chip 
(the chip ID is not in flash), but not erase and/or program the chip.

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: www.voti.nl/hvu

--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Jan-Erik Soderholm | 8 Sep 08:39
Picon

Re: [PIC]Boot Loader Problems

Jon Chandler wrote:

 > Occasionally, the loader hangs
 > during loading.  When this happens, the PIC micro may lock
 > up entirely and not be programmable even using ICSP or a
 > "real" programmer under MPLab.

In what way are an ICSP not an "real" programmer ? And
which are your ICSP and "real" programmers ?

 > I've recently destroyed 3 18F4550s this way...

I do not think you can "destroy" them only by
programming them.

 > I've had the problem when using 16F628As too,...

With a bootloader ? The 628A does not have self-write
to flash, so how did you use them with a boot-loader ?

 > Any idea how to recover the apparently dead parts?

Probably a normal erase-all.

 > So, mong other things, /MCLR is disabled which is one reason
 > the bootloader won't function.

And your ICSP (or "real") programmet must support
"Internal-MCLR", but you know that, right ?

(Continue reading)

cdb | 8 Sep 11:42
Picon

Re: [PIC]Boot Loader Problems

I seem to recall there was a range of 16F parts (87x ?) that would 
occasionally refuse to clear or program using HV on MCLR and the 
remedy was the LVP pin needed to be pulled down. Is it possible this 
'bug' has carried through to an 18F part?

Colin

:: I've recently destroyed 3 18F4550s this way....including the last
:: one I
:: had this morning!  The cost starts to add up quickly this way.  
:: I've had
:: the problem when using 16F628As too, so it's not limited to a
:: particular
:: part.
--
cdb, colin <at> btech-online.co.uk on 8/09/2008

Web presence: www.btech-online.co.uk  

Hosted by:  www.1and1.co.uk/?k_id=7988359

--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Jan-Erik Soderholm | 8 Sep 12:12
Picon

Re: [PIC]Boot Loader Problems


cdb wrote:
> I seem to recall there was a range of 16F parts (87x ?) that would 
> occasionally refuse to clear or program using HV on MCLR and the 
> remedy was the LVP pin needed to be pulled down.

That is a standard procedure on any part that has the
LVP feature. Never let the LPV/PGM pin float during
ICSP. Either a pulldown resistor or let the programmer
handle pin LVP/PGM, if it supports that.

Jan-Erik.

--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Funny NYPD | 8 Sep 23:02
Picon
Favicon

Re: [PIC]Boot Loader Problems

try use some other programmers which you can find or borrow from anyone around, and see if the chip is still alive.

It is hard to damage a chip just by software, especially the 18F family.
There is a high possibility the configuration bits are damaged, but that shouldn't prevent an ICSP
programmer from erasing it.

 Funny N.
Au Group Electronics, New Bedford, MA, http://www.AuElectronics.com

----- Original Message ----
From: Wouter van Ooijen <wouter <at> voti.nl>
To: Microcontroller discussion list - Public. <piclist <at> mit.edu>
Sent: Monday, September 8, 2008 4:39:43 PM
Subject: Re: [PIC]Boot Loader Problems

Jon Chandler wrote:
>  When the boot loader fails in a cycle, 
> the PIC is damaged or bits set in a way that I can't reprogram the chip.

Neither is supposed to be possible by software alone. The two much more 
likely causes are
- some error in your hardware, so the chip is fried
- a problem with your programmer, which shows only in some very specific 
circumstances

Maybe send a dead chip to someone with an original PS+? I can give it a 
try, but I'm in the Netherlands.

--

-- 

(Continue reading)

Jon Chandler | 12 Sep 17:21
Picon

Re: [PIC]Boot Loader Problems - SOLVED

The boot loader mystery is at least somewhat solved.

On the Swordfish Basic forum, the only reply I received was from as user 
who has had similar problems when WinXP decides to interrupt the data 
flow.  When this has happened to him, the boot loader was corrupted but 
reloading it solves the problem.

That sort of confirmed the thought of several people here that my Olimex 
USB PICStart clone is the problem.  I used a friend's PICKit 2 on 3 
"defective" parts to erase the chip and reload the boot loader code, and 
2 of the 3 "defective" parts work great.  The third actually has a 
defective memory location reported by the PICKit software.

Wow, I am impressed by the PICKit 2 programmer!  The Olimex has always 
required some screwing around to make it work properly, usually 
involving un-installing the USB driver and re-booting my PC 2 or 3 
times.  We were done with the 3 chips in less time than it usually takes 
to make the Olimex play nicely.

A PICKit 2 is on order!  Thanks for all the input.

Jon
--

-- 
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist


Gmane