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.

Moving up to "the big guns"

Status
Not open for further replies.

windozeuser

Member
well, I just came out from programming on the BASIC Stamp for about six months from Parallax. I now want to move to the PIC, and I need advice. In the past I have coded in C and Assembly (x86). Whats the best route to go for a complete PIC development kit. I need a PIC that will be "easier" to use and program to start out on. What is the best compiler, and programmer choices?

I would like to start out on the pic with BASIC or C, then move on to Assembly.

Any books you recommend?

BTW - I know the BASIC STAMP is basically (pun?) a pic out of it's normal use to be used with the BASIC language.
Thanks a lot.
 
I've seen a few people recommend starting with assembly, but I don't. It can be very confusing. There is a reason most schools start with BASIC or Pascal. But...Having already programmed Stamps you might be ready for the jump to assembly.

Personally, I use JAL. It's Pascal-like, free, has a Yahoo support group, and allows me to implement assembly where I want it.

Other free compilers are XCSB (BASIC) and CC5X (C). Maybe these are already listed in the sticky for the Microcontrollers section here.

As for PICs, I highly recommend the 16F88 (18-pin), 16F876A (28-pin), and 16F877A (40-pin). They all can accept a bootloader which will speed development and learning. The 16F628A is a great chip, it just can't take a bootloader.

Mike
 
if you don't have assembler, use the DOS DEBUG tool.

It accepts some assembler commands, but it is generally more difficult because it is able to interface with 8086 compatible chips. It cannot accept 32-bit instructions (unfortunately).

Once you are able to make programs with the tool, you will be able to learn other languages.

I use the AT89C2051 chip, and it is based on the 8051 instruction set. It is slightly different from the 8086 instruction set.

If you are hand programming the chip, you must know the op codes for each command. In debug, when you unassemble your code, you will see something similar to the following:

xxxx:yyyy AABBCC mov ax,1

the xxxx is the segment of memory where the code is stored
the yyyy is the offset where the code starts
AABBCC is the code. two hexadecimal digits form a byte. AA is at offset yyyy, BB is at offset yyyy+1, etc.
and the mov ax,1 is the instruction that was entered.

once you have made some programs with DEBUG, learning another instruction set shouldn't be too difficult.
 
upand_at_them said:
I've seen a few people recommend starting with assembly, but I don't. It can be very confusing. There is a reason most schools start with BASIC or Pascal. But...Having already programmed Stamps you might be ready for the jump to assembly.

Other free compilers are XCSB (BASIC) and CC5X (C). Maybe these are already listed in the sticky for the Microcontrollers section here.

Mike

I don't believe in assembly being a prerequisite either.
Microchip puts out a free and effective MCC18 compiler. HTSoft PICC18 is a good one too but is time-limited. These are made for the PIC18 series which has some additional assembly instructions to make it more C-friendly.

Warp13 is a great programmer, pretty cheap too.
 
Oznog said:
I don't believe in assembly being a prerequisite either.

My reason is VERY simple, assembler forces you to understand the hardware, and how the software interacts with it, a high level language effectively tries to completely ignore the hardware.

This leads to very poor programming, with long C routines sometimes being written where you could do the same thing in one or two lines of assembler, and MUCH shorter in C if you understood what you were doing (and what the compiler was doing!).

With PC programming it's not a problem (particularly under Windows) as you are effectively one step (or more) removed from the hardware, so don't need to understand it. However, this technique applied to PIC's would be difficult, hard to squeeze a few hundred Mb's in a PIC and reduce it to a crawl!.

In the distant past, university students weren't allowed to use high level languages until they were fluent in assembler, it was a good policy then, and would probably be a good policy now?.
 
I'll have to agree with that last part. I'm still in school, and all the time, I'm confronted with classmates who skipped the machine-level languages, and don't understand the hardware fundamentals like timing, and visualizing the stack. The confusion really sets in when the Hardware Description Languages come in because no one understands what software actually does electrically. ASM has a reputation of being the "widowmaker" language, which I think is totally trumped up--not to say it's very easy either.
 
