16F627A PortA.4 trouble?


Closed Thread
Results 1 to 22 of 22

Hybrid View

  1. #1
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    158


    Did you find this post helpful? Yes | No

    Default Re: 16F627A PortA.4 trouble?

    OK, I bricked 2 of these chips now... With this code?

    Code:
    Capture      VAR PIR1.2              
    T1CON.5=1     '1:4 prescaler
    T1CON.4=0     '1:4 prescaler
    T1CON.3=1     'Timer1 OSC enabled
    T1CON.2=1     'sychro clock
    T1CON.1=0     'internal clock
    T1CON.0=1     'start timer
    It works fine until I add the above into my program, then it seems portb.7 gets fried and I have to replace the chip to program again.
    Shawn

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: 16F627A PortA.4 trouble?

    Hi,
    Just a shot in the dark here, can it have anything to do with LVP, do you have it turned OFF in the CONFIGs?

    What programmer are you using to program the chips? Once they are "bricked" can't you even erase them?

    /Henrik.

  3. #3
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    158


    Did you find this post helpful? Yes | No

    Default Re: 16F627A PortA.4 trouble?

    LVP is off, the chip still works 100% except portb.7 (maybe portb.6 too, I don't have anything on that pin) I have an LED on portb.7, which works fine until I add the above code. The programmer is a PICFlash2. It does not recognize the chip at all, won't allow me to erase, read, write, etc... I really need to use the capture module, but I can't keep bricking these chips. Not sure how to proceed from here.

    Thanks!
    Shawn

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: 16F627A PortA.4 trouble?

    Hi,
    I think the pin stop working because you enable the oscillator for TMR1, the oscillator uses RB6 and RB7 so they can't then be used as I/O.

    I see you're using internal oscillator, are you using internal MCLR as well by any chance?

    Looking around there seems to be an issue with using internal oscillator and internal MCLR and initially setting PGD/PGC pins as outputs - or something like that. In that case the device apparently can't enter programming mode without the device programmer applying Vpp before Vdd which apparently not all device programmers can do - again, or something like that. See this for example.

    Not saying this IS the case in your case but it does "smell" like it to me.

    /Henrik.

  5. #5
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    158


    Did you find this post helpful? Yes | No

    Default Re: 16F627A PortA.4 trouble?

    I am using external MCLR pulled high with a 4k7 resistor. That does sound like what is happening, except I am not using the internal MCLR. I am also using an external VDD, and I didn't terminate a VDD pin on my ICSP connector.

    It is a surface mount chip, and I replaced it again.

    I plan to order an 18F1220 as that has the enhanced CCP module, which my code is already written to work with. I was just trying to cut costs, but it has been a headache. I need a pin compatible chip to the 16F627A since I already have the PCB's, assuming I don't get this working.
    Shawn

  6. #6
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default Re: 16F627A PortA.4 trouble?

    Clear T1CON.3. If your programmer won't allow you to reprogram them with this bit set, at least you shouldn't have the same problem with new ones. You only enable TMR1 osc if you're using an external oscillator.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  7. #7
    Join Date
    Dec 2007
    Location
    Finland
    Posts
    191


    Did you find this post helpful? Yes | No

    Default Re: 16F627A PortA.4 trouble?

    I didn't want to make a similar topic so therefore I'm including my findings here. I'm using 16F876A and also A.4 is causing some minor problems.

    Code part "Test" is working OK, so PortA.1-5 and PortB.1-5 switching on and off.
    Problem occurs with "Test2" on A.4. A.4 is always LOW, meaning that corresponding LED is always ON (other 9 LED's are OK).

    I have pull-up for A.4 (open drain) so, it should goes up as soon as it is set high, as it does with "Test" code.
    Any idea whats is wrong or how to fix it? At the moment I don't want to change make HW changes so SW is prefered

    Code:
    Mainloop:
        GOSUB Test
        GOSUB Test2
        GOTO Mainloop
    
    Test:
        PortA = %00000000
        PortB = %00000000
        PAUSE 500
        PortA = %00111110
        PortB = %00111110
        PAUSE 500
        RETURN
    
    Test2:
        LED = %11111111111
        GOSUB Select_LED
        PAUSE 500
        LED = %00000000000
        GOSUB Select_LED
        PAUSE 500
        RETURN
        
        
    Select_LED:
        LED = ~LED        'Invert for P-FET supply for LEDs
        PortB.1 = LED.4   'LED4      
        PortB.2 = LED.6   'LED6      
        PortB.3 = LED.8   'LED8     
        PortB.4 = LED.10  'LED10      
        PortB.5 = LED.2   'LED2          
        PortA.5 = LED.5   'LED5      
        PortA.4 = LED.7   'LED7  !!!!!!!!Open drain    
        PortA.3 = LED.9   'LED9      
        PortA.2 = LED.1   'LED1      
        PortA.1 = LED.3   'LED3      
        RETURN
    BR,
    -Gusse-

Members who have read this thread : 0

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