A goldmine for the PIC programmer

atferrari

Joined Jan 6, 2004
4,771
I would be interested to know how your problem turned out or if maybe your PIC had been beamed to silicon with a buggy mask.
No, it was not a buggy mask. As I said, the datasheet did not describe the scheme allowing to access them through a specific one.

Last time I checked, datasheet was unchanged.
 

Markd77

Joined Sep 7, 2009
2,806
I've spotted a few errors too, like this one in the 16F1823 datasheet:
(there is no TRISB on this PIC)
Overall, however, I find the quality is good.


Rich (BB code):
EXAMPLE 12-2: INITIALIZING PORTC
BANKSEL PORTC ;
CLRF PORTC ;Init PORTC
BANKSEL LATC ;Data Latch
CLRF LATC ;
BANKSEL ANSELC
CLRF ANSELC ;Make RC<5:0> digital
BANKSEL TRISB ;
MOVLW B’00110000’;Set RC<5:4> as inputs
;and RC<3:0> as outputs
MOVWF TRISC ;

There are also a few omissions that can cause hours of headscratching, for example the template code for the interrupt on most midrange datasheets.
After saving W and STATUS it would have been nice to put a line in to switch to Bank 0. If you don't realise that in most cases you need to put it in (and I didn't) it can be hard to figure out what is going on.
 

PaulEE

Joined Dec 23, 2011
474
Oh geeze, Don't get me started now. But I wouldn't because I'm way out numbered.
In your defense, I think PIC microcontrollers are very big with hobbyists and amateur electronics folks, but when it gets down to it, for mass production and cost, intel, hyundai, hitachi, atmel,...take the cake.

I myself use PICs because I was given an 18F4550 and a 16F877a for a high school graduation present from a friend's Father. I had no clue what they were, but I knew I wanted to know. I started with a hello world LED program at my school robotics club and the rest was history.

I build a digital multimeter a year or so ago that stood side-by-side an HP 3458 and read the same voltages out to +/- a few PPM over range.

I use PICs at work. Any time I'm talking to my boss, I always say, "HEY, I think a PIC can do this job just fine!"...he knows I'm a PIC freak. haha.

I <3 PICs, if you will.
 

billbo

Joined Jan 25, 2010
12
it shouldnt be to hard to program the pic with hex or any other language with the rite compilers most chips are simular just diferent op codes and pinouts but all use simular working methods

microchip pics are good hobby chips but arent powerful if u want power ud want to go with z80 chip the most powerfull i know of also if u want cheap chips cheack out the prices and data sheets online some can use the microchip notes with modifacations noticed texas chips are cheap and look good and if u want the best coding the lowest level will be the best c will take up space and may produce errors
 

ErnieM

Joined Apr 24, 2011
8,377
Anyone starting out in microcontrollers has several large humps to get over. You need a good electrical design and good build, you need a good programmer, and you need to run some good code. If anything goes wrong you tend to sit there and wonder what to do next as any link in the chain can be bad and that is a very difficult problem to solve even when you have a ton of experience.

So I STRONGLY recommend getting a development kit and a programmer. I mostly use Microchip products so as I am most experienced with them that is what I will discuss.

Microchip has two nice started kits that have a pre-built and tested development board to use. The board has some LEDs and buttons and even a pot to give you ways to get information into and out of a simple project. You can learn a lot that way.

The kits also include a programmer that also works as an in circuit debugger so you can watch your code as it runs inside your project. In circuit debugging is a very helpful tool to have.

The kits also have a set of lessons to introduce the concepts you will need to know to use these things.

Your top two choices are:

The PICkit 2 Debug Express has lessons in Assembly language. More info It costs $54.99USD.

The PICkit 3 Debug Express has lessons in the C language. More info It costs $69.99USD.

The "More info" links to the lesson plans so you can see if this is something you would be interested in. You can even download everything but the hardware and test out the programs using the (free) simulator.

The PICkit 2 is older and doesn't support all the latest devices but it is solid and proven. The PICkit 3 is the newer device and covers the entire line of controllers, but it is 20 bucks more.

Learning either assembler or C may not be the best way to learn programming on your own, but there are places (like right here) where you can ask for help when you get stuck.

While you do need a PC to write the program and load it into the dev board once this is complete you get a board that will run by itself without a PC: just give it some power and off you go.

Radio Shack also has a Vellman kit for a PIC, but I don't know much about it. They also carry the Basic Stamp development unit: this comes with a solderless breadboard and some parts to do their tutorials. It programs in Basic which is probably the best programming language for beginners. The Shack also has some other micro boards like the popular Arduino.
 
Last edited:

