Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PicKit2

Status
Not open for further replies.
By the way....it is possible for PICs to fail....best to order more than 1 just in case!
PICs are very hardy but anything can fail.

At some point each of us has had a problem that we suspected was due to a bad PIC. If you have spares that have never been abused you can slap in a new one and give it a try. Most of the time bad wiring or programing is the fault. For the same reason using a good quality machine tool socket is a good idea on PCB like you tap-28. Good luck with that.

If I build a prototype I like to leave it intact while I build populate and test the PCB. So having 2 or more is nice for that too.
 
You know in the last 3 year I only had one pic to fail and it was a pic32 you have to set power manual to 3.3 volts with a pickit2 to program them. You can auto find like with the pic18 and 16 chips.
And 3v0 your so right wiring wrong is probably number one reason it doesn't work
solder is the next
 
Last edited:
be80be said:
Oh by the way If it was me and I was just starting i would go with the 18f chips and by all means get two of each
2 > 18f1320 2 > 18f452 and 2 > 18f4550 There a lot of code for them to try out and see what going on

I had pretty limited choice at Maplin, but I'm going for the 16F628 because I used it briefly before (it came with a programmer last time, which I ended up taking back to the store), and also a 16F676 because it's cheap. The latter is out of stock in my local store though, so I may just get the 628 and then order a couple more PICs next time I make an online order, maybe get used to using a few different types and work out which ones I prefer. I'll see if I can get some if the 18F chips you recommended if I do that.
 
Last edited:
You might want to consider using Swordfish Basic (the Special Edition is free and extremely generous in the amount of code it will compiler) or the Amcius Basic Compiler (an unlimited free version of Proton Basic) which is limited to the PIC18F25k20. Swordfish will use many 18F-series parts.

There are more details and links here.
 
the 16f628 is good to lot's of asm code for it I would try asm first you learn the chip and how to read a datasheet all in one go

Then I would use what you Know best C basic asm
Me I hack Linux and used the shell to set config files
So when it came to a Uc I started with basic looks like a shell to me LOL
grabbed a data sheet for the pic and said WHAT ARE they talking about

This is ASM no C no basic pure ASM. I need to know ASM

Now I use Jalv2 it's based on pascal and Swordfish basic like Visual Basic
And if in a hurry PIC basic PRO

You will have no problem using 18F PICs as they are very close to the 16F family. They work better with compilers too.

If I had to program in basic it would be Swordfish basic. I prefer C.

You mean you can program now LOL
I'm kidding I know your the man with C18
 
Last edited:
I only started using ASM with the 44-pin PIC which came with the PicKit2, so C is preferred, though I'll probably also continue to do a bit of programming in ASM. Fortunately I'm very fast to pick up programming languages.
 
Some people believe that the only "true" way to learn programming is to start with assembler. This will probably start a flame war but I totally disagree.

A newbie can suffer through a few hours of coding in assembler to get an LED to flash, or he can spend 5 minutes with a high level language and move on to more interesting stuff. I don't think programming in assembler conveys a whole lot of knowledge that won't be learned along the way doing more interesting stuff in a high level language. Maybe knowing the registers to write to make a pin an output helps at some level, but the pain of gaining that knowledge probably deters many people from ever getting to the point where they can do interesting and fun stuff. For those of you that think it's magical that you fetch a value from a memory location to the stack, perform some operation on it and put the new value back, great! I'd rather do something where I can physically SEE the results.

If assembler were essential to understanding computers, wouldn't we all have an Altair on every desk? All those toggle switches just waiting for our program input?

I think maybe this is like the philosophy of amateur radio a few years back. There was the high bar of learning Morse code to get a license into a dying field. Then came the code-free technician's license and amateur radio has a huge resurgence of interest.

Just my opinion for what it's worth,

Jon
 
  • Like
Reactions: 3v0
I would say most all want a car that can drive it self and get a six pack and bring it home to no DUI that way.

