Pic - reset


Closed Thread
Results 1 to 10 of 10

Thread: Pic - reset

  1. #1
    Join Date
    Apr 2004
    Posts
    34

    Angry Pic - reset

    Hello,

    I wrote a program where I'm collecting data using the internal uart of the Pic16F876A.
    In my main loop I check the status of the RCIF flag. When the flag is set I'm collecting the data (8bytes).

    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.

    Someone has a thought how this can be solved or did someone had the same experience?

    Thank you

  2. #2
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Unhappy

    Without any code....

    I think you put the right baudrate after polling the RX-register !
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

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


    Did you find this post helpful? Yes | No

    Default

    I guess the Power-Up Timer and the Brown-out Voltage config bit maybe TRIS, maybe this, maybe that.

    Post your code here, even if we are close, we are not god
    Steve

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

  4. #4
    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?

  5. #5
    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

  6. #6
    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

  7. #7
    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.

  8. #8
    mc sung's Avatar
    mc sung Guest


    Did you find this post helpful? Yes | No

    Default lcd display

    Quote Originally Posted by BigWumpus
    Without any code....

    I think you put the right baudrate after polling the RX-register !
    Hi.May i know how to connect the lcd display wif pic 16f877a ,include the schematics and the software.thanks n have a nice day.

  9. #9
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Schematics and code are already in the PICBasicPro manual. Just adjust it for your chosen PIC and the pins you want to use, taking into account that your PIC may have Comparators and ADCs that may need to be disabled if you chose to use those PIC pins that have them.

  10. #10
    mc sung's Avatar
    mc sung Guest


    Did you find this post helpful? Yes | No

    Default PICbasicPRO manual

    Quote Originally Posted by Melanie
    Schematics and code are already in the PICBasicPro manual. Just adjust it for your chosen PIC and the pins you want to use, taking into account that your PIC may have Comparators and ADCs that may need to be disabled if you chose to use those PIC pins that have them.
    Hi.Actually i m dummies for this software.Can u send me the examples code how to write a program to display a word in lcd using PIC.I really dun know where to get d examples code.Your helps really me appreciates.Thanks

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 : 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