Society of Robots - Robot Forum

Software => Software => Topic started by: Ruby on June 14, 2013, 06:10:38 AM

Title: PIC Programing
Post by: Ruby on June 14, 2013, 06:10:38 AM
Hi all. I am very new at PIC's so please be patience. I have bought pic18f2455 and pic18f2550 and pic6F877A. I have K150 and it's program to write the program to pic. The thing is I don't know which program I need to use to write program in C!!! And than I need a compiler to convert the program from C to HEX ; am I right?
I have already downloaded the MPLAB X IDE v1.80 but I have getting problems when I want to build the C.
Example:
#include <htc.h>
#include <pic.h>
#include <delay.c>

main()
{
    TRISB=0; // declare portb as outpot
   
    for(;;)  // do forever
    {
        RB0=1;    // LED ON
        DelayMs(250);  // delay for 0.25 seconds
        RB0=0;      // LED OFF
        DelayMs(250);
    }
}
Please HELP!!!!
Title: Re: PIC Programing
Post by: jwatte on June 14, 2013, 10:19:00 AM
Quote
I have getting problems when I want to build the C

Step 1: Copy and paste the actual errors you're getting. Else nobody will know what kind of problems you're having.
Title: Re: PIC Programing
Post by: Ruby on June 14, 2013, 11:17:29 AM
Like this....
Now I paid attention; is it possible that libraries are missing?
Title: Re: PIC Programing
Post by: jwatte on June 14, 2013, 11:57:25 AM
I see no error messages in that screen shot. I do see a missing "#" at the top of the file, though.
Title: Re: PIC Programing
Post by: Ruby on June 14, 2013, 12:44:22 PM
What about red exclamation points?
Title: Re: PIC Programing
Post by: jwatte on June 14, 2013, 04:55:58 PM
Ask yourself this: Why would someone ask you for what the error messages say when you're asking for help?
Title: Re: PIC Programing
Post by: waltr on June 14, 2013, 06:15:42 PM
Getting started does take a bit of time and study.
I suggest this great tutorial on how to use and program PICs.
http://www.gooligum.com.au/tutorials.html (http://www.gooligum.com.au/tutorials.html)

Note: You do not need to buy anything to do most of the lesson. JUST MPLAB and its built-in Simulator.

Also note: MPLAB's Help is very good with tutorials. The Help is well worth reading.
Title: Re: PIC Programing
Post by: Ruby on June 15, 2013, 05:11:03 AM
Hi guys. I have downloaded "mikroC PRO for PIC" and everything goes ok. Leds are blinking :)
Thank you.
Title: Re: PIC Programing
Post by: fireintheit on June 28, 2013, 01:32:46 PM
If you are looking for text editor that support C then try visual basics C++. This text editor has some good features, like the debugger.