RA3 won't get a high level.


Closed Thread
Results 1 to 15 of 15
  1. #1
    Join Date
    Aug 2006
    Location
    In a world of german electrons
    Posts
    102

    Default RA3 won't get a high level.

    Hello, I'll put it short:

    -PIC 16F628A
    -Vdd is 5.04 Volts
    -Quarz is available
    -PORTB can give a high level.

    Problem:
    -RA3 doesn't get a high level.

    Done so far:
    Code:
    -
    Start:
    	CMCON.0 = 1
    	CMCON.1 = 1
    	CMCON.2 = 1
    
               Pause 5000
    -	Trisa.3 = 0
    	High Porta.3
    	Pause 5000
    	Low Porta.3
               GOTO Start
    -Ideas ?

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    All fine here... Depending your osc and config fuses setting it may work or not.

    Make sure you're using a 20Mhz Crystal (and a PIC16F628-20), MCLR pin set to Vdd, and try that one and post your results
    Code:
            @ __CONFIG  _HS_OSC & _MCLRE_ON  &  _LVP_OFF & _WDT_OFF & _PWRTE_ON  & _BODEN_ON  
            DEFINE OSC 20
            PORTA=0        
            TRISA=0
            CMCON=7
    
    Start:  TOGGLE PORTA.3
            PAUSE 500
            GOTO START
    Last edited by mister_e; - 5th February 2007 at 21:22.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Aug 2006
    Location
    In a world of german electrons
    Posts
    102


    Did you find this post helpful? Yes | No

    Default

    In MPLAB having @ __CONFIG _HS_OSC & _MCLRE_ON & _LVP_OFF & _WDT_OFF & _PWRTE_ON & _BODEN_ON included.
    Code:
    Error[118]   C:\PIC\XYZ.ASM 106 : Overwriting previous address contents (2007)
    Error[118]   C:\PIC\XYZ.ASM 106 : Overwriting previous address contents (2007)
    Loaded C:\PIC\XYZ.COD.
    BUILD SUCCEEDED: Mon Feb 05 21:24:52 2007
    Having it removed, it compiles. I changed the conf.bits via menu according to your idea.

    What happens(RA3):
    Moment of Low: 0V
    Moment of High: 0,71V

    Other PINS
    Moment of Low: 0V
    Moment of High: 5V
    Last edited by selbstdual; - 5th February 2007 at 21:38.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Seems you didn't have a look to the thread i suggested, but anyways...

    RA.3 is a full CMOS output type, so unless
    1. you have this pin shorted to gnd
    2. this i/o is blow

    it have to work. Try with another PIC.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Aug 2006
    Location
    In a world of german electrons
    Posts
    102


    Did you find this post helpful? Yes | No

    Default

    I used another one and the same result.

    This pin is not connected yet so outer components don't interfere.

    Here's the whole code. It is a POT command replacement that fits to my circuit (RC = 420 µs). Normally Wert is replaced by Wert2's contents.

    If you are not german, you should understand it anyway(Wert means value, Zaehler = counter, Gelb = yellow and Gruen = green)...

    Code:
    Define OSC 8
    
    Variablen:
    PORTA=0        
            TRISA=0
            CMCON=7
    	TRISB = 0
    	PORTA = 0
    	;VRCON = $20
    
    
    	Gruene_LED VAR PORTB.5
    	Gelbe_LED VAR PORTB.4
    
    
    	ADCWert VAR WORD
    	Erster_Wert VAR WORD
    	Zweiter_Wert VAR WORD
    	Zaehler VAR WORD
    	Zahl VAR BYTE
    
    		;Interrupts
    		INTCON = 0
    Start:
    Zahl = 0
    FOR Zahl = 1 TO 4
    	High Gelbe_LED
    		Pause 167
    	Low Gelbe_LED
    		Pause 307
    NEXT Zahl
    GOSUB Wert
    	Erster_Wert = ADCWert
    	WRITE 0, Erster_Wert.BYTE0
    	WRITE 1, Erster_Wert.BYTE1
    
    Pause 2931
    
    Zahl = 0
    FOR Zahl = 1 TO 4
    	High Gruene_LED
    		Pause 167
    	Low Gruene_LED
    		Pause 307
    NEXT Zahl
    GOSUB Wert
    	Zweiter_Wert = ADCWert	
    	WRITE 2, Zweiter_Wert.BYTE0
    	WRITE 3, Zweiter_Wert.BYTE1
    
    Pause 2791
    
    IF Erster_Wert = Zweiter_Wert THEN
    	High Gelbe_LED
    	Pause 3140
    	Low Gelbe_LED
    	Pause 2010
    ENDIF
    
    IF Erster_Wert <> Zweiter_Wert THEN
    	High Gruene_LED
    	Pause 3140
    	Low Gruene_LED
    	Pause 2010
    ENDIF
    
    	GOTO Start
    
    Wert:
    	HIGH PORTA.3
            PAUSE 5000
    	LOW PORTA.3
    	RETURN
    
    Wert2:
    	ADCWert = 0
    	Trisa.3 = 0
    	High Porta.3
    
    	Pause 243
    	
    	Trisa.3 = 1			;Vertrauscht
    	WHILE Porta.3 = 1
    		ADCWert = ADCWert + 1
    	WEND
    	Zaehler = 600 - ( (600 / 1200) * ADCWert)
    	Pauseus Zaehler
    	RETURN
    END
    Which thread are you referring to ?
    Last edited by selbstdual; - 5th February 2007 at 22:44.

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    i didn't check the whole thing but i confirm that it blink PORTB.5 led, then turn on the LED on PORTA.3, then turn it off.

    Your PIC i/o is dead OR there's a bad contact.

    And i posted a link before in post #2 about the config fuses.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7
    Join Date
    Aug 2006
    Location
    In a world of german electrons
    Posts
    102


    Did you find this post helpful? Yes | No

    Default

    Good ideas.

    i didn't check the whole thing
    How can I support you in doing so ?

    Your PIC i/o is dead OR there's a bad contact.
    Having replaced the PIC I don't think so. I usually press it gently but firmly in the socket. Sometimes I even press when running.

    And i posted a link before in post #2 about the config fuses.
    Having read it fully, I will comment that. After my first impression it is just a summary of what fuses are possible. I think I am limited to the ones MPLAB offers ?! Additionally most settings are set to work in most cases so do you suggest focusing on something special for this issue ?

  8. #8
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    I think I am limited to the ones MPLAB offers ?
    Yes, you're limited to what's in the .INC file of your PIC.

    How can I support you in doing so ?
    Well if the simple TOGGLE PORTA.3 loop don't work, you have to fix it first. Trust me it's working here.

    Additionally most settings are set to work in most cases so do you suggest focusing on something special for this issue ?
    Well depending what you call most case.. but me, i use around 50 different PIC model and i have thousands PBP code examples, templates, projects and includes store in my computer. So... how on hearth can i remind what i'd set in all of them and how the hardware is set-up on board... I can't even predict what i'll do next time. This is why i always comment the default config fuses and set ALL of them in my code. One day if i have to modify it, i have only one place to check.

    Same rules apply to the other thousand code example on other microcontroller brands and other compiler i also use.
    Last edited by mister_e; - 5th February 2007 at 23:56.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  9. #9
    Join Date
    Aug 2006
    Location
    In a world of german electrons
    Posts
    102


    Did you find this post helpful? Yes | No

    Default

    Well if the simple TOGGLE PORTA.3 loop don't work, you have to fix it first. Trust me it's working here.
    I fixed it, now it works. Let's see if the other code works aswell.

    Tell me something: How can I be sure that a problem can be found in the externals ? There are so many switches in the chip - the manufacturer calls them features, I name them obstacles.

  10. #10
    Join Date
    Aug 2006
    Location
    In a world of german electrons
    Posts
    102


    Did you find this post helpful? Yes | No

    Default

    The other code doesn't work, because the capacitor doesn't discharge.

    I am using a WIMA MKS 4 0,01/250-N4 capacitor, I guess that means 10nF.

    The resistor is 40K.

    That should mean it takes 0,00004 seconds to charge and at a maximum the same to recharge due to - er - well-intended voltage levels.

    Then I am recharging it, while counting, but it doesn't stop. When short circuiting the capacitor it works, so the code is OK.

    Is this cap no 10nF - cap ?

    Is there anything to be changed in the code ?

    ADCWert = 0
    Trisa.3 = 0
    High Porta.3

    Pauseus 244


    Trisa.3 = 1
    High Gruene_LED
    WHILE Porta.3 = 1
    ADCWert = ADCWert + 1
    WEND
    Low Gruene_LED
    Zaehler = 600 - ( (600 / 1200) * ADCWert) ;to keep time even
    Pauseus Zaehler
    RETURN

  11. #11
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    maybe because your Pauseus 244 is way too high? try to remove it.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  12. #12
    Join Date
    Aug 2006
    Location
    In a world of german electrons
    Posts
    102


    Did you find this post helpful? Yes | No

    Default

    This is right. It should be 40.

    But.

    I found out that the circuitry itself acts as a huge capacitor compared to this one.

    I replaced it with 58 pF and threw away my calculations. Now it's time
    to experiment....

    I am using it ratiometrically but the same value doesn't seem to exist two times.

    Code:
    Wert:
    	ADCWert = 0
    	Trisa.3 = 0
    	High Porta.3
    
    	;Pauseus 800
    	
    	
    	Trisa.3 = 1			
    	WHILE Porta.3 = 1
    		ADCWert = ADCWert + 1
    	WEND
    	Trisa.3 = 0
    	Low Porta.3 ;To make UC = Vss
    	Pauseus 100 ;To make UC = Vss
    	RETURN
    Somehow the capacitor has to have time to charge, having a too high value for Pauseus doesn't affect the measurement, it makes sure that the cap is surely charged. But here I cannot know when it's surely charged, but this must be more than zero.

  13. #13
    Join Date
    Aug 2006
    Location
    In a world of german electrons
    Posts
    102


    Did you find this post helpful? Yes | No

    Default

    I did some testing. This is the result: Max = maximum value of the resistor, InB = In Between. Pause = Pause to load the cap.
    Code:
    		Max	InB	Min	Min	InB	Max
    Pause 3		46336	54273	16388	8965	48132	30980
    Pauseus 5	39433	54025	11274	64777	11529	27145
    It should be in the form of x² or -x². But both show strange behaviour.

    Do you have an idea ?

  14. #14
    Join Date
    Aug 2014
    Posts
    1


    Did you find this post helpful? Yes | No

    Default Re: RA3 won't get a high level.

    Quote Originally Posted by selbstdual View Post
    I fixed it, now it works. Let's see if the other code works aswell.

    how did you fix it? do you still remember?

  15. #15
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Default Re: RA3 won't get a high level.

    Quote Originally Posted by sotoshie View Post
    how did you fix it? do you still remember?
    Hummmmm,

    how to tell it ???
    Last Activity:- 8th May 2008 12:14.
    6 years after his last post ...
    ( and moreover ... I thought he had been banned !!! )

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. SERIN MIDI out of Synch?
    By jncortes in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 9th June 2009, 21:08
  2. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 16:23
  3. confused problem with interrupt in a working program
    By illuminator4 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 14th November 2008, 18:01
  4. sample code for M25P32
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th January 2007, 03:37
  5. Serin and TMR0
    By capitano in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 17th May 2006, 15:58

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