MCU seset and stop


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2013
    Posts
    31

    Default MCU seset and stop

    I'm not sure why this happened,I. using PIC16F1828 DIP version MCU,without the LCD code,the MCU works fine,after adding the LCD code in,which I copy from my other project using PIC16F877A,the MCU keep reset itset,after few reset there are nothing happed to the MCU,the oscillation is still running,below are the code

    #CONFIG
    __config _CONFIG1, _FOSC_HS
    #ENDCONFIG
    Define LOADER_USED 1
    Define OSC 20
    TRISC.0 = 0
    i var word
    for i = 1 to 10
    PORTC.0 = 1
    pause 500
    PORTC.0 = 0
    pause 200
    next i

    DEFINE LCD_DREG PORTB ' Set LCD Data Port
    DEFINE LCD_DBIT 4 ' Set Starting Data Bit(0 or 4) if 4-bit bus
    define LCD_RSREG PORTC ' Set LCD Register Select Port
    define LCD_RSBIT 6 ' Set LCD Register Bus
    define LCD_EREG PORTC
    define LCD_EBIT 3 ' Set LCD Enable Port
    define LCD_Bits 4 ' Set LCD Bus size(4 or 8 Bits)
    define LCD_LINES 2 ' Set Number of lines on LCD
    define LCD_COMMANDUS 1500 ' Set Command delat time in us
    define LCD_DATAUS 44 ' Set data delay time in us
    wind_speed var word
    wind_speed = 2345
    pause 500
    mainloop:
    PORTC.0 = 1
    lcdout $fe,1,dec(wind_speed)
    pause 2000
    PORTC.0 = 0
    lcdout $fe,1,"Wait "
    pause 1000
    goto mainloop
    end






    the first for..next loop is to test weather the MCU is running or not,is the LCD code is disable,it can run to the low part of the code,but once the LCD code is enable,it will reset itself a few times than stop operating,but the oscillator is still running normally

  2. #2
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: MCU seset and stop

    Are you sure all your code is here? There is no "for... next loop" in what you posted.

  3. #3
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: MCU seset and stop

    I think Charlie is right, but the code does seem to read correctly to a degree, but I think the resetting may because the config is only setting the speed of the processor, no other options have been set which to me might be the cause as to the resetting of the PIC. But then I use PBP 2.60c and this config statement looks different so I guessing the OP is using PBP3, so maybe this thread needs moving to the correct section ?

    Also I have to ask

    Code:
    i var word
    for i = 1 to 10
    PORTC.0 = 1
    pause 500
    PORTC.0 = 0
    pause 200
    next i
    Why use a word variable for i when it's only running 10 cycles of the for next loop. Defining it as a byte would be fine

  4. #4
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: MCU seset and stop

    What resistance are you using for the reset line? Also is the power supply solid?
    Dave Purola,
    N8NTA
    EN82fn

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: MCU seset and stop

    not to mention
    define LCD_Bits 4 ' Set LCD Bus size(4 or 8 Bits)
    define LCD_BITS 4 ' Set LCD Bus size(4 or 8 Bits)
    Warning I'm not a teacher

  6. #6
    Join Date
    Jun 2013
    Posts
    31


    Did you find this post helpful? Yes | No

    Default Re: MCU seset and stop

    I figure out the problem,the PIC16F1828 port a,b and C are all analog pin,which need to set it to digital before the LCD sequence

Similar Threads

  1. How do I stop HPWM
    By DonLuis in forum General
    Replies: 2
    Last Post: - 15th September 2012, 11:15
  2. Defining MCU with MPASM
    By Ioannis in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 24th May 2007, 13:16
  3. Why does the clock stop?
    By Russ Kincaid in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 29th May 2006, 15:36
  4. Too Simple To just Stop!
    By Homerclese in forum mel PIC BASIC
    Replies: 1
    Last Post: - 16th October 2005, 21:39
  5. Stop program
    By Sam in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th March 2004, 14:57

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