• AVR Freaks

Hot!16F1936 PortA.7 NO Digital out???

Author
mountain747
Starting Member
  • Total Posts : 32
  • Reward points : 0
  • Joined: 2004/11/26 19:35:22
  • Status: offline
2020/04/04 08:37:29 (permalink)
0

16F1936 PortA.7 NO Digital out???

Working on a lighting project using 16F1936 and have a strange problem.  RA.7 will not function as a digital output.  Programig in PBP with assembly in MPASM,  So,RA.6 and RA.7 are also oscillator pins and must be set to I/O outputs in CONFIG1 with CLKOUTEN=1 (_CLKOUTEN_OFF) and FOSC= INTOSC (_FOSC_INTOSC). According to the data sheet this should give digital I/O on both RA.6 and RA.7. RA.6 is responding as expected. RA.7 is NOT giving me a digital output. I have tried on multiple 1936’s on multiple boards. No 5V output on RA.7.
 
asm
 __config _CONFIG1,_FOSC_INTOSC & _CLKOUTEN_OFF & _MCLRE_ON & _BOREN_OFF & _WDTE_OFF & _FCMEN_OFF & _CP_OFF & _CPD_OFF & _IESO_OFF
 __config _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_ON & _BORV_LO & _LVP_OFF
endasm
Include "MODEDEFS.BAS" ' Include for Shiftin/out modes
define osc 8
;--[ Set Hardware ]---------
    OSCCON=%01110000
    ANSELA=$0
    ANSELB=$0
    ADCON0=$0
    ADCON1= 7
    PortA=0
    PortB=0
    PortC=0
    TrisA=0
    TrisB=%00001001 ;PortB.4 is input for UBS Tx & RTCC Alarm functions
    TrisC=0

 
    LATA.7=1   ---NO 5V output

 
I have also verified no osc output on RA.7.  it must have something to do with configs.  What have I overlooked?
Thanks,
Wayne
post edited by mountain747 - 2020/04/04 08:41:57
#1

7 Replies Related Threads

    Joel_C
    New Member
    • Total Posts : 14
    • Reward points : 0
    • Joined: 2019/12/28 14:13:53
    • Location: 0
    • Status: online
    Re: 16F1936 PortA.7 NO Digital out??? 2020/04/04 08:57:30 (permalink)
    +1 (1)
    In your config statement you have "__config _CONFIG1,_FOSC_INTOSC & _CLKOUTEN_OFF & _MCLRE_ON "
     
    You should have _CLKOUTEN_ON   to enable Digital output on that pin.
     
    Joel
     
    #2
    Joel_C
    New Member
    • Total Posts : 14
    • Reward points : 0
    • Joined: 2019/12/28 14:13:53
    • Location: 0
    • Status: online
    Re: 16F1936 PortA.7 NO Digital out??? 2020/04/06 06:16:40 (permalink)
    0
    Wayne  Do you have anything else attached to RA.7?  I recently had a similar problem with a different PIC. I was trying something on a board with a ceramic resonator attached to CLKOUT and CLKIN. I was using the internal oscillator and tried using the CLKIN and CLKOUT pins as digital output. This was an 8 pin PIC with very limited in/out pins (Pic12F1822). I was able to get digital out from the CLKOUT pin but not from the CLKIN pin. Removing the ceramic resonator from the board restored digital output to the CLKIN pin.
     
    Joel
    #3
    ric
    Super Member
    • Total Posts : 26942
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: 16F1936 PortA.7 NO Digital out??? 2020/04/07 02:10:55 (permalink)
    +2 (2)
    Joel_C
    In your config statement you have "__config _CONFIG1,_FOSC_INTOSC & _CLKOUTEN_OFF & _MCLRE_ON "
     
    You should have _CLKOUTEN_ON   to enable Digital output on that pin.
     
    Joel

    No you shouldn't.
    You have noticed this bit uses negative logic, and assume the "ON" means the bit is 1.
    That is not correct.
    "ON" does mean "clock output on", which is not what you want.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #4
    mountain747
    Starting Member
    • Total Posts : 32
    • Reward points : 0
    • Joined: 2004/11/26 19:35:22
    • Status: offline
    Re: 16F1936 PortA.7 NO Digital out??? 2020/04/07 14:09:59 (permalink)
    0
    thank you for your replys, I'm still trying to figure this one out.
    #5
    Joel_C
    New Member
    • Total Posts : 14
    • Reward points : 0
    • Joined: 2019/12/28 14:13:53
    • Location: 0
    • Status: online
    Re: 16F1936 PortA.7 NO Digital out??? 2020/04/08 17:58:49 (permalink)
    0
    Wayne:  I have a ME Labs trainer which has a PIC 16F1937 on it.
    A PIC 16F1937 should be equivalent to your PIC 16F1936,  40 pins vs your 28 pins.
     
    I tried loading the code that you presented in your first post.
    I used PBPX 3.1.2.4 Compiler.
    I had to change your asm/endasm to #config/#config to get it to compile.
    I had to remove your _LVP_OFF to get it to program the PIC 16F1937 on the trainer board.
    I had no trouble turning an LED attached to PORTA.7 on and off.
     
    PORTA.7 worked fine on my trainer board. 
     
    Joel
    #6
    mountain747
    Starting Member
    • Total Posts : 32
    • Reward points : 0
    • Joined: 2004/11/26 19:35:22
    • Status: offline
    Re: 16F1936 PortA.7 NO Digital out??? 2020/04/13 09:11:51 (permalink)
    0
    thanks for the reply Joel.  I droped the _LVP_OFF from the configs but made no change in the results.  I have a constant 2.6V on RA7 output which should not be there is RA7 was functioning as Clock_In.  RA6 is also clock out but is excepting the I/O output as directed.  and I'm convensed it has something to do with the config programig at 8007h & 8008h but I haven't figued it out yet. I may have to reload some software but that doesn't figure since everything else is working as expected. (???)
    Wayne
     
    #7
    Joel_C
    New Member
    • Total Posts : 14
    • Reward points : 0
    • Joined: 2019/12/28 14:13:53
    • Location: 0
    • Status: online
    Re: 16F1936 PortA.7 NO Digital out??? 2020/04/13 09:30:33 (permalink)
    0
    The _LVP_OFF should not make any difference in the way a program runs. I had to change it to program my board.
    In your original post you stated that you were using PBP. In PBP3 you use #CONFIG/#ENDCONFIG Not ASM/ENDASM for configuration of the PIC's. 
    According to the PBP manual:
     
    The #CONFIG block is similar to the ASM..ENDASM and @ runtime commands because its contents are written in Assembly Language. It is a special case, however, and differs from the runtime commands in significant ways. The code enclosed in a #CONFIG block always replaces the default configuration settings that PBP would normally include. The code is placed in a special location in the generated Assembly Language. This location is reserved for configuration directives; therefore #CONFIG should not be used for other Assembly instructions.
     
    Joel
    #8
    Jump to:
    © 2020 APG vNext Commercial Version 4.5