Page 1 of 1

Loop problems?

Posted: Thu Apr 05, 2012 11:59 am
by Rabbit
Hello,
I wrote a little Programm (FC5) for switching LEDs on/off.
The delay between on/off is 1 second. A loop while was inserted after "start" and before "end".
The simulation is running well. Compiler message is ok.
My problem: the real LEDs are continous on.
It seems the loop will be ignored at the PIC 16F88.

What may be wrong?

Thank you very much in advance.
Rabbit

Re: Loop problems?

Posted: Thu Apr 05, 2012 12:54 pm
by JonnyW
Hello.

I think what is most likely the case is you do:

Code: Select all

  loop
    led_on
    delay
    led_off
  end_loop
In this case there is a delay before 'off' but not one before 'on' - on HW this will appear to be continuously on. Add a second delay after 'led_off' to sort this. Like below.

Code: Select all

  loop
    led_on
    delay
    led_off
    delay
  end_loop
If this is not the issue, please post your flowchart and we can have a look.

Cheers,

Jonny

Re: Loop problems?

Posted: Tue Apr 10, 2012 6:15 am
by Rabbit
Hello Jonny,
Thanks for your answer. I have two "wait" in my little programm.

How can I post my flowchart here in the forum?

Now I changes the delay-time from 1 second to 1 millisecond and the LEDs are flashing with about 1 Hz.
So I think there is a little bug at the compiler.
I use flowcode V5.1.0.0 (10.02.2012)

Best regards
Rabitt

Re: Loop problems?

Posted: Tue Apr 10, 2012 9:46 am
by Benj
Hello,

My guess is that your settings in Flowcode are not set up correctly for your hardware. Please check the clock speed specified in the project options window and also check the configuration settings are correct for your hardware setup.

Re: Loop problems?

Posted: Tue Apr 10, 2012 1:11 pm
by Rabbit
Hello,
I've found my bug: the missing OUT-channel RB3 was used as ICSP-programming-pin in the project options.
I disabled low-voltage-programming and all output-pins at Port-B are available.

Regards Rabbit