Follow along with the video below to see how to install our site as a web app on your home screen.
Nota: This feature may not be available in some browsers.
[SIZE=2][COLOR=#000080][I][SIZE=2][COLOR=#000080]'* Name : ANALOOG. [/COLOR][/SIZE][/I]
[I][SIZE=2][COLOR=#000080]'* Author : H.van.Zwieten. [/COLOR][/SIZE][/I]
[I][SIZE=2][COLOR=#000080]'* Notice : Copyright (c) 2008 H.v.Z. [/COLOR][/SIZE][/I]
[I][SIZE=2][COLOR=#000080]'* : All Rights Reserved [/COLOR][/SIZE][/I]
[I][SIZE=2][COLOR=#000080]'* Date : 24-12-2008 [/COLOR][/SIZE][/I]
[I][SIZE=2][COLOR=#000080]'* Version : 1.0 [/COLOR][/SIZE][/I]
[I][SIZE=2][COLOR=#000080]'* Notes : Voorbeeld afvragen analoge ingang. [/COLOR][/SIZE][/I]
[/COLOR][/SIZE][B][SIZE=2]Device [/SIZE][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]12F675 [/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080][I]; processor type[/I][/COLOR][/SIZE]
[/COLOR][/SIZE][B][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]XTAL [/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]10 [/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; crystal 10 Mhz[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[B][SIZE=2]Config [/SIZE][/B][SIZE=2]WDT_OFF,_ [/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; WatchDog Timer uit[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[SIZE=2]PWRTE_ON,_ [/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; Power-up Timer Enable aan[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[SIZE=2]MCLRE_OFF,_ [/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; Externe Master Reset Enable uit[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[SIZE=2]HS_OSC [/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; X-tal groter dan 4MHz[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[SIZE=2][COLOR=#000080][I][SIZE=2][COLOR=#000080];INTRC_OSC_NOCLKOUT ; Interne oscilator aan[/COLOR][/SIZE][/I]
[/COLOR][/SIZE][B][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]ALL_DIGITAL [/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]true [/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; alle poorten digitaal[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[B][SIZE=2]Symbol On [/SIZE][/B][SIZE=2]= 1 [/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; 1 is hoog[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[B][SIZE=2]Symbol [/SIZE][/B][SIZE=2]off = 0 [/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; 0 is laag[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[B][SIZE=2]Symbol [/SIZE][/B][SIZE=2]potmeter = [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]GPIO[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].0 [/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; potmeter aan poort 0[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[B][SIZE=2]Symbol [/SIZE][/B][SIZE=2]led_1 = [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]GPIO[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].1 [/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; led aan poort 1[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[B][SIZE=2]Declare [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]ADIN_RES [/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]= 8 [/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; resolutie 8 bits [/COLOR][/SIZE][/COLOR][/SIZE][/I]
[B][SIZE=2]Declare [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]ADIN_TAD [/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]= frc [/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; Set rc osc [/COLOR][/SIZE][/COLOR][/SIZE][/I]
[B][SIZE=2]Declare [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]ADIN_STIME [/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]= 50 [/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; sample tijd 5 [/COLOR][/SIZE][/COLOR][/SIZE][/I]
[B][SIZE=2]Dim [/SIZE][/B][SIZE=2]waarde [B]As Byte [/B][/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; variabele waarde potmeter[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[B][SIZE=2]Clear [/SIZE][/B][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; wis geheugen[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[B][SIZE=2]DelayMS [/SIZE][/B][SIZE=2]2000 [/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; stabilisering[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[SIZE=2][COLOR=#000080][I][SIZE=2][COLOR=#000080];543210 ; hulpregel[/COLOR][/SIZE][/I]
[/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]TRISIO [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]= %000001 [/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; poort 0 als ingang[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[SIZE=2][COLOR=#000080][I][SIZE=2][COLOR=#000080]; poort 1 T/M 5 als uitgang[/COLOR][/SIZE][/I]
[/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]ADCON0 [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]= %000001 [/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; analoge ingang 0 [/COLOR][/SIZE][/COLOR][/SIZE][/I]
[SIZE=2]run: [/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; begin programma[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[SIZE=2]waarde = [B]ADIn [/B]0 [/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; analoog naar variabele waarde[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[B][SIZE=2]If [/SIZE][/B][SIZE=2]waarde > 127 [B]Then [/B][/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; als waar dan[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[SIZE=2]led_1 = [B]On [/B][/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; led 1 is aan[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[B][SIZE=2]Else [/SIZE][/B][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; anders[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[SIZE=2]led_1 = off [/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; led 1 is uit[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[B][SIZE=2]EndIf [/SIZE][/B][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; einde als[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[B][SIZE=2]GoTo [/SIZE][/B][SIZE=2]run [/SIZE][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; naar begin programma[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[B][SIZE=2]End [/SIZE][/B][I][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]; einde programma[/COLOR][/SIZE][/COLOR][/SIZE][/I]
[SIZE=2][COLOR=#000080][I][SIZE=2][COLOR=#000080]; Ik hoop dat het zo een beetje duidelijk is Marten.[/COLOR][/SIZE][/I]
[I][SIZE=2][COLOR=#000080]; En anders hoor ik het wel.[/COLOR][/SIZE][/I]
[/COLOR][/SIZE]
Hier heb je een stukje code voorbeeld voor het afvragen van een analoge ingang.