Page 1 of 4

Greetings

PostPosted: Sat Jun 21, 2014 7:06 am
by K9ACT
The other forum seems to be broken as it will not let me respond to the thread I had going there.

I got X and 8CX up and running but to say it is a new learning experience is the understatement of the year.

After spending most of the day on it, I managed to get a simple program into the editor but never got close to getting it to build. I tried following the Goo tutorial and the Get Started thing from MC and got nowhere. It is the most unfriendly piece of software I have ever seen. They seem to have reinvented the wheel just to make me miserable.

Unless someone can point to a step by step start up that works for beginners, I am going back to MicroeC.

Having said all that....

Ian said:

"Recent versions of MPLAB 8 coexist well with MPLAB X and the XC8 compiler works well under MPLAB 8. MPLAB X is big, slow and a whole new learning curve. You may do well to have both installed and use whichever is easiest for a particular task."

Do I understand that I don't need X to run XC8? Why was I told to install X if it will run in 8?

Jack

Re: Greetings

PostPosted: Sat Jun 21, 2014 7:40 am
by jtemples
What do you mean by "run in 8"? Windows 8? If that's the case, I can't answer, but MPLAB 8 runs fine in Windows 7. Microchip isn't forcing you to use MPLAB X.

Re: Greetings

PostPosted: Sat Jun 21, 2014 10:23 am
by ric
K9ACT wrote:Do I understand that I don't need X to run XC8? Why was I told to install X if it will run in 8?

Jack

Probably just someone meaning for you to install the latest version of MPLAB first.
As stated, you can use XC8 with MPLAB 8.92.

Re: Greetings

PostPosted: Sat Jun 21, 2014 2:44 pm
by K9ACT
OK, got XC8 running in MPLAB8 and it feels a lot more comfortable.

However, I still can't get a program to make/build.

I have a simple binary counter that I made using MicroC and the Googulium Tuto #1 and they produce all sorts of errors.

Should I assume that a program written in MicroC will not run anywhere else?

That does not explain why the Goo program that was supposed to be for XC8 does not.

js

Re: Greetings

PostPosted: Sat Jun 21, 2014 6:50 pm
by jtemples
I would not expect MicroC to be able to compile an XC8 program or vice versa without some porting effort.

Re: Greetings

PostPosted: Sat Jun 21, 2014 7:54 pm
by vloki
K9ACT wrote:OK, got XC8 running in MPLAB8 and it feels a lot more comfortable.

However, I still can't get a program to make/build.

I have a simple binary counter that I made using MicroC and the Googulium Tuto #1 and they produce all sorts of errors.

Should I assume that a program written in MicroC will not run anywhere else?

That does not explain why the Goo program that was supposed to be for XC8 does not.

js

1st - I wonder what should be the poblem with MPLAB-X IDE ;-)
2nd - post the errors you get !!!
3rd - Tell us the pic type you want to use
4th - don't use so many abbreviations ...

Re: Greetings

PostPosted: Sun Jun 22, 2014 2:41 am
by Ian.M
C is C, but each vendor adds their own propitiatory extensions and libraries to compilers for embedded systems to handle chip configuration, register access , peripheral access etc.

MikroC generally uses the same basic SFR names as XC8, but its methods for accessing named bits in SFRs are rather different. Also a lot of PIC specific library functions are very different.

Post the complete MikroC problem code as an attachment here (or post a link to it if you got it off the web*) and post the error messages you are getting and we will help you solve them so that you understand what needs to be done the next time you want to port code between compilers.

You can also post the sample code that's supposedly for XC8, and its errors. With error messages, stuff like the exact line number is important so its best to copy/paste them from the MPLAB output window.

* We try to avoid posting third party copyright material here as Ric doesn't have Microchip's big legal department available to defend him!

Re: Greetings

PostPosted: Sun Jun 22, 2014 6:22 am
by K9ACT
I am thinking that it may be better if someone would post a very simple "blink led" type program that is known to work on XC8 when run with Mplab 8.92 on a 16F628A.

Something like this which runs on MicroC as is.

void main() {
TRISB = 0;
do {
portb= 0x00;
Delay_ms (500) ;
portb = 0b10101010 ;
Delay_ms (500) ;
}
while(1);
}


If I can't get it running, I will then post the errors and problems.

It is not necessary to make MicroC programs run on Mplab. I only tried running them because I couldn't get anything else to work and I know these work in Microc.

I would rather not deal with MPLAB X right now. One new program at a time is enough.

Thanks,

Jack

Re: Greetings

PostPosted: Sun Jun 22, 2014 8:26 am
by ric
This compiles fine with XC8 under MPLAB 8.92.
I don't have a PIC16F628a to test it with

Code: Select all
#include <xc.h>
#pragma config BOREN = OFF, CPD = OFF, FOSC = INTOSCIO, MCLRE = ON, WDTE = OFF, CP = OFF, LVP = OFF, PWRTE = OFF

//Calibrate delays for __delay(). Default internal clock is 4MHz
#define _XTAL_FREQ 4000000

void main()
{
    TRISB = 0;  //all outputs
    do
    {
         PORTB = 0x00;
         __delay_ms (500);      //delay 500ms
         PORTB = 0b10101010;
         __delay_ms (500);      //delay 500ms
    }
    while(1);
}



also, I have just moved this topic to the XC8 forum, as it's more appropriate there now.

Re: Greetings

PostPosted: Sun Jun 22, 2014 2:25 pm
by Ian.M
Don't forget a 10K pull-up resistor on /MCLR. Although you can disable it in the CONFIG if you need to use that pin as an ordinary input, it is a bad idea to leave it floating even so and under certain circumstances disabling it can make the PIC very difficult to reprogram.