It is currently 18 Oct 2018 23:32

All times are UTC + 1 hour




Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: 12 Jan 2015 21:04 
Offline

Joined: 24 Jul 2014 09:37
Posts: 24
Guys I gave up with the boot loader and used my pic kit 3 to program all is working as I would expect, many thanks for the time you have spent helping me out.

Kindest Regards

Phil


Top
 Profile  
 
PostPosted: 12 Jan 2015 22:26 
Offline

Joined: 18 Feb 2006 13:17
Posts: 4982
philcr wrote:
39 361 Bad function absolute address 'interrupt[4104]' RealTimeClock.mpas
39 342 There is not enough ROM space interrupt[4104] RealTimeClock.mpas
That's because you probably left main org-ed at 0x1000. Move main after the ISR (keeping OrgAll as it is).

_________________
Replacement libraries for mP PRO and PIC18 processors, mP PRO tips & trics


Top
 Profile  
 
PostPosted: 12 Jan 2015 22:29 
Offline

Joined: 18 Feb 2006 13:17
Posts: 4982
philcr wrote:
Guys I gave up with the boot loader and used my pic kit 3 to program all is working as I would expect
I'm glad it's working :) , and you may always reprogram the chip and have the bootloader back.

_________________
Replacement libraries for mP PRO and PIC18 processors, mP PRO tips & trics


Top
 Profile  
 
PostPosted: 12 Jan 2015 23:12 
Offline

Joined: 24 Jul 2014 09:37
Posts: 24
I have tried changing the organisation for main to like 1040 but my program doesn't run. I think I'm just going to persevere with normal programming using the pic kit programmer. It's not as scary as it used to be back in the 90's.

Many thanks again for all your help.

Phil


Top
 Profile  
 
PostPosted: 12 Jan 2015 23:54 
Offline

Joined: 18 Feb 2006 13:17
Posts: 4982
philcr wrote:
I have tried changing the organisation for main to like 1040 but my program doesn't run.
Right, you can't just move the main - bootloader jumps to 0x1000 and expects this to be start of code (what were I thinking :roll: ). Microchip bootloader assumes that addresses are simply shifted and organized just like processor addresses starting at 0x0000 - and some compilers do the shifting automatically when requested. mP however, does not, so one has to do it manually.
What your code is lacking at the moment is the shifted RESET vector, so you need to add a procedure placed at 0x1000 with the sole purpose of jumping to main. The following should do it:

procedure res_vec; org 0x1000;
 begin
  asm goto _main end;
 end;

procedure interrupt; org 0x1008;
 begin
  ...
 end;

BEGIN
  orgall(0x1000);
  { Main program }
Note that that you don't need to place main at any specific address - let compiler do it, as well as replace 'goto _main' with jump to appropriate address.

Quote:
I think I'm just going to persevere with normal programming using the pic kit programmer. It's not as scary as it used to be back in the 90's.
It sure is easier :) and bootloader may sometimes be limiting. On the other hand, it's good to know how to handle bootloader in case a project needs it.

_________________
Replacement libraries for mP PRO and PIC18 processors, mP PRO tips & trics


Top
 Profile  
 
PostPosted: 17 Jan 2018 18:47 
Offline

Joined: 22 Feb 2016 14:54
Posts: 4
Hello everyone,
I'm trying to use INT0 (RB0) interrupt with a PIC 18F4620 but it don't wake up with a rising edge on RB0
Here is my code
procedure Interrupt;
begin
if INTCON.INT0IF=1 then
begin
PORTC.0:=1;
etat:=etat xor 1;
INTCON.INT0IF:=0;
end;
end;

begin

TRISC:=$00;
TRISB:=$FF;
//PORTB:=$00;
TRISD:=$FF;
indice:=0;
etat:=true;
INTCON.INT0IF:=0;
INTCON.INT0IE:=1;
INTCON.GIE:=1;
INTCON.PEIE:=1;
INTCON2.INTEDG0:=1;


while true do
begin
while indice<8 do
begin
PORTC.indice:=1;
delay_ms(500);
if etat=true then
begin
PORTC.indice:=0;
indice:=indice+1;
end;
end;
indice:=0;
end;
end.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: