slow return from subrutine


Closed Thread
Results 1 to 22 of 22

Hybrid View

  1. #1
    servo260's Avatar
    servo260 Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks a lot, I'm going crazy with this.

  2. #2
    Warrier's Avatar
    Warrier Guest


    Did you find this post helpful? Yes | No

    Default

    a few, perhaps irrelevant, comments:

    why store the value of circunferencia as 1 (data @0,1) and the use Read 0, circunferencia at power up to read it? why not set the variable to 1 (circunferencia=1) at start up and not worry about EEPROM?

    why use Pause 1 three times for turning on the display when you could use Pause 3?

    It is nice to have an End statement somewhere.

    PIC MCU has output drive limitations - that's why Steve commented on using 300ohms to keep it within spec. Besides, the transistors have quite large hFE so you don't need to drive the base that hard to turn on the 7segments!

    SENSOR? what kind of output? since there is no pull up (or pull down) on this line make sure logic 1 and 0 are true and the line doesn't float as you have disabled the internal port B pullups.

    -warrier

  3. #3
    servo260's Avatar
    servo260 Guest


    Did you find this post helpful? Yes | No

    Default

    I use the eeprom because I wanted to later modified that value, but I need It to not get lost when I turn off the power. But so far I was unnable to write something in the eeprom using the write command, it does nothing, and I tried it on a 16f84a and a 16f627. Not only with this code, I have made some simple codes to test it and the result is always the same.
    The pause 3 times were some stupid test I made, I already changed that.
    I already changed the resistor, first I tried with 300ohm, and now with 470ohm.
    But nothing changed.
    The sensor is a photomicrosensor, so RB0 is connected to a phototransistor, with their respective resistors.
    I tried disconecting it and puting the pin to gorund but, again, nothing changed.

  4. #4
    servo260's Avatar
    servo260 Guest


    Did you find this post helpful? Yes | No

    Default

    well, I have tried with 3 buttons now (the third to return from the subrutine) and it continue taking 20 sec to return. I'm very sure It must be a PBP issue, because with simple test programs the speed is fine.
    Can I have some corrupt file inside PBP?

Similar Threads

  1. Multi Slow speed PWM and Instant Interrupts
    By DaveC3 in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 2nd November 2010, 12:50
  2. Making a menu
    By chrisshortys in forum mel PIC BASIC Pro
    Replies: 36
    Last Post: - 12th November 2008, 19:54
  3. Stack over flow with IF THEN RETURN ENDIF???
    By kdoske in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 9th December 2007, 17:20
  4. IC2 pic 18f452 program problems
    By MrSafe in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 20th September 2007, 18:55
  5. Can RESUME replace RETURN in a GOSUB?
    By peterdeco1 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 9th October 2005, 09:03

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts