• 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.

pic c 16f628

Status
Not open for further replies.

Roboticinfo

New Member
Look at the books like how to program a pic

Look at the books like how to program a pic
 

dogdens_R

New Member
actually c is the most straightforward and easy to use. I wonder y pple still use asm these days.

first go to www.microchip.com and download their mplabv6.61 its free. then go to http://www.htsoft.com/downloads/demos.php to download the demo version of picc or picc18 compilers depending on the pic u wish to use.

lastly go to http://www.htsoft.com/updates/mplab/mplab6/update.php to get the latest update.

now u've got 3 files. install mplab then install the picc compiler and then the update.

start mplab and select new project. the project wizard will guide you thru.

if using mplab 5 then you've got to configure a lot of nonsense yourself. stick to mplab6.61

now, this demo version of picc compilers will expire in 21-days but thats a minor irritation. just make sure your system date/time is set within the 21-day limit, re-save the .c and re-compile.

this means you have a c-compiler for your pic. its a little slower but its free and lasts forever.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
dogdens_R said:
actually c is the most straightforward and easy to use. I wonder y pple still use asm these days.
Because assembler is faster and smaller than C, and completely free. Also, a reasonable knowledge of assembler will help you write better C programs as well, as it forces you to understand the hardware.
 

dogdens_R

New Member
Nigel Goodwin said:
Because assembler is faster and smaller than C, and completely free.
agreed. all ee engrs must know asm but then,

for small diy projects using c is more straigtforward and the program flow is very "debug-friendly" so we use c.

for complex routines it would be madness to use asm anyway (few thousand lines of code!) so we still use c.

my personal opinion: using asm is more for pride than anything. it is always good to know more programming languages but choose the one that makes shortest work. (not necessary c)
 

Nigel Goodwin

Super Moderator
Most Helpful Member
dogdens_R said:
for complex routines it would be madness to use asm anyway (few thousand lines of code!) so we still use c.
This is the problem with programming today!.

Back in the Commodore Amiga days there were superb games on the system, which ran a 68000 processor at around 8MHz. The games were written in assembler, and were fast and smooth, compare that with todays games written in C, which usually require multi-GHz processors to run at all!. The Amiga also multi-tasked better than Windows has ever managed!, much of it's OS was actually written in C, but you could download assembly replacements which speeded it up more.

But probably more important from the PIC point of view is the size of the binary file, C is generally considerably larger (and slower) than assembler. With only one or two kilobytes of program memory, you need to be careful.

Writing large assembly programs is no different to writing larger C programs, you break it up into smaller sections or modules, and you can then test them independently, and reuse them in other projects.
 

dogdens_R

New Member
hey man.... relax... don't go ballistic on me... i am jus a noob remember.... you r the pro... wat do i know...
 

bmcculla

New Member
High level languages let you trade complexity for processor time and codespace - both of which are quite cheap now. Paying software developers is still expensive.

I'll agree that if you have a processor with less than 4k of flash, assembly makes sense, but that is really on the low end. I'd still take a hack at it with C first. C is designed to let you use low level constructs so you can get very close to assembly with C.

Compilers let you reuse the work of the compiler developers; You write your code and then when the compiler is improved you get the benifits for free - no extra work required. Modern architectures like Itanium are banking on this.

Assembler is free but C is getting to the point that it is free or very cheap. A free or low cost C compiler is a requirement when I'm looking at a new architecture.

You can't even compare modern operating systems and games to old systems. The Windows code is millions of lines long and billions of instructions. Games that ran at 8Mhz are on the order of a megabyte in size. New games are several gigabytes in size - 1000 times more complicated. This isn't an excuse for buggy software, but buggy software comes from crappy design practices not the language you use.

All that said, assembly is a good skill to have. It's hard to really understand computer architectures without having done some assembly programming. It's also hard to write good C without some knowledge of the instruction set you're dealing with. There is probably a lot of assembly in the windows kernel. If there is something tht needs to be really fast assembly is the best you can get - but there are things that don't need to be fast, a delay routine for example. You have to choose tools that are appropreate for the task.

Now that we've rehashed the old assembler vs. C argument: Nigel You'll be dissapointed to know that Microsoft's new C# is even more wasteful than C or C++. :wink:
 

Nigel Goodwin

Super Moderator
Most Helpful Member
bmcculla said:
You can't even compare modern operating systems and games to old systems. The Windows code is millions of lines long and billions of instructions.
I was comparing a multi-tasking GUI with a similar multi-tasking GUI, and finding the modern one very lacking in comparison.

However, to be fair, one of the big problems with Windows is that it doesn't run on fixed hardware.

Now that we've rehashed the old assembler vs. C argument: Nigel You'll be dissapointed to know that Microsoft's new C# is even more wasteful than C or C++. :wink:
Not disappointed at all, it was a dead certainty! :lol:

I've no doubt their next offering will be even more bloated.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top