But what if the the Uc couldn't output to a pin that basic didn't tell you you can't do that with GP3 and you never needed this till the day your car had to u turn because of a road block and you never read all the data sheet for io pins

But I have to say it's more fun seeing it happen Like Jon said till it doesn't work And you don't know how to ask the right things. And then some one tell you it's in the inc file look at it. Oh know what's this? There is no

if then, for next, repeat untill,

This is asm now what I had fun it's broke and people are telling to fix it with stuff i don't know

Take the salt with the sweet you'll have more fun

You don't have to be good at asm but learn some you can learn them at the same time that what I liked about this site
Gooligum Electronics
 
Last edited:
I agree with Jon Chandler.

C hides the machine instructions and bank switching. These are details about the processor but have nothing to do with the program code. It is possible to compile and run the same program on a processor with a different instruction set after modifying the code to suite the new compiler and chip. We ignore the processor but not its configuration or peripherals.

It is quite possible to learn about the processor and peripherals using the C language. The most basic peripheral is the processor ports. In C we simply write

TRISA=0x00; // all outputs
PORTA=0xEF;

There is a lot less complexity, a lot less to go wrong here then the same code written in most ASM's.

The problem I see it is a lack of micro controller based C tutorials that address the controller properly. A few years I made an attempt at doing so. The goal was to explain the hardware and every line of code needed to configure a PIC and turn on a LED.

https://www.electro-tech-online.com/custompdfs/2010/09/JunebugTut1C3.pdf
 
I agree with Jon Chandler.
You agree with Jon but then you say
The problem I see it is a lack of micro controller based C tutorials that address the controller properly. A few years I made an attempt at doing so. The goal was to explain the hardware and every line of code needed to configure a PIC and turn on a LED.
And I said you have to take the sweet with the salt

Maybe this is easy

Code:
#include	<pic.h>
#define BUTTON	RA0	//bit 0 of PORTA
main(void)
{
	unsigned char	i, j;

	TRISB = 0;		/* all bits output */
	j = 0;
	for(;;) {
		PORTB = 0x00;		/* turn all on */
		for(i = 100 ; --i ;)
			continue;
		PORTB = ~j;		/* output value of j */
		for(i = 100 ; --i ;)
			continue;
		if(BUTTON == 0)		/* if switch pressed, increment */
			j++;
	}
}

Now make it work with out knowing how to read a data sheet and under stand some asm

The chips a 16f88
 
Last edited:
Again C does very good things for us by hiding the processor core/instructions. They are not relevant to the apps we create. Let the compiler take care to that noise.

be80be said:
Now make it work with out knowing how to read a data sheet and under stand some asm

There is no ASM in the program!

Regardless of the language everyone needs to read and understand uC data sheets. As Nigel has said, most of the examples in the datasheet are in asm. But the same information is exists outside the example. Even if they do not know PIC ASM reasonably intelligent people will be able to figure out what the asm examples are doing given the code comments and text in the datasheet. I do not see it as reasonable to learn PIC ASM just to read the few lines of examples in datasheets.

If you bothered to look at the tutorial you will see that it takes great pains to provide all the details needed to understand the C18 code used. It explains the "hard part" for new people, how to configure the chip using the compiler specific methodology.
 
There is no ASM in the program!
That's right but it needs some
Code:
OSCCON 0x72   /* sets osc to 8mhz */
ANSEL = 0x00   /* sets porta digital */
Then it works
 
Regardless of the language everyone needs to read and understand uC data sheets. As Nigel has said, most of the examples in the datasheet are in asm. But the same information is exists outside the example. Even if they do not know PIC ASM reasonably intelligent people will be able to figure out what the asm examples are doing given the code comments and text in the datasheet. I do not see it as reasonable to learn PIC ASM just to read the few lines of examples in datasheets.

It's not just a question of 'reading the datasheets', it's understanding the processor and what you're doing - PIC assembler is trivial to learn (FAR easier than learning C), and probably a single evening would be all you would need to gain enough assembler knowledge to greatly improve (and speed up) your C programming.

