• AVR Freaks

Hot!No response from 16F15323

Author
R.G.
New Member
  • Total Posts : 13
  • Reward points : 0
  • Joined: 2013/05/23 15:05:32
  • Location: 0
  • Status: offline
2019/04/07 20:45:41 (permalink)
0

No response from 16F15323

Ok, I've been writing PIC code and programming them since there were OTP versions. It hurts me to admit this, but I cannot get a 16F15323 to respond. It's on a minimal board, and is way overkill for what the board will do, but it fit the needs for the application, and was cheaper than the other possibles.
 
In short, it programs fine, verifies fine, and the -MCLRE pin shows external differences between programming as an input versus a reset pin; otherwise, I'd be tempted to say the chip was damaged.
 
It programs, verifies, and then does ... nothing. All pins except power, ground and MCLRE stay at ground as measured by an oscilloscope. I put this down to the new, more complex config words and bank select scheme, and proceeded to spend most of the day reading the datasheet, resetting config words, messing with disabling a-d inputs, ports and pin mapping. Nothing so far changes how it acts.
 
I'm pretty certain there is a config bit or register setting that I'm missing, but danged if I can find it. If you can, I'll owe you several virtual beers, at a minimum.
 
As things kept not working, I stripped the code down further to what you see below. The test is to simply fire it up with the low frequency internal oscillator, then blink all the PORTA and PORTC pins with 1s and 0s alternately. Which bit am I missing?
 
Here's the code:
;===============================================================================
; TEST 0 to make sure the board's working
;==============================================================================
; TEST CODE HERE ========================================================
;===============================================================================
; Fuse Configuration
;-------------------------------------------------------------------------------
; PIC16LF15323 Configuration Bit Settings
#include "p16f15323.inc"
 __CONFIG _CONFIG1, _FEXTOSC_OFF & _RSTOSC_LFINT & _CLKOUTEN_OFF & _CSWEN_OFF & _FCMEN_OFF
 __CONFIG _CONFIG2, _MCLRE_OFF & _PWRTE_ON & _LPBOREN_OFF & _BOREN_OFF & _BORV_LO & _ZCD_OFF & _PPS1WAY_ON & _STVREN_OFF
 __CONFIG _CONFIG3, _WDTCPS_WDTCPS_31 & _WDTE_OFF & _WDTCWS_WDTCWS_7 & _WDTCCS_SC
 __CONFIG _CONFIG4, _BBSIZE_BB512 & _BBEN_OFF & _SAFEN_OFF & _WRTAPP_OFF & _WRTB_OFF & _WRTC_OFF & _WRTSAF_OFF & _LVP_OFF
 __CONFIG _CONFIG5, _CP_OFF
 ; CONSTANTS Variable Declarations

 ORG 0x0000 ; processor reset vector
 GOTO INITIALIZE
   NOP ; walk into code with NOPs
   NOP
   NOP
   NOP
   NOP
   NOP
   NOP
 
 ORG 0x0008
INITIALIZE:
 CLRF INTCON
 ; FIX OSCILLATOR TO STAY AT 31KhZ
 MOVLB D'17' ; point at bank 17
 MOVLW B'01010000' ; loading for OSCCON1
  ; NOSC = RSTOSC, NDIV = 1:1
 MOVWF OSCCON1 ;
  
 MOVLB D'62' ; set up bank select for ANSELA and ANSELC
 CLRF ANSELA
 CLRF ANSELC
  
 MOVLB D'0' ; point at register bank 0
 MOVLW B'11111111'
 MOVWF PORTA ; fill PORTA with 1s
 MOVWF LATA ; port a output latch all 1'a
 MOVWF PORTC ; PORT C ALL 1'S
 MOVWF LATC ; LATC alL 1S
 CLRW
 MOVWF TRISA ; port a all OUTPUTS
 MOVWF TRISC ; PORT c ALL OUTPUTS
 CLRW ; w ALL ZEROS
LOOP:
 COMF W, f ; toggle W
 MOVWF LATA ; fill PORTA with W
 MOVWF LATC ; fill PORTC with W
     GOTO LOOP
; TEST CODE ENDS HERE ========================================================

                end

 
 
 
#1

