View previous topic :: View next topic |
Author |
Message |
AndyEllas
Joined: 30 Sep 2007 Posts: 3
|
Intro help needed |
Posted: Mon Oct 01, 2007 11:28 am |
|
|
Hey all,
Im new to PIC programming and am having some trouble getting down the basics. I have read everything I could stand on the web, and it seems straight forward, but Im having some start up problems. I have the MPLAB IDE and the C18 plugin (I'm assuming that the C18 plugin will let me code in C instead of assembly and compile it?). I need help defining each of my pins on my PIC16f690. I thought that since MPLAB let me set up a project and select the PIC that these would already be referenced, but now Im not so sure. I think If I can figure out how to declare the pins (so that I can refer to them), and can get started on coding. Also, is there a list of PIC coding commands in C, I think I am only finding all the assembly opcodes on the PIC data sheets. Don't hesitate to call me an idiot, I am really trying my best, and I will suffer criticism if it will help me learn . Am I going about this all wrong? Any help would be most appreciated.
Andy |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
AndyEllas
Joined: 30 Sep 2007 Posts: 3
|
|
Posted: Mon Oct 01, 2007 11:36 am |
|
|
Is CCS free? Maybe I should be using it:) (thanks for the pointer) |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Oct 01, 2007 11:40 am |
|
|
No. There is a demo, but it's time limited and it only supports 3 devices,
and it only supports 2K of ROM. So the free student edition of C18 is a
much better deal. |
|
|
AndyEllas
Joined: 30 Sep 2007 Posts: 3
|
|
Posted: Mon Oct 01, 2007 11:42 am |
|
|
Well thanks for your help. |
|
|
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
|
Posted: Mon Oct 01, 2007 1:46 pm |
|
|
Andy,
I'm not sure of the size/scope of your planned work. But, look at the supported devices(free version) and see if they are worthy. I would highly recommend the CCS compiler (in its older form, 3.xxx). The support available here (if you're willing to make a little effort) is amazing. Even if the free version isn't suitable, the command line compilers along with UltraEdit make a great, and inexpensive, development environment.
Good luck,
John |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Oct 01, 2007 1:50 pm |
|
|
My comments applied only to a comparison of the demo/ student edition.
I just noticed this:
Quote: | I need help defining each of my pins on my PIC16f690. |
C18 doesn't support the 16F690. It's for the 18F-series PICs. |
|
|
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
|
Posted: Mon Oct 01, 2007 1:58 pm |
|
|
I didn't read your post as closely as I should have, either. If you provide some background on what it is you are trying to achieve, why, what you have available, etc. The suggestions offered here will be more than enough to get you started. The pros here are literally capable of providing an advanced education if you show some ambition. They can be the mentor that one needs to get up and running. |
|
|
Gerhard
Joined: 30 Aug 2007 Posts: 144 Location: South Africa
|
|
Posted: Mon Oct 01, 2007 2:54 pm |
|
|
Here's some help from a newby to get you started.
1.Open mplab
2.Choose project->project wizzard
2.1. Pick the correct pic
2.2. Active toolsuite : CCS C Compiler
2.3. choose a project name.
2.4. Skip adding files, You can do it later.
2.5. Finish
3. Click on configure->Configure bits
-oscilator : HS if external > 4mhz
: XT if external < 4mhz
-watchdog timer:off
-power up timer: off
-brown out : off
master clear enable : off
low voltage: enable
the rest doesn't really matter for starters.
clik on file-> new and save it in you project folder
Right click on source files at the left corner and add the just saved file
Type in the following code:
#include <16f628.h>
void main()
{
while(1);
}
save it by clicking on the green disc in the middle of the page. and then compile it.
you should get a message that says "warning 203 ..........
loaded C: \picte\test.cof.
build suceeded: Mon oct 1 10:46 2007.
then you know all the software is installed corectly and the program will compile if you start programing without errors. |
|
|
|