Porting to MPLAB IDE

Discussion in 'Programmer's Corner' started by Dalaran, May 16, 2011.

  1. Dalaran

    Thread Starter Active Member

    Dec 3, 2009
    I was using the demo version of mikroElectroikas software but soon turned out the 2k program size is not large enough. When going to MPLAB (using C language) I ended up with a few problems was hoping someone could help me on.

    First this is what I was using in mikro for setting up the LCD

    Code ( (Unknown Language)):
    1. sbit LCD_RS at RB4_bit;
    2. sbit LCD_EN at RB5_bit;
    3. sbit LCD_D4 at RB0_bit;
    4. sbit LCD_D5 at RB1_bit;
    5. sbit LCD_D6 at RB2_bit;
    6. sbit LCD_D7 at RB3_bit;
    8. sbit LCD_RS_Direction at TRISB4_bit;
    9. sbit LCD_EN_Direction at TRISB5_bit;
    10. sbit LCD_D4_Direction at TRISB0_bit;
    11. sbit LCD_D5_Direction at TRISB1_bit;
    12. sbit LCD_D6_Direction at TRISB2_bit;
    13. sbit LCD_D7_Direction at TRISB3_bit;
    But MPLAB doesn't seem to like these commands.

    Also, even with commenting all of these references out I get the following error when building:

    Code ( (Unknown Language)):
    1. Error   [491] ; . can't find 0x5C words for psect "rbss_0" in segment "BANK0"
    Any ideas?


    edit: When I look through the Memory Usage Map, BANK0 of the Data Space section is almost completely full. As soon as I add a division or something like that it exceeds it and gives me the error. Any idea why this is occuring? How do I move to Bank1, etc.
    Last edited: May 16, 2011
  2. t06afre

    AAC Fanatic!

    May 11, 2009
    MPLAB is just an IDE. You must tell us which program language/compiler you use. And also name you MCU
  3. Dalaran

    Thread Starter Active Member

    Dec 3, 2009
    Thanks for the reply.

    I program in C.
    Hi-Tech C Complier.
    Using PIC16F886.
    EasyPic6 development board.

  4. t06afre

    AAC Fanatic!

    May 11, 2009
    The sbit is something MicroC use to set bits in the SFRs. In Hitech C is done somewhat different. To understand take a look at the file pic16f886.h in the Hitech C compiler install folder (the include folder)
    So you can do something like this
    Code ( (Unknown Language)):
    1. #define LCD_RS RA3
    2. #define LCD_RW RA2
    3. #define LCD_EN RA1
    4. #define LCD_DATA PORTD
    5. .
    6. .
    7. .
    8. main
    9. {
    10.  LCD_RW=1;
    11. LCD_DATA=0xfa;
    12. }
    But you better post your full MicroC code.