takao21203

Joined Apr 28, 2012
3,702
What I don't understand is why people make it more difficult for themselves than required:

-Using old 16F models with very tiny RAM, even 16f84
-Using self-made programmers which only can program a few PICs
-Using assembler

I understand that some dealers increase the price from 2x upto 5x.

However if you buy the 18f24j10 from a good source, it does not cost more than $1.50
So why bother with the small/outdated 16F PICs?

Sure you can do amazing things in assembler having only 4K program space, by the time it works, you could have completed 5 projects based on C language.

Projects based on PICs with very limited memory + assembler particulary have caused the opinion PICs are slow, powerless, and mainly used for hobby purpose.

Modern 24F PICs are powerful, 16bits, and also 18F (which are 8bit only) are much better than 16F.

I would really say, don't even start using 16F PICs.
 

JDT

Joined Feb 12, 2009
657
Sure you can do amazing things in assembler having only 4K program space, by the time it works, you could have completed 5 projects based on C language.
And you get that lovely sense of achievement! Nothing better than some well crafted assembly code. The only way to go for the smaller 8-bit PICs.
 

ErnieM

Joined Apr 24, 2011
8,377
I could not agree more takao. I based my latest project (a test fixture for another PIC product) on the PIC18F46K22, as it is a recent addition with tons of built in resources. When I deceided to add a programing function for the PIC under test I still have tons of room left over.

Now the product itself is a PIC12HV615 unit with just 1K or ROM, but that choice was based on requiring a small footprint and an internal voltage shunt regulator. Even that unit was programmed in C, though I had to write my own custom multiplication and division routines to get them to fit inside such a small memory.

Small chips DO have their place, but as a starting point it just doesn't make much sense.
 

Eric007

Joined Aug 5, 2011
1,158
I would really say, don't even start using 16F PICs.
I respect your opinion but disagree with the above line!

If I have to do a project today I'll definitely used PIC18F for its features, memory size, speed and...But I would say for anyone who is interrested in learning and starting with the very basic projects (like blinking Leds) and gradually moving to harder ones...I would recommend PIC16F series like PIC16F690, PIC16F877,...coz I realized embedded programming is different than software programming...Here to be a very good programer you need to understand the architecture and organisation of your processor! So why starting with complexed architecture? (PIC18F, PIC24F...) Plus you are not even going to use all or even half of the features!

You can start with a GOOD PIC16F and when you feel a bit mature you can try to explore what others (PIC18F, PIC24F, PIC32F) offer!

Also moving from PIC16F to PIC18F is not that hard...

Like in my case I have not used all features in 16s...so I'm using both 16s and 18s.

Well we see things differently!:)
 

takao21203

Joined Apr 28, 2012
3,702
OK yes 16f54/16f57 for simplicity,
or 16f1824 etc. for cost saving.

But other old 16F PICs are expensive, very limited, and complicated to configure.
 

takao21203

Joined Apr 28, 2012
3,702
And you get that lovely sense of achievement! Nothing better than some well crafted assembly code. The only way to go for the smaller 8-bit PICs.
I wrote a text scroller for 5x5 LED matrix 100% in assembler, PIC 16f1824, and it can use proportional fonts. It was so bad I had to start over 3 or 4 times, not to speak of the total time I spent. It works 100% yes, and sooo small memory footprint. There is even a lot of codespace left! But RAM is all used up pretty much. Having extended midrange available, you can get rid of the banking to some degree, otherwise, can't be managed, you have to tie your program to a specific PIC or deal with issues each time you port it.
 

takao21203

Joined Apr 28, 2012
3,702
I could not agree more takao. I based my latest project (a test fixture for another PIC product) on the PIC18F46K22, as it is a recent addition with tons of built in resources. When I deceided to add a programing function for the PIC under test I still have tons of room left over.

Now the product itself is a PIC12HV615 unit with just 1K or ROM, but that choice was based on requiring a small footprint and an internal voltage shunt regulator. Even that unit was programmed in C, though I had to write my own custom multiplication and division routines to get them to fit inside such a small memory.

Small chips DO have their place, but as a starting point it just doesn't make much sense.
It's pretty pointless for a small number of PCBs to save 50 cent or a dollar. Beginners really should not bother with 16F, except the new extended midrange models maybe.

Develope on larger PIC, and if required, port down to smaller chip!

I have here some 10F206, some 12F, and lots of 16F54, 16f57, 16f59.
The 16f54 is nice for 4-digit LED display, but lately I was thinking they are not so cool after all, small TFT LCD is far better + more flexible.

16f884 around here as well...some 16f818, 16f690, etc.
 
Top