Maker Pro
Maker Pro

my own programming of the pic16f628

L

larrykeegan

I have to admit I posted this info
elsewhere, but here it is

because of my background in programming and electronics
I am determined to send a line of random data to
program memory and then to READ it back confirming
that the prgrmng was successful

I am utilizing 160 pgs of elect specs & 20 or more pgs
programming spec's found on the internet.

I've noted some problems people have had with
more sophisticated programming software

so far I've changed my hardware (homebrew)
twice

when I program my one line of random data into
pgm mem, I then try to read it back, mainly with an LED
option to look at data appearing at the DATA pin
when it is in output mode

so far no signs of life with my PIC

I have brought my mclr & pgm volt up to
5v (rather than just logic hi - say 3.5)

I am proceeding on the basis that there are no MAX
time constraints on the clock and data signals

when I raise mclr & pgm I am assuming
PC says zero as the loc for loading my data

in my read pgm when I raise mclr & pgm
I also assume I am at loc zero

I am also assuming that config says 1
for low volt pgming

are any of these assumptions faulty?

Larry Keegan in Stoneham, MA, USA






 
 
M

Michael

larrykeegan said:
I have to admit I posted this info
elsewhere, but here it is

because of my background in programming and electronics
I am determined to send a line of random data to
program memory and then to READ it back confirming
that the prgrmng was successful

I am utilizing 160 pgs of elect specs & 20 or more pgs
programming spec's found on the internet.

I've noted some problems people have had with
more sophisticated programming software

so far I've changed my hardware (homebrew)
twice

when I program my one line of random data into
pgm mem, I then try to read it back, mainly with an LED
option to look at data appearing at the DATA pin
when it is in output mode

so far no signs of life with my PIC

I have brought my mclr & pgm volt up to
5v (rather than just logic hi - say 3.5)

I am proceeding on the basis that there are no MAX
time constraints on the clock and data signals

when I raise mclr & pgm I am assuming
PC says zero as the loc for loading my data

in my read pgm when I raise mclr & pgm
I also assume I am at loc zero

I am also assuming that config says 1
for low volt pgming

are any of these assumptions faulty?

Larry Keegan in Stoneham, MA, USA


Do you have the Microchip programming spec. for the 16F628? If not, get
it. It's short and fairly to the point but does take some study before
things gel (that was my experience, anyway). I went through the
exercise with the same chip just a couple weeks ago but don't remember
the stuff well enough to answer your questions. All I remember is where
the address pointer points immediately upon going into programming mode:
0x000
 
L

Luhan Monat

larrykeegan said:
I have to admit I posted this info
elsewhere, but here it is

because of my background in programming and electronics
I am determined to send a line of random data to
program memory and then to READ it back confirming
that the prgrmng was successful

I am utilizing 160 pgs of elect specs & 20 or more pgs
programming spec's found on the internet.

I've noted some problems people have had with
more sophisticated programming software

so far I've changed my hardware (homebrew)
twice

I have my own homebrew that does about 7 of the PIC chips.
when I program my one line of random data into
pgm mem, I then try to read it back, mainly with an LED
option to look at data appearing at the DATA pin
when it is in output mode

I dont get the LED thing. How are you putting the data in?
Are you doing this 'a bit at a time' using switches or buttons?

so far no signs of life with my PIC

I have brought my mclr & pgm volt up to
5v (rather than just logic hi - say 3.5)

I am proceeding on the basis that there are no MAX
time constraints on the clock and data signals
Probably, but switches have 'bounce' and may clock several times each
time you think you are doing only one.
when I raise mclr & pgm I am assuming
PC says zero as the loc for loading my data

in my read pgm when I raise mclr & pgm
I also assume I am at loc zero

I am also assuming that config says 1
for low volt pgming

are any of these assumptions faulty?

Larry Keegan in Stoneham, MA, USA
I need more info here on just what hardware you are using to get the
bits in and out of the PIC. Usually, this is done with software: either
directly from a computer on a parallel port, or with an intervening PIC
to generate the timing for clock/data/pgm for both programming and
verification.
 
L

larrykeegan

thanks very much Luhan
my setup is as follows
have an older laptop pc
I use QBASIC and the printer parallel port
which goes to a buffer for sending out my signals
from the laptop

