Pic - reset


Closed Thread
Results 1 to 10 of 10

Thread: Pic - reset

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Thinking out loud

    Quote Originally Posted by jrt4fun


    All is working fine except when I do a 'cold reset' (power off/on) the data is to be sent twice before the pic executes the command.
    However when I reset the pic by pulling the MCLR pin low the device is responding immediately.

    Thank you
    If I understand you correctly, the PIC works correctly after pulling mclr low but not on power up . . . have you tried a capacitor from ground to mclr say 10uf to hold mclr low until pic gets going?

  2. #2
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Have you tried something as simple as:

    PAUSE 50

    FLUSH:

    IF PIR1.5 = 1 THEN
    HSERIN [FlushChar]
    GOTO Flush
    ENDIF

    Main Program:
    Charles Linquist

  3. #3
    Join Date
    Apr 2004
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    Hi guys,

    Sorry for the late reply but here is the code:

    @ DEVICE pic16F876A, HS_OSC
    ' System Clock Options
    @ DEVICE pic16F876A, WDT_OFF
    ' Watchdog Timer
    @ DEVICE pic16F876A, PWRT_ON
    ' Power-On Timer
    @ DEVICE pic16F876A, BOD_ON
    ' Brown-Out Detect
    @ DEVICE pic16F876A, LVP_OFF
    ' Low-Voltage Programming
    @ DEVICE pic16F876A, CPD_OFF
    ' Data Memory Code Protect
    ' Set to CPD_OFF for Development Copy
    ' Set to CPD_ON for Release Copy
    @ DEVICE pic16F876A, PROTECT_OFF
    ' Program Code Protection
    ' Set to PROTECT_OFF for Development Copy
    ' Set to PROTECT_ON for Release Copy

    ' Initial data for eeprom

    DEFINE OSC 10
    DEFINE I2C_SLOW 1
    DEFINE HSER_RCSTA 90h ' enable serial port, enable continuous receive
    define HSER_TXSTA 24h ' enable transmit, BRGH=1
    define HSER_SPBRG 64 ' set baudrate to 9600
    DEFINE HSER_CLROERR 1 ' automatic clear overrun error

    SYNC con $AA ' Synchronisation byte 10101010 binary

    RxD var PORTC.7 ' Rx data pin
    RxTx var PORTC.5 ' Rx / Tx function
    TxD var PORTC.6 ' Tx data pin
    Blue var PORTA.0 ' Blue led
    Red var PORTA.1 ' Red led
    MyAddress var byte
    Destination var byte
    Source var byte
    Data_1 var byte
    Temp var byte
    RCIF VAR PIR1.5
    TXIF VAR PIR1.4

    init: ADCON1=$07
    TRISB=%00000000
    PORTB=%00000000
    Low RxTx ' Set to receive mode RS485
    high Blue
    For temp = 0 to 10 high red
    pause 150
    low red
    pause 350
    Next temp
    low Blue
    MyAddress = 200 ' init complete

    loop: if RCIF then ' incomming data?
    hserin [wait(SYNC),Destination,Source,Data_1]
    high blue
    if Destination <> MyAddress Then loop ' verify address
    select case Data_1
    case 1
    gosub UnitOff
    case 2
    gosub UnitOn
    end select
    endif
    goto loop

    UnitOff:
    Low blue
    Return

    UnitOn:
    High blue
    Return
    End

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    strange, i'll bet on a hardware problem.... rrreeeaaalllyyy ssslllooowww start-up PSU maybe. BTW, do you have a complete schematic? if so, post it here.

    Try adding a 10K pull-up resistor on the RX pin...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Pic reset and following lock up problem
    By zerosvarka in forum General
    Replies: 19
    Last Post: - 17th June 2009, 20:03
  2. pic reset sometimes
    By Pedro Pinto in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 23rd January 2008, 17:27
  3. How to reset the pic by software ?
    By Shamir in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th October 2006, 16:43
  4. Must reset PIC to get correct operation?
    By Christopher4187 in forum General
    Replies: 5
    Last Post: - 2nd June 2006, 01:59
  5. PIC problem, ways to do reset
    By lab310 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th May 2005, 14:31

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