Dear readers,
I have attached a RC connection to a Microchip's pin.
Pin ---- 0 to 40 kOhms ---- 100 nF ---- GND
1. Make Pin high
2. Let wait for 20 ms
3. Set pin to high-impedance
4. I let wait, till pin Low becomes low - counting while doing so
Depending on R value it is faster/lasts longer to make pin Low.
I make the value of R be constant and do several measurements. The result is visualized for me.
What can I infer from these values ?
Code:W1: ADCWert = 0 ;I TRISA.3 = 0 PORTA.3 = 1 Pause 3 ;PORTA.3 = 0 ;II TRISA.3 = 1 WHILE PORTA.3 = 1 ADCWert = ADCWert + 1 WEND TRISA.3 = 0 ;III PORTA.3 = 0 Pause 18 W2: ADCWert = 0 Low PORTA.3 ; Discharge cap to start Pause 10 ; Discharge for 10ms RCTIME PORTA.3,0,ADCWert ; Read potentiometer on Pin3 W3: ADCWert = 0 ;I TRISA.3 = 0 PORTA.3 = 1 Pause 3 ;PORTA.3 = 0 ;II TRISA.3 = 1 WHILE PORTA.3 = 1 ADCWert = ADCWert + 1 TRISA.3 = 0 PORTA.3 = 0 TRISA.3 = 1 WEND TRISA.3 = 0 ;III PORTA.3 = 0 Pause 18 W4: ADCWert = 0 ;I TRISA.3 = 0 PORTA.3 = 1 Pause 3 ;PORTA.3 = 0 ;II TRISA.3 = 1 RCTIME PORTA.3,1,ADCWert TRISA.3 = 0 ;III PORTA.3 = 0 Pause 18




Bookmarks