Problem with hex file created in MPLAB

Thread Starter

hunterage2000

Joined May 2, 2010
487
Hi all, Ive got it working. I opened a new file > xc8 compiler > main.c and set the configs. Can anyone direct me to a reference for the programming keywords?
 

t06afre

Joined May 11, 2009
5,934
Hi all, Ive got it working. I opened a new file > xc8 compiler > main.c and set the configs. Can anyone direct me to a reference for the programming keywords?
Then working with MPLAB you should really always create a project. What do you mean by "programming keywords" it can be so much
 

Thread Starter

hunterage2000

Joined May 2, 2010
487
I have a book called "Programming an 8-bit PIC Microcontroller in C" and tried this code from it and it didnt recognise Output_D(255);

Rich (BB code):
/*
OUTBYTE.C MPB 2-1-07 V1.0
*/
#include " 16F877A.h " // MCU select
void main( ) // Main block
{
output_D(255); // Switch on outputs
}
I need a list of keywords that are recognised by Microchip like TRISB, PORTA or tutorials that show ADC, serial comms, par comms etc
 

t06afre

Joined May 11, 2009
5,934
Well this will be the Hi-Tech C version
Rich (BB code):
void main( ) // Main block
{
    TRISD=0;
    while(1)
         {
             PORTD=255;  //Poutput_D(255); // Switch on outputs
          }
       }
 

Thread Starter

hunterage2000

Joined May 2, 2010
487
So the Hi-tech has its own language then? Should I be looking at the hi-tech guide? How did you learn how to program with Micropro?
 

t06afre

Joined May 11, 2009
5,934
Every microcontroller C compiler has its own way of doing things. They are more or less true to the ANSI C standard. You can not just take a program written in say MikroC and just copy and paste the code into the XC8 compiler. You will have to port the code so it fits the XC8 compiler.
I have never used the Micropro software. It was just experience and a quick Google search ;). By the way I think the Micropro software now is named Microburn
and this is the latest version http://www.ozitronics.com/download/DIYpack25ep.zip
 

Thread Starter

hunterage2000

Joined May 2, 2010
487
Yeah I use DIYpack25, I have flicked through the xc8 guide and have found a few keywords like TRIS and PORT to initialize and set output ports. But other than this alot of the manual is confusing. When I was designing websites way back I used to have the html and css pocket reference books by o'reilly which was a great help. I need something liek this for XC8. Can you recommend anything?
 

t06afre

Joined May 11, 2009
5,934
That because key words like TRISx and PORTx are just defines that are processor specific and not part of ANSI C. But all the registers in the register file for the PIC is defined in a header file. In your case pic16f877a.h You find all the header files in "C:\Program Files\Microchip\xc8\v1.xx\include" Worth some reading
 
Top