Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/21/06 06:31
Read: times


 
#116771 - Try this
Responding to: ???'s previous message
Try this, It is not very accurate, but it works.
And it is cheap.
To get another range change C1.
Have a nice day.
Robert.
   + 5V
   |
   |
   |          
   / R1      100k
   /<--+ LDR 
   /   |     
   /   |     
   +---+-------> I/O PORT 
   |
   =   C1: 100 nF
   |
   |
   + GND	 

; ***************************************
; * Get the pot value
; ***************************************

LDR       BIT   P3.3
LICHT     DATA  5Eh

GETLIGHT: CLR   LDR       ; Discharge capacitor
          MOV   A,#100    ; Wait until empty
WACHT:    DJNZ  ACC,WACHT ; A is zero
	  SETB  LDR	  ; C starts loading 
  	  
LDR10:	  JB    LDR,LDR20 ; It is high 
 	  INC   A         ; Count the time it takes  
	  JNZ   LDR10     ; to get high, Overflow   
	  DEC   A	  ; result is 255
 
LDR20:	  MOV   LICHT,A   ; Save value
	  RET




List of 14 messages in thread
TopicAuthorDate
without adc            01/01/70 00:00      
   ???            01/01/70 00:00      
      Yes, sort off            01/01/70 00:00      
         slow inputs            01/01/70 00:00      
            low cast (low speed ) ADC IC            01/01/70 00:00      
               Low cost ADCs            01/01/70 00:00      
      addjusting color also is posible whith .            01/01/70 00:00      
         Just how cheap do you have to be?            01/01/70 00:00      
            Specification!            01/01/70 00:00      
         blinkers            01/01/70 00:00      
   Try this            01/01/70 00:00      
      Thank you very much robert!!!!!            01/01/70 00:00      
         a hint            01/01/70 00:00      
      Beware!            01/01/70 00:00      

Back to Subject List