Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Define SIMULATION_WAITMS_VALUE = 1
AllDigital
Dim an0 As Word
Dim an1 As Word
ANSEL = 0x03
ADCON0 = 0x85
loop:
Adcin 0, an0
Adcin 1, an1
Goto loop
End
Thanks Ian,Have you enough pins?... If you set the ANSEL reg up you can just call ADCIN channel, variable
ADCIN 0,adcres1
ADCIN 1,adcres2
ADCIN 2,adcres3
This will run in Oshon
Code:Define SIMULATION_WAITMS_VALUE = 1 AllDigital Dim an0 As Word Dim an1 As Word ANSEL = 0x03 ADCON0 = 0x85 loop: Adcin 0, an0 Adcin 1, an1 Goto loop End
You will find this external module useful for Analog, its named 16F, but it will run on 12F
https://www.electro-tech-online.com/blog-entries/oshonsoft-simulator-16fanalog3-external-module.113/
This second module has more options.
https://www.electro-tech-online.com...-simulator-16fanalogramp3-external-modul.115/
Kinda... But the control on the little pic12's is in the ANSEL reg not the adcon0 regSo, I'm guessing that the later orders over ride the earlier ones?
Thanks Ian.
Thanks Eric,
This works fine.
Can you tell me why you have 'ALLDIGITAL' early in the code, when it has analogue pins?
Cheers, Camerart.
Thanks Both,hi,
Its a 'leftover' from a program, I cut n pasted the snippet which I posted for you... ignore it.
E
Dim an0 As Word
Dim an1 As Word
Dim gled As Bit
Dim t As Word
''Symbol gled = GP2
'If an0 >= 100 Then
gled = 1
WaitMs 10
'Else
gled = 0
WaitMs 10
'Endif
hi Camerart,
I would suggest that you tidy up your header layout on the program, there are 'bits' everywhere, makes it hard to follow.
Eric
hi Camerart,
I would suggest that you tidy up your header layout on the program, there are 'bits' everywhere, makes it hard to follow.
Eric
hi Camerart,
I would suggest that you tidy up your header layout on the program, there are 'bits' everywhere, makes it hard to follow.
Eric
Hi Eric,hi Camerart,
Look at Pauls code for a way to layout the Header
https://www.electro-tech-online.com/threads/rotary-encoder.139838/
Eric