Jump to content

Can't Get Bosstc To Work Under Mplab8.1


Recommended Posts

I’m having difficulty getting the Sourceboost C compiler to integrate with MPLAB 8.1.

The code will compile but when it is downloaded to the PIC and run, nothing appears to happen at the hardware, and the Watch List is not updated as if the registers have not been changed.

 

I tried to program a 16F616 with no luck. I’m now trying the program WINK LED that I got off the web on a 16F877 on aPicDem2 board. Again no work!

 

Code is as shown.

 

 

//Wink LED CODE toggles RB0, RB1

 

#include <pic16f877.h>

#include <system.h>

#include <icd2.h>

// Set configuration fuses.

 

#pragma DATA _CONFIG, _XT_OSC & _WDT_OFF & _CP_OFF & _PWRTE_OFF

 

#pragma CLOCK_FREQ 4000000

 

void main()

{

trisb = 0; //configure port B pins as output

while( 1 ) //endless loop

{

portb.0=1; // set portb pin0 to high.

portb.1=0; // set portb pin1 to low.

delay_ms( 500 ); // pause 0.5 seconds

portb=0x02; // shows hex notation for entering data.

delay_ms(500); // you can also write portb=2 in decimal

}

}

 

 

What is the problem? Any help greatly appreciated!

Link to post
Share on other sites

#pragma DATA _CONFIG, _XT_OSC & _WDT_OFF & _CP_OFF & _PWRTE_OFF

 

this sets up an external oscillator. If that's not your intent, replace _XT_OSC with _INTOSCIO (for the 616) and you should be good to go. Note that i haven't looked at the code or anything :)

 

the manual for the 616 is right here (if you don't already have it):

 

http://ww1.microchip.com/downloads/en/DeviceDoc/41288A.pdf

 

they are awesome.

Link to post
Share on other sites

On some PICs the ADC inputs are switched on by default at reset.

 

Try setting the ANSEL = 0 to turn the ports from analogue to digital.

 

Also note the delay_ms(x) takes an unsigned char so 255 is the maximum value. Switch on "All Warnings" and the compiler will grumble at you.

 

Cheers

 

Reynard

Link to post
Share on other sites
#pragma DATA _CONFIG, _XT_OSC & _WDT_OFF & _CP_OFF & _PWRTE_OFF

 

this sets up an external oscillator. If that's not your intent, replace _XT_OSC with _INTOSCIO (for the 616) and you should be good to go. Note that i haven't looked at the code or anything :)

 

the manual for the 616 is right here (if you don't already have it):

 

http://ww1.microchip.com/downloads/en/DeviceDoc/41288A.pdf

 

they are awesome.

 

Sorry for the confusion. I'm now programming a 16F877 with a 4 Mhz external osc as on the Pic Dem 2 board. My eventual goal is to figure out what I'm doing wrong on the '877 which I've used in the past with a different compiler, and then go back to the 16F616.

Link to post
Share on other sites
On some PICs the ADC inputs are switched on by default at reset.

 

Try setting the ANSEL = 0 to turn the ports from analogue to digital.

 

Also note the delay_ms(x) takes an unsigned char so 255 is the maximum value. Switch on "All Warnings" and the compiler will grumble at you.

 

Cheers

 

Reynard

Link to post
Share on other sites
On some PICs the ADC inputs are switched on by default at reset.

 

Try setting the ANSEL = 0 to turn the ports from analogue to digital.

 

Also note the delay_ms(x) takes an unsigned char so 255 is the maximum value. Switch on "All Warnings" and the compiler will grumble at you.

 

Cheers

 

Reynard

Thanks, Turns out that's the problem, pins were set to analog in. ANSEL = 0; solved the problem.

 

Thanks again for the quick reply.

 

JT

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...