7 second delay on startup


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2006
    Location
    New Hampshire, USA
    Posts
    107

    Default 7 second delay on startup

    I wrote a short program for 16F627A, using internal oscillator, WDT and power up timers disabled, MCLR is an input. low voltage programming enabled. The program runs OK but 7 seconds after power is applied. I don't want that delay, how do I get rid of it? This is the .ASM file, I don't understand it, but perhaps someone can tell me how there is a delay here.

    ; PicBasic Pro Compiler Demo, (c) 1998, 2004 microEngineering Labs, Inc. All Rights Reserved.
    PM_USED EQU 1

    INCLUDE "16F627A.INC"

    RAM_START EQU 00020h
    RAM_END EQU 0014Fh
    RAM_BANKS EQU 00003h
    BANK0_START EQU 00020h
    BANK0_END EQU 0007Fh
    BANK1_START EQU 000A0h
    BANK1_END EQU 000EFh
    BANK2_START EQU 00120h
    BANK2_END EQU 0014Fh
    EEPROM_START EQU 02100h
    EEPROM_END EQU 0217Fh

    R0 EQU RAM_START + 000h
    R1 EQU RAM_START + 002h
    R2 EQU RAM_START + 004h
    R3 EQU RAM_START + 006h
    R4 EQU RAM_START + 008h
    R5 EQU RAM_START + 00Ah
    R6 EQU RAM_START + 00Ch
    R7 EQU RAM_START + 00Eh
    R8 EQU RAM_START + 010h
    FLAGS EQU RAM_START + 012h
    GOP EQU RAM_START + 013h
    RM1 EQU RAM_START + 014h
    RM2 EQU RAM_START + 015h
    RR1 EQU RAM_START + 016h
    RR2 EQU RAM_START + 017h
    ; C:\PROGRA~1\MECANI~1\MCS\FLASHB~1.PBP 00012 led var byte
    _led EQU RAM_START + 018h
    _PORTL EQU PORTB
    _PORTH EQU PORTA
    _TRISL EQU TRISB
    _TRISH EQU TRISA
    #define _PORTB_2 PORTB, 002h
    #define _PORTB_0 PORTB, 000h
    #define _PORTB_1 PORTB, 001h
    INCLUDE "FLASHB~1.MAC"
    INCLUDE "PBPPIC14.LIB"


    ; C:\PROGRA~1\MECANI~1\MCS\FLASHB~1.PBP 00013 TRISA = %00000000 'ALL OUTPUTS
    MOVE?CB 000h, TRISA

    ; C:\PROGRA~1\MECANI~1\MCS\FLASHB~1.PBP 00014 TRISB = %00000000
    MOVE?CB 000h, TRISB

    ; C:\PROGRA~1\MECANI~1\MCS\FLASHB~1.PBP 00015 PORTB = %00000011 'PINS 6 & 7 HIGH, ALL OTHERS LOW
    MOVE?CB 003h, PORTB

    ; C:\PROGRA~1\MECANI~1\MCS\FLASHB~1.PBP 00017 FOR LED = 1 TO 5 'FLASH LEDs 5 TIMES
    MOVE?CB 001h, _led
    LABEL?L L00001
    CMPGT?BCL _led, 005h, L00002

    ; C:\PROGRA~1\MECANI~1\MCS\FLASHB~1.PBP 00018 PORTB.2 = 1 'LEDs ON PIN 8
    MOVE?CT 001h, _PORTB_2

    ; C:\PROGRA~1\MECANI~1\MCS\FLASHB~1.PBP 00019 PAUSE 150
    PAUSE?C 096h

    ; C:\PROGRA~1\MECANI~1\MCS\FLASHB~1.PBP 00020 PORTB.2 = 0
    MOVE?CT 000h, _PORTB_2

    ; C:\PROGRA~1\MECANI~1\MCS\FLASHB~1.PBP 00021 PAUSE 150
    PAUSE?C 096h

    ; C:\PROGRA~1\MECANI~1\MCS\FLASHB~1.PBP 00022 NEXT LED
    NEXT?BCL _led, 001h, L00001
    LABEL?L L00002

    ; C:\PROGRA~1\MECANI~1\MCS\FLASHB~1.PBP 00023 FREQOUT 3, 5000, 2500 'SOUND ON PIN 9
    FREQOUTPIN?C 003h
    FREQOUTTIME?C 01388h
    FREQOUT?C 009C4h

    ; C:\PROGRA~1\MECANI~1\MCS\FLASHB~1.PBP 00024 PORTB.0 = 0
    MOVE?CT 000h, _PORTB_0

    ; C:\PROGRA~1\MECANI~1\MCS\FLASHB~1.PBP 00025 PORTB.1 = 0 ' TURN OFF POWER
    MOVE?CT 000h, _PORTB_1

    ; C:\PROGRA~1\MECANI~1\MCS\FLASHB~1.PBP 00026 END
    END?

    END

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default Slow startup

    Check your PCON register setting (see the PIC16F62xA datasheet, section 14.2.8).
    You might actually be running at 37khz vs. 4mhz if you are using the internal clock.
    By my calculations, it should actually be starting up about 16 seconds after power on if you haven't defined any other oscillator setting (meaning the default setting of 4mhz is used by default). It makes more sense if you've actually 'defined' 8mhz.

    Does the whole program run slow or just the start up?

    JDG

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Russ,

    Do you have a Pull-Down resistor on the RB4/PGM pin?
    <br>
    DT

  4. #4
    Join Date
    Jan 2006
    Location
    New Hampshire, USA
    Posts
    107


    Did you find this post helpful? Yes | No

    Default

    JDG: The program runs normal speed once it starts. I re-programmed the PIC (nothing different, as far as I know), but now the delay is gone. I did not specify the clock frequency, it seems that the MeLabs programmer over-rides any PICBASIC commands?

    Darrel: The RA4/PGM pin is set as an output and low. Do I need a pull down resistor?

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Yes, you still need a resistor.

    When the LV programming is enabled, the output stage is over-ridden, so the state of the TRIS bit will have no effect.
    <br>
    DT

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default Slow startup

    Show us the regular code, not the assembly output.
    Why it works now is beyond me. The programmer won't override anything in PBP sends it or anything that PM sends it. The software that drives the programmer might, but definetely not the programmer itself.
    In any case, I don't see a 7 second delay in the startup as a config word problem or something like that.
    Maybe something in the circuitry just took awhile to charge up or power up and combined with no resistor on RB4 was the problem overall....who knows...
    JDG

Similar Threads

  1. 16F628A - Stops if release power switch.
    By dene12 in forum General
    Replies: 16
    Last Post: - 14th February 2009, 07:57
  2. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15:23
  3. 7 segment digit problem (using Mister E's code)
    By jmgelba in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 9th September 2005, 20:25
  4. Memory Space of the PIC16F84...
    By Tear in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 1st July 2005, 19:55
  5. Problem with saving to EEPROM...
    By Tear in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 1st July 2005, 00:10

Members who have read this thread : 1

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