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
Interrupt Routine not firing
Re: Interrupt Routine not firing
That's because you probably left main org-ed at 0x1000. Move main after the ISR (keeping OrgAll as it is).philcr wrote:39 361 Bad function absolute address 'interrupt[4104]' RealTimeClock.mpas
39 342 There is not enough ROM space interrupt[4104] RealTimeClock.mpas
Re: Interrupt Routine not firing
I'm glad it's working , and you may always reprogram the chip and have the bootloader back.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
Re: Interrupt Routine not firing
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
Many thanks again for all your help.
Phil
Re: Interrupt Routine not firing
Right, you can't just move the main - bootloader jumps to 0x1000 and expects this to be start of code (what were I thinking ). 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.philcr wrote:I have tried changing the organisation for main to like 1040 but my program doesn't run.
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:
Code: Select all
procedure res_vec; org 0x1000;
begin
asm goto _main end;
end;
procedure interrupt; org 0x1008;
begin
...
end;
BEGIN
orgall(0x1000);
{ Main program }
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.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.
-
- Posts: 6
- Joined: 22 Feb 2016 14:54
Re: Interrupt Routine not firing
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.
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.