10 Replies Related Threads

    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: No response from 16F15323 2019/04/07 21:13:44 (permalink)
    0
    Are you programming with a PK3 or PK4?
    Have you tried running in debug mode?
     

    Nearly there...
    #2
    R.G.
    New Member
    • Total Posts : 13
    • Reward points : 0
    • Joined: 2013/05/23 15:05:32
    • Location: 0
    • Status: offline
    Re: No response from 16F15323 2019/04/07 21:30:25 (permalink)
    0
    Actually, I'm programming with an ASix Presto. I know, crude, and old, but it does work.
     
    No, I haven't tried running in debug mode. That would be the right thing to do, of course, but [blush] I've never needed to use a debugger before. I've always been able to get whatever I needed by observing the externals. Perhaps that's making a virtue of a necessity. I don't have any means to use debug mode.
     
     
    #3
    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: No response from 16F15323 2019/04/07 21:34:25 (permalink)
    0
    Should be able to pick up a PK3 pretty cheap now.
    Debugging in circuit can be very useful!
    You would have to run the PIC faster though, debugging won't work at 32kHz.
    Maybe try picking the HFOSC rather than LFOSC for these initial tests.
    (or just leave the oscillator on the default setting altogether.)
     

    Nearly there...
    #4
    typematrix
    New Member
    • Total Posts : 13
    • Reward points : 0
    • Joined: 2019/03/04 08:11:26
    • Location: 0
    • Status: offline
    Re: No response from 16F15323 2019/04/08 15:23:49 (permalink)
    0
    Have you tried switching the PWRTE bit to OFF?
    Power-up Timer Enable bit->PWRT disabled.
     
     
    #5
    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: No response from 16F15323 2019/04/08 16:23:11 (permalink)
    0
    I can't see having PWRTE enabled causing the reported symptoms, it just adds several milliseconds delay to startup.
    I would recommend changing
    _CLKOUTEN_OFF
    to
    _CLKOUTEN_ON
    so you can just look at the CLKOUT pin with a scope to see if your clock is running (and how fast).





    Nearly there...
    #6
    mpgmike
    Super Member
    • Total Posts : 205
    • Reward points : 0
    • Joined: 2014/01/23 17:27:06
    • Location: NJ
    • Status: online
    Re: No response from 16F15323 2019/04/08 18:16:06 (permalink)
    0
    You might have something set for external osc.  FEXTOSC in the CONFIG1 must be OFF to use INTOSC.  This is relatively new. qhb's recommendation will allow you to at least verify you have Fosc, and how fast.
    #7
    rbuck
    Super Member
    • Total Posts : 345
    • Reward points : 0
    • Joined: 2005/04/28 12:48:11
    • Location: Phoenix, AZ
    • Status: offline
    Re: No response from 16F15323 2019/04/09 13:02:54 (permalink)
    0
    Here:
    LOOP:
     COMF W, f ; toggle W
     MOVWF LATA ; fill PORTA with W
     MOVWF LATC ; fill PORTC with W
         GOTO LOOP

    You do not have any delay between toggling the LEDs on and OFF so you will not see the LEDs light.
     
    To confirm the PIC is running, change the code to this:
    LOOP:
     MOVLW 0xFF ; load W with all 1's
     MOVWF LATA ; fill PORTA with W
     MOVWF LATC ; fill PORTC with W
         GOTO LOOP

    #8
    R.G.
    New Member
    • Total Posts : 13
    • Reward points : 0
    • Joined: 2013/05/23 15:05:32
    • Location: 0
    • Status: offline
    Re: No response from 16F15323 2019/04/10 10:42:08 (permalink)
    0
    I have tried all variations of the config bits. My past history with PICs has been replete with me finding new config bits and register setups that I have not yet set correctly, so I tend to go look there when I have issues.
     
    The good news is that my continued tinkering has made it start working, adding fuel to the idea that there was a bit I had not discovered that was not set or enabled properly. The bad news is that I have been doing due dilligence, but now I cannot find which change made it start working.
     
    So - general theory (bad or incomplete setup and init on my part) seems to be verified. I think that this is my first encounter with the 14b extended architecture with a BSR and I -probably- missed setting the pointer to BSR for some instructions. But now I can't recover what the mistake was.
     
    Sigh.
     
    I'm on to other issues. The clock oscillator running from a 16MHz crystal starts readily and quickly - but only at 4MHz, as measured by the sine wave feeding the crystal, and verified by setting CLKR to an output pin. I'm off researching how to get a crystal to oscillate at a LOWER than rated frequency. That's not supposed to be easy to do.
    #9
    jack@kksound
    code tags!
    • Total Posts : 3201
    • Reward points : 0
    • Joined: 2014/05/14 10:03:19
    • Location: 0
    • Status: offline
    Re: No response from 16F15323 2019/04/10 11:00:14 (permalink)
    +1 (1)
     I'm off researching how to get a crystal to oscillate at a LOWER than rated frequency. That's not supposed to be easy to do.

    Totally depends on the type of crystal and the loads applied to it.
    #10
    rbuck
    Super Member
    • Total Posts : 345
    • Reward points : 0
    • Joined: 2005/04/28 12:48:11
    • Location: Phoenix, AZ
    • Status: offline
    Re: No response from 16F15323 2019/04/10 13:21:20 (permalink)
    +1 (1)
    You should consider downloading and using the XC8 compiler for your PIC projects. It will make life easier and you will tend to get more forum support. A lot of users abandoned assembly language programming years ago. The only time I continue to use it is for the small 10F and 12F parts. And only when I am doing something that has precision timing requirements.
    #11
    Jump to:
    © 2019 APG vNext Commercial Version 4.5