Problem with a procedure

General discussion on mikroPascal for AVR.
Post Reply
Author
Message
Vasi
Posts: 6
Joined: 15 Jun 2008 20:40

Problem with a procedure

#1 Post by Vasi » 15 Jun 2008 21:34

Hello,
I am a beginner with programming uP. I usually use Attiny26. I did a programe to control alphanumeric LCD display, everything was OK.
Then I wanted to try make a procedure for controling LCD. It wans't funcional. I tried make an easy program for flashing the LED with procedure, but without success.
Procedure was functional, but it was still repeated. I think, that program didn't know, were return after done procedure.
Please, can you help me?

This is program example:
program LCD_VL;

Procedure LED_flash;
begin
PortB.3 := 1;
Delay_ms(500);
PortB.3 := 0;
Delay_ms(200);
end;

begin
DDRB.3 := 1;
LED_flash;

While True Do
begin
// main loop
end;

end.

Sascha
Posts: 17
Joined: 01 Jun 2008 23:00
Location: Germany

#2 Post by Sascha » 16 Jun 2008 08:16

Hey Vasi,

on my ATMEga16 your program works fine. LED is flashing only one time. I don't know the Atiny26, maybe someone other can help...

Sascha

Vasi
Posts: 6
Joined: 15 Jun 2008 20:40

#3 Post by Vasi » 16 Jun 2008 19:24

Sascha, thank you for your help. Now I know, that code is OK.
I think that's compiler misstake. When I change device from Attiny26 to Attiny25 (very diferrent devices, but both have a PortB.3) everything is OK, LED is flashing only one time.
Fortunately, I will use ATmega16 for my next project (car computer).
I'm using ATtiny26 only for testing.

Vasi
Posts: 6
Joined: 15 Jun 2008 20:40

#4 Post by Vasi » 16 Jun 2008 21:20

It seems that I've solved the problem.
I put the code SP := RAMEND; to my program.
After that everything is OK, can anybody explain me this interesting?

Post Reply

Return to “mikroPascal for AVR General”