pic programming

Status
Not open for further replies.

Dr_Doggy

Well-Known Member
I got my mplab ide and demoboard for pickit2 , when i turn on blank chip OSC2/RA6 goes high, is that normal?

I am having problems with my code, could someone provide me with a complete file that i can try to compile, and also the same code in hex so i can test my uploader?

all i need is a program that turns on all pins for 16F886?

colin55

Well-Known Member
The demo board comes with projects and code.

Dr_Doggy

Well-Known Member
ok, i got the demo board working, 16f886, but when i switch my pic to the 16f627, i change the chip#in the code, and the programmer reads it ok,,, but the same code used(to turn on port B), wont work in the second PIC, any ideas?

Jon Wilder

Active Member
It might help if you could copy and paste your code here on the forum so that we can better assist you with your issue. Just a thought.

One question though...is the PIC 16F627 code compatible with the 16F886?

Last edited:

Dr_Doggy

Well-Known Member
sure, but the code works on the 16F886, but not the 16F627, note that i do change the device command to the appropriate chips, and the programmer seems to identify OK

Attachments

• TESTB1.asm
1.9 KB · Views: 113
• TESTB1.hex
261 bytes · Views: 98

Dr_Doggy

Well-Known Member
UPDATE: i noticed my pickit2 software is writing data and verify s it after the write, but when i click the verify button it fails, what could that be?

pickit2 software is able to detect chip type and blank it, all bits read 3FFF, then when i import, write to it , then read again, all lines say 0000 , which is not my original imported hex code, also I am checking data wires for connectivity with leds, seems to be ok though.

Dr_Doggy

Well-Known Member
ok i got it goin but the pic still isnt running the program!

bee

Member
doggy

Have you checked your hardware connections ,,, Migrating from the 887 to the 627

ie; crystal connections,voltages,

Bernie

Dr_Doggy

Well-Known Member
yup, all i need is a cap across vdd, all pickit connections are secure.

bee

Member
doggy

You should run through nigels tutorials ,some good example code on there

Tut 1 Is flashing a led shouldnt be to hard to run it on a 627
It is a lot less complicated code than the one you posted

Bernie

Last edited:

be80be

Well-Known Member
It looks like your getting lost with the org = 5 that's not needed your code should start a org =4

your sending it to the wrong place the compiler is starting at 4 but your telling it is 5 so your missing the boat and hitting the water

Dr_Doggy

Well-Known Member
K, i dont think its code anymore, it seems to detect chip,, writes successfully 1/3 times, but still won't verify after a "successful write"?

but my connections are secure, my cap is across vdd/gnd , and the pickit2 recognizes the chip

also iv compared the code from the 886 and the 627, all i can find that's different is the subroutine at the end, im guessing those are specific to the chip? I am using GCBASIC and that identifies with both chips, and compiles for me.

Attachments

• TESTB627.asm
1.8 KB · Views: 105
• TESTB886.asm
2.4 KB · Views: 99

nickelflippr

Member
Tell us what crystal (or resonator), and cap values are attached to the 16f627? The '627 is on a breadboard or protoboard? What does your GCBasic "#chip 16f877A, 20" line look like for the '627?

If PGC or PGD (RB6 and RB7) are somehow loaded with external circuitry, then this can cause programming problems. Refer to the Pickit 2 user guide for external connections on these pins, or temporarily remove and replace pin loads on PGC and PGD as a test.

ORG 5 for start of program memory should be just fine.

Dr_Doggy

Well-Known Member
dId I say 887? i meant 886, anyway the code is all the same except for the INITSYS subroutine at the end, there is no load on my pgc or d , I am not using crystals an such,, only my 0.1nF cap across vdd.....

also I found a 18F4620, and it ran the code fine, just not this one little 16F627 chip!

if each chip is different, is it possible that the "device decoder" add in is off(if there is even such a thing), kinda like a bad driver<>?

nickelflippr

Member
dId I say 887? i meant 886, anyway the code is all the same except for the INITSYS subroutine at the end, there is no load on my pgc or d , I am not using crystals an such,, only my 0.1nF cap across vdd.....

also I found a 18F4620, and it ran the code fine, just not this one little 16F627 chip!

if each chip is different, is it possible that the "device decoder" add in is off(if there is even such a thing), kinda like a bad driver<>?
No, you did not say 16f877; I was just trying to pry the #chip config line from you, and just used the 16f877,20 as an example.

EDIT: The 16f627 also has a 4Mhz internal oscillator, but is not shown in the config line of the .asm file. That's why I was trying to get what type of external oscillator/crystal/resonator you have. You will need to use:

Code:
#chip 16f627, 4
#config INTRC_OSC_NOCLKOUT

Not sure what you are getting at with the "device decoder", but with GCBasic you can sort some of the register and configuration differences out, by looking at the chipdata files in the GCBasic folder.

EDIT: Got caught thinking the 16f627 didn't have an internal osc, much like the 16f877, not so.

Last edited:

Dr_Doggy

Well-Known Member
no internal oscillator! that may just be it !

THNX, that one was driving me crazy!!

nickelflippr

Member
See edit of previous post, my BAD.

THNX again!!

bee

Member
That is why i asked for you to check your crystal connections as that was what was in the config line,, Good when you find something simple ,, Hope it works for you

Does it work now doggy

Bernie

Status
Not open for further replies.

Replies
2
Views
1K
Replies
42
Views
2K
Replies
30
Views
2K
Replies
5
Views
464
Replies
21
Views
2K