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

    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

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

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

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

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