Hey Thanks all, BTW Nigel your Tutorials Kick ass :) I think I'm gonna buy the parts to build the programmer, and start with assembly. Should I use the 8051 or a PIC?

I'm ordering the parts for Nigel's PIC16F628 Main Board. Is that just a standard 18 pin IC socket?

Like this one:
https://www.jameco.com/webapp/wcs/s...storeId=10001&catalogId=10001&productId=87636
Just to double check:

Where can I get these: three ten pin connectors, one for PortA, and two for PortB (the second for connecting two of these boards together), and a two pin ground test connection?

And what are track cuts?
This is the PIC I should get correct?
https://www.jameco.com/webapp/wcs/s...toreId=10001&catalogId=10001&productId=193447

What other boards should I build? (I want to get everything in one large order)
 
Oznog said:
I don't believe in assembly being a prerequisite either.
I can't say it is a prerequisite, but it is extremely helpful.

Nigel Goodwin said:
My reason is VERY simple, assembler forces you to understand the hardware, and how the software interacts with it, a high level language effectively tries to completely ignore the hardware.
In other words, a high-level language does not allow the user to understand the electrical characteristics (registers, stack, etc) of a computer when creating a program. In fact, all a high-level language can do for you is allow you to whip up a fast piece of software specifically intended for the operating system the programming language runs on.
Low level languages (like assembler) allows you to even make your own OS and even boot disks too.

This leads to very poor programming, with long C routines sometimes being written where you could do the same thing in one or two lines of assembler, and MUCH shorter in C if you understood what you were doing (and what the compiler was doing!).
Yes. With assembler, you have alot more control on how each and every instruction is executed. If you went with straight opcode programming (feeding opcode after opcode), then you won't need a compiler, but it can be tedious.

With PC programming it's not a problem (particularly under Windows) as you are effectively one step (or more) removed from the hardware, so don't need to understand it. However, this technique applied to PIC's would be difficult, hard to squeeze a few hundred Mb's in a PIC and reduce it to a crawl!.
Please understand that CPU's and microcontrollers require opcodes to function. They cannot take words, because words are greek to them, and would require the manufacturer to add circuitry and therefore make the chip expensive. I doubt a single MB of data would fit in a PIC.

In the distant past, university students weren't allowed to use high level languages until they were fluent in assembler, it was a good policy then, and would probably be a good policy now?.

why didn't they keep that policy?

I see now that teachers are now steering software developers away from the hardware and leaving that up to M$. It seems that teachers and "big shots" now use Windows XP. Could you imagine programming now?

The only pieces of hardware that programmers have control over are the disk drives, and CD-ROM drives. Other than that, hardware can't be accessed directly without special API's.
 
I highly agree that software developers should learn about the hardware architecture they are programming on. Assembly is a way to dig deep into the architecture, and understand it on a level higher than that of a high level programmer (pun?). I find that if you understand assembly; some concepts in C such as pointers make more sense to you.

Just my opinion :D
 
windozeuser said:
Hey Thanks all, BTW Nigel your Tutorials Kick ass :) I think I'm gonna buy the parts to build the programmer, and start with assembly. Should I use the 8051 or a PIC?

I'm ordering the parts for Nigel's PIC16F628 Main Board. Is that just a standard 18 pin IC socket?

Like this one:
https://www.jameco.com/webapp/wcs/s...storeId=10001&catalogId=10001&productId=87636
Just to double check:

The link you posted was for a wire wrap socket, you just need a normal PCB mounted socket.

Where can I get these: three ten pin connectors, one for PortA, and two for PortB (the second for connecting two of these boards together), and a two pin ground test connection?

They are Molex connectors, but you can obviously use any ten pin connectors you like.

And what are track cuts?

It's a break in the strips of copper on the veroboard, you make them with a 'spot face cutter', rather like a drill bit with a handle.


Yes, that's fine.

What other boards should I build? (I want to get everything in one large order)

Whichever boards you want to really?, most of them don't use any particularly special parts.
 
What other boards should I build? (I want to get everything in one large order)
you know that "boards" are equivalent to circuits on PCB.

Plan your circuits out far in advance before thinking about ordering a ton of stuff, or you will begin to realize that at least 1/2 your order is useless to you.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top