Multiple problems with PIC16LF15313


+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2009
    Location
    Southern California
    Posts
    86

    Default Multiple problems with PIC16LF15313

    I'm trying to migrate a program to a new small chip I have never used before. I have had multiple problems with it and am beginning to suspect there might be some sort of problem with the MPASM include file or the something else under the hood that I'm not familiar enough to figure out on my own.

    I have stripped the program down to the basics. I verify a heartbeat at the beginning with an LED then I made a main loop to basically do nothing with an x = 0 goto main loop. When I do this, there is about a 2-3 second pause after the heartbeat and then the program seems to time out and restart. I assume the watchdog is being triggered. It goes on forever this way. ran a faster heartbeat within the mainloop and it worked as expected. I After a lot of random trial and error I found that if I added a pauseus 1 command it would stop resetting. I didn't really want to add this statement, but could live with it. The program below is one step above that where I'm trying to monitor 1 pin and mimic the state on another pin and no matter what I do the read always acts as if the pin is low. I've used a volt meter to verify changes in hardware and have tested on multiple boards and am not having any luck. I triple checked my schematic pin outs match the data sheet. If anyone has any suggestions I would appreciate it


    Code:
     DEFINE OSC 32
    'no changes made to any config settings so far 6-26-2020		
    #CONFIG
        __config _CONFIG1, _FEXTOSC_OFF & _RSTOSC_HFINT32 & _CLKOUTEN_OFF & _CSWEN_ON & _FCMEN_ON
        __config _CONFIG2, _MCLRE_ON & _PWRTE_ON & _LPBOREN_OFF & _BOREN_ON & _BORV_LO & _ZCD_OFF & _PPS1WAY_OFF & _STVREN_ON
        __config _CONFIG3, _WDTCPS_WDTCPS_11 & _WDTE_ON & _WDTCWS_WDTCWS_6 & _WDTCCS_HFINTOSC
        __config _CONFIG4, _BBSIZE_BB512 & _BBEN_OFF & _SAFEN_OFF & _WRTAPP_OFF & _WRTB_OFF & _WRTC_OFF & _WRTSAF_OFF & _LVP_OFF
        __config _CONFIG5, _CP_OFF
    #ENDCONFIG
    
    TRISA = %1111010      		'output on 0,2.  input on remainder
    
    OUT_SIG		var	LATA.0     'PORTA.0		'output to input chip
    CL_LED		var	LATA.2     'PORTA.2   	'blink LED when current loop changes
    RS_SIG		var	PORTA.1		'232 and 422 combined signal
    CLOOP		VAR	PORTA.5		'current loop
    
    X			var	byte
    
    
    'heartbeat
    for x = 0 to 1
    CL_LED = 0
    pause 500
    CL_LED = 1
    pause 500
    next x
    
    Mainloop:
     
    pauseus 1
    CL_LED = RS_SIG
    
    goto mainloop
    end

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    1,716

    Default Re: Multiple problems with PIC16LF15313

    trying to use a chips pins as digital i/o when they are still configured as analogue is never a recipe for success

  3. #3
    Join Date
    Apr 2014
    Location
    Northeast
    Posts
    323

    Default Re: Multiple problems with PIC16LF15313

    I believe these newer PICs default to analog inputs. Try:

    ANSELA = 0

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    1,716

    Default Re: Multiple problems with PIC16LF15313

    Quote Originally Posted by mpgmike View Post
    I believe these newer PICs default to analog inputs
    i'd be astonished if you could find a pbp supported chip that doesn't default to analog
    This is more entertaining than Free to Air TV

  5. #5

    Default Re: Multiple problems with PIC16LF15313

    This also sounds like the MCLR pin may not be tied high.

  6. #6
    Join Date
    Feb 2009
    Location
    Southern California
    Posts
    86

    Default Re: Multiple problems with PIC16LF15313

    Thanks everyone. I'll try that in a couple hours, but you are probably correct. I was migrating from a 16F54, which didn't have analog options on the pins I was using, so when I was updating all the registers, I didn't think about adding new registers. I'm pretty sure you guys are correct though. I did have MCLR tied high. There must be some analog conversion going on that causes the unit to reset and somehow the pauseus command is enough to prevent it, but it isn't worth investigating if going digital cleans it all up.

    Thanks again.

Similar Threads

  1. Replies: 5
    Last Post: - 29th August 2014, 00:43
  2. Programming multiple pics with multiple programs
    By Luckyborg in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 3rd April 2013, 17:47
  3. Multiple AND's
    By tazntex in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 1st November 2008, 10:42
  4. Problems controlling multiple pics
    By gandora in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 29th May 2007, 08:59
  5. multiple lcd's
    By schu4647 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd June 2006, 05:02

Posting Permissions

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