farrukhtalib
Junior Member level 3
Hi All
I wrote a code in proton BASIC for ADC but it is not working if some one may help am pasting my code here, and also I am pasting here the Image of proteus design which i made to check the code
https://obrazki.elektroda.pl/2646788600_1442644726.jpg
I wrote a code in proton BASIC for ADC but it is not working if some one may help am pasting my code here, and also I am pasting here the Image of proteus design which i made to check the code
https://obrazki.elektroda.pl/2646788600_1442644726.jpg
Code:
Device 16F819
XTAL 4
PORTB_PULLUPS true
LCD_INTERFACE 4
LCD_DTPIN PORTB.4
LCD_RSPIN PORTB.0
LCD_ENPIN PORTB.1
ADIN_RES 10 ' Set the resolution to 10
ADIN_TAD FRC ' Choose the RC osc for ADC samples
ADIN_STIME 100
ADCON0.3 = 0
ADCON0.4 = 0
ADCON0.5 = 0
Output LED
Dim x As Byte
Dim A As Word
Dim V As Word
x= 255
loop:
GoSub GET_VOLT
DelayMS 250
GoSub GET_VOLT1
GoTo loop
GET_VOLT:
A = ADIn 0
V = (5/1023)*V
Cls
Print At 1,1, Dec 4 A
Return
GET_VOLT1:
A = ADIn 1
V = (5/1023)*A
Print At 2,1, DEC3 V
Return
Last edited by a moderator: