I’ve recently bought a couple of P-Star 25k50 by Pololu to use in one of my project. I usually use MikroPascal to compile the hex file because of its libraries! It happens that if I write a simple program to turn on a led without using the MikroPascal internal library, it works fine: I compile the program then I load it into the P-star with its bootloader (I have to use a simple tool called P-load to load the hex into the pic through usb cable) the pic restart and the program runs properly. To correctly program the pic the program has to start from address 0x2000 because of the bootloader which uses the first 8 kb of memory. Here is the simple code that works:
Code: Select all
program library_test_1;
{ Declarations section }
begin
org 0x2000;
ANSELB.3 := 0;
TRISB.3 := 1;
ANSELC.6 := 0;
TRISC.6 := 0;
LATC.6 := 1; //led on RC6 is off while the pin is high and on while the pin is low
while true do
begin
if (PORTB.3 = 1) then //pin RB3 is pulled-down on GND
begin
LATC.6 := 0;
delay_ms(1000);
LATC.6 := 1;
end
else LATC.6 := 1;
end;
end.
Code: Select all
program library_test_1;
{ Declarations section }
begin
org 0x2000;
ANSELB.3 := 0;
TRISB.3 := 1;
ANSELC.6 := 0;
TRISC.6 := 0;
LATC.6 := 1;
while true do
begin
if (Button(PORTB, 3, 1, 1)) then
begin
LATC.6 := 0;
delay_ms(1000);
LATC.6 := 1;
end
else LATC.6 := 1;
end;
end.
I am sorry but I am not able to solve this problem; any help or solving direction from you would be really appreciated.
Thank you in advance for your help.