Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
12F675
Vdd
No connection
No connection
No connection
GP2 LED 2
GP1 LED 1
AN0 (voltage in)
Vss
XTAL = 4
' Set data code protection, code protection, brown out detection, watchdog timer
, and mclr function OFF;
' power-up timer ON; and oscillator to internal.
Config CPD_OFF, CP_OFF, BODEN_OFF, WDT_OFF, MCLRE_OFF, PWRTE_ON, INTRC_OSC_NOCL
KOUT
Dim ADC_Val As ADRESL.Word ' Combine ADRESL and ADRESH registers into a word va
riable
Dim i As Byte
' For/Next loop counter
Symbol LED1 = GPIO.1
Symbol LED2 = GPIO.2
DelayMS 500
High LED2
DelayMS 250
Low LED2
Next i
While 1 = 1
GoSub GET_ADC
If ADC_Val < 256 Then
High LED2
Else
Low LED2
EndIf
If ADC_Val < 512 Then
High LED1
Else
Low LED1
EndIf
DelayMS 500
Wend
'50% of Vdd
http://www.rcgroups.com/forums/showthread.php?t=639405&page=4