RA3 won't get a high level.


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    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.

  2. #2
    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

  3. #3
    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.

  4. #4
    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.

  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 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 ?

  6. #6
    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?

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    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, 20:08
  2. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15: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, 17:01
  4. sample code for M25P32
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th January 2007, 02:37
  5. Serin and TMR0
    By capitano in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 17th May 2006, 14:58

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