If you bothered to look at the tutorial you will see that it takes great pains to provide all the details needed to understand the C18 code used. It explains the "hard part" for new people, how to configure the chip using the compiler specific methodology.

C18 is less of a problem, as most of the documentation for the 18F series is in C anyway, and a free compiler is available. But I would still suggest a little 16F assembler to give you the basic knowledge you need.
 
Nigel said:
It's not just a question of 'reading the datasheets', it's understanding the processor and what you're doing - PIC assembler is trivial to learn (FAR easier than learning C), and probably a single evening would be all you would need to gain enough assembler knowledge to greatly improve (and speed up) your C programming.

Wow! I do not agree. Why do you need to understand the processor core ? As long as you can make the IO ports and registers wiggle the correct bits at the right time the processor core does not matter. It is no more important to the programmer then the transistors that makeup the gates. If the processor core is at the noise level so is the ASM that goes with it. Maybe a bit strong but not too far off.

I think I know how to program and what a good one is.
 
Last edited:
You know I been doing this for awhile now learned asm in about two weeks but I wouldn't say I'm good at it . But i can tell whats going on. I like basic so that's what I have been using till I started using Jalv2 because it's free as in beer and it has
usb libs that work with the 18fchips. I also spent time learning C but I like basic and jalv2 better.

But in the last three year of using pic 12f,16f,18f, and the pic32 I'm so glad I took time to learn some asm.

Number one reason I have read more junk posted by good programmer who new C or basic or jal but for some reason can't remember how to set the chip inputs and outputs or the fuses right. But they write nice code.

I've ask some dumb things myself and got dumber reply's and every time it was because i didn't take time to read the data sheets and some asm is big with me now.
 
3v0, we are definitely on the same page on this one. At some point, you may HAVE to learn more about the nitty-gritty operation of the chip, but the reason for higher-level languages is to take care of those details for us.

Since I've opened this can of worms, I'm going to add to it. There are a bunch of people here that say you must get the data sheet for a chip and study it. Go through it page by page and understand every detail. Bunk. I am a believer in the data sheet. You must look at the pin diagrams to understand what goes where. Maybe the oscillator options if you're trying to do something different. And maybe the pin specifications so you know the voltage requirements and current limits. What's that? Six pages out of 400? A data sheet is like a dictionary. Nobody (well, almost nobody) reads a dictionary from cover to cover. You look up words you don't understand or check spellings. A data sheet.. no, data BOOK for micros...is the same thing. It's a reference. Keep it handy, but don't feel like you need to spend the next 6 months reading it. There's too much information in it anyway to keep in your head - you just need to know the information is there when you need it! Fortunately, everything in on-line these days. You don't need to keep a library on the bookshelf. I do usually download and store the data sheets I need, just so I can be sure I have them whenever I might want them.

Now, backtracking just a little, suppose you want to use some I2C chip you know nothing about and there's not an existing driver for? Then there is no choice. Roll up your sleeves, break out the data sheet and figure out what all those mysterious registers are for. When I'm doing something like this, you'll find a printed, dog-eared copy of the data sheet close by my side. Highlighter all over, notes in the margins and on the backs of pages. When there's no a high-level command that says "turn on pin 7" or "read the voltage on pin 2", this is what you have to do! If you write a few subroutines or even make a driver, the next time you may not need the dog-eared data sheet.

Jon
 
Last edited:
I have twins 10 years old this month I was trying to teach them basic. I down loaded Microsoft small basic so they could make some games and have fun. The first thing Madison ask is how will I make that work if i don't know how the chips work.
I told her she didn't need to know she just making game that play on the computer. But what if I want my game to play on the net
 
@be80be I am glad you are teaching them to use their minds. For the most part that is the largest thing programming has to teach. There is a real transition in their thought process when they get to the point where they "get it".

The people who show up wanting to know how to configure the chips are at times just too lazy to look it up then figure it out.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top