the specs for the PIC16F628 seem to place no limit
on how slow the clock and data streams have to be
altho the rising and falling edges of clock signal
have certain limits

what I do is raise the PGM & the MCLR to 5volts
(even tho I've heard that hi logic level would be enough)
I set up my data either 0 or 1 and while data is set up
I issue my clock pulse. I enter the prgrming command
and the data according to the specs and
then send the begin programming only cycle

I have osc1 pin tied to grd altho I have also tried it without grd

on the READ pgm I originally read the data off the DATA pin
and stored it in an array,
but after I was getting all zeros I connected the DATA pin to an led
while I did slow readout cycles
still did not see any variation

well back to you Luhan if you
have any thoughts
I'm definitely glad I found
someone with a homebrew programmer

Larry Keegan in Stoneham, MA USA
 
A

Anthony Fremont

larrykeegan said:
what I do is raise the PGM & the MCLR to 5volts

What about Vcc? I believe you need to pull MCLR high before Vcc is
brought to 5V. Unless your chip is configured for low voltage
programming mode already, I suspect that you will need to pull MCLR to
higher than 5V to effect programming.

I recommend you go to www.piclist.com and sign up for the mailing list.
There are many people there that have made their own programmers and can
offer expert advice to you.

I've never designed my own PIC programmer, but I've read about plenty of
peoples trials and tribulations when doing so. ;-) I use a PICALL, it
works great for me.
(even tho I've heard that hi logic level would be enough)
I set up my data either 0 or 1 and while data is set up
I issue my clock pulse. I enter the prgrming command
and the data according to the specs and
then send the begin programming only cycle

You might try getting a chip that is already programmed with known data
and work on being able to read it first. Then later when you start
writing to the chip, you will at least know that your readback
procedures work.
I have osc1 pin tied to grd altho I have also tried it without grd

AFAIK, this shouldn't make any difference.
on the READ pgm I originally read the data off the DATA pin
and stored it in an array,
but after I was getting all zeros I connected the DATA pin to an led
while I did slow readout cycles
still did not see any variation

Getting back all zeroes is interesting. When the chip is erased, it's
bits are all set to one. You have done a chip erase, correct? If the
bits are already zero, you can't set them to one in programming mode.
You have to erase the chip to all ones. IOW, you can only turn bits off
in programming mode.
well back to you Luhan if you
have any thoughts
I'm definitely glad I found
someone with a homebrew programmer

I'm not Luhan, but you should definitely check out www.piclist.com and
sign up. You'll be glad you did. Be sure and read the main page about
using topic tags ( [PIC:], [EE:], [OT:] etc...) so that the right list
members will see your posts.
 
L

larrykeegan

hi michael
got to correct you on one thing
I found the specs, but they are 160 pages long!
with 30 more pages for specs for the programming of the chip

I was amazed but delighted there was so much info
thanks for confirming first loc is 0x000

there is always something stupid you do
like wondering why nothing is happening
when I've failed to plug the db-25 connector into the
pc laptop!

well I want to talk more about this
Larry Keegan in Stoneham, MA USA
 
L

Luhan Monat

larrykeegan said:
the specs for the PIC16F628 seem to place no limit
on how slow the clock and data streams have to be
altho the rising and falling edges of clock signal
have certain limits

I believe that is true.
what I do is raise the PGM & the MCLR to 5volts
(even tho I've heard that hi logic level would be enough)
I set up my data either 0 or 1 and while data is set up
I issue my clock pulse. I enter the prgrming command
and the data according to the specs and
then send the begin programming only cycle

The program spec calls for 12 volts, you should first power up the chip
vcc (5volts) while holding MCLR to ground. Then raise MCLR directly to
12 volts before either programming or reading the chip.

This operation also resets the internal program address to zero.

To read back the data, you must lower MCLR to ground and then Raise it
again to rewind the internal pointer back to zero.
I have osc1 pin tied to grd altho I have also tried it without grd

on the READ pgm I originally read the data off the DATA pin
and stored it in an array,
but after I was getting all zeros I connected the DATA pin to an led
while I did slow readout cycles
still did not see any variation

well back to you Luhan if you
have any thoughts
I'm definitely glad I found
someone with a homebrew programmer

Larry Keegan in Stoneham, MA USA
Dont try the 'low voltage programming' it depends on how the chip was
set last. To use this, you must first do 'high voltage programming' to
set the bit that allows the low voltage mode.
 
M

Michael

larrykeegan said:
hi michael
got to correct you on one thing
I found the specs, but they are 160 pages long!
with 30 more pages for specs for the programming of the chip

I was amazed but delighted there was so much info
thanks for confirming first loc is 0x000

there is always something stupid you do
like wondering why nothing is happening
when I've failed to plug the db-25 connector into the
pc laptop!

well I want to talk more about this
Larry Keegan in Stoneham, MA USA


I meant the programming spec. doc., not the chip spec. doc. Yes, the
chip doc. is quite voluminous but the programming spec. is a Post-It by
comparison. Early in the prog. spec. you should readily find where/when
the PC is set.

I scratched my ehad over that spec. for a while, then used the PP and
MS-BASIC (PDS) to single-step my code to read/write a 16F628. It ain't
all that difficult.

(I used to live in Boxboro, MA. Once looked at an apartment in a
highrise in Stoneham.)
 
L

larrykeegan

thanks anthony
the spec shows mclr &pgm being brought hi
at the same time

I am assuming the config is set up
for lo volt pgming
otherwise I am in trouble

thanks for telling me about
piclist.com
now I am overflowing with e-mails

great idea of trying to read a chip already
pgmd - I have a friend nearby & amgoing to email
him to send me one he has lying around

when I read out the data the main thing was
it was all the same - I'm not sure whether
zero or one's - no, I have not used any erase commands

thanks a lot
Larry Keegan in Stoneham, MA USA



Anthony Fremont said:
larrykeegan said:
what I do is raise the PGM & the MCLR to 5volts

What about Vcc? I believe you need to pull MCLR high before Vcc is
brought to 5V. Unless your chip is configured for low voltage
programming mode already, I suspect that you will need to pull MCLR to
higher than 5V to effect programming.

I recommend you go to www.piclist.com and sign up for the mailing list.
There are many people there that have made their own programmers and can
offer expert advice to you.

I've never designed my own PIC programmer, but I've read about plenty of
peoples trials and tribulations when doing so. ;-) I use a PICALL, it
works great for me.
(even tho I've heard that hi logic level would be enough)
I set up my data either 0 or 1 and while data is set up
I issue my clock pulse. I enter the prgrming command
and the data according to the specs and
then send the begin programming only cycle

You might try getting a chip that is already programmed with known data
and work on being able to read it first. Then later when you start
writing to the chip, you will at least know that your readback
procedures work.
I have osc1 pin tied to grd altho I have also tried it without grd

AFAIK, this shouldn't make any difference.
on the READ pgm I originally read the data off the DATA pin
and stored it in an array,
but after I was getting all zeros I connected the DATA pin to an led
while I did slow readout cycles
still did not see any variation

Getting back all zeroes is interesting. When the chip is erased, it's
bits are all set to one. You have done a chip erase, correct? If the
bits are already zero, you can't set them to one in programming mode.
You have to erase the chip to all ones. IOW, you can only turn bits off
in programming mode.
well back to you Luhan if you
have any thoughts
I'm definitely glad I found
someone with a homebrew programmer

I'm not Luhan, but you should definitely check out www.piclist.com and
sign up. You'll be glad you did. Be sure and read the main page about
using topic tags ( [PIC:], [EE:], [OT:] etc...) so that the right list
members will see your posts.
 
L

larrykeegan

Re: my own programming of the pic16f628
Posted: 12-01-2003 12:54 PM
to all concerned
I was successful in loading in some
random test data into my PIC16F628
at 10:30 PM EST on Saturday, Nov 29
and verifying the data
using my own software (QBASIC) and
hardware connected to the parallel port
of an older PC laptop. My earlier attempts
were unsuccessful, since I was using the
low voltage mode of programming. When I
changed my hardware/software to use the high
voltage mode, I achieved success.
I also conclude that my PIC16F628 came
from the manufacturer with the CONFIGURATION
word set for permitting high voltage prgming only.
A great feeling! Now I will proceed to entering
a Hello World pgm in which I will hand assemble
the instructions. It will probably blink an LED
or turn an LED on when I close a switch to a
separate port assigned as input. Sound OK?
I seem to be having too much fun
at age 75.
Larry Keegan in Stoneham, MA, USA
 
Top