code multitools

1
$r egf i l e = " 8535def . dat " $cr yst al = 16000000 ' $baud = 9600 Conf i g Lcdpi n = Pi n , Db4 = Por t c. 4 , Db5 = Por t c. 5 , Db6 = Por t c. 6 , Db7 = Por t c. 7 , E = Por t c. 2 , Rs = Por t c. 0 Conf i g Lcd = 16 * 2 Cur sor Of f Cl s Conf i g Adc = Si ngl e , Pr escal er = Aut o , Ref er ence = Avcc St ar t Adc Conf i g Por t b = I nput Di m Pi l i h As I nt eger Di m Dat a_l m35 As Wor d , Dat a_l dr As Wor d Di m Suhu As Si ngl e , Suhu_st r i ng As St r i ng * 5 Di m Ldr As Si ngl e , Ldr _st r i ng As St r i ng * 5 Pr ogr am_ut ama: Pi l i h = 0 Por t b = 255 Upper l i ne : Lcd " MUL T I T OOL S " Lower l i ne : Lcd " FI SI KA - UGM " Do I f Pi nb. 0 = 0 Then Pi l i h = 1 ' Pr i nt " TERMOMETER MODE" Cl s End I f I f Pi nb. 1 = 0 Then Pi l i h = 2 ' Pr i nt " LUXMETER MODE" Cl s End I f Sel ect Case Pi l i h Case 1 Gosub Baca_suhu Upper l i ne : Lcd " TERMOMETER ( C) " Lower l i ne : Lcd Suhu ; " " ' Pr i nt Suhu Case 2 Gosub Baca_l dr Upper l i ne : Lcd " LUXMETER ( Cd) " Lower l i ne : Lcd Ldr ; " " ' Pr i nt Ldr End Sel ect Loop Baca_suhu: St ar t Adc Dat a_l m35 = Get adc( 0) St op Adc Suhu = Dat a_l m35 / 1024 Suhu = Suhu * 5 Suhu = Suhu / 0. 01 Suhu_st r i ng = Fusi ng( suhu , " #. ##" ) Ret ur n Baca_l dr : St ar t Adc Dat a_l dr = Get adc( 1) St op Adc Ldr = Dat a_l dr / 1024 Ldr_string = Fusing(ldr , "#.##" ) Ret ur n

Upload: amex-ayimi

Post on 16-Jan-2016

5 views

Category:

Documents


0 download

DESCRIPTION

Multi Tools programming https://www.google.co.id/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CBsQFjAA&url=http%3A%2F%2Fetd.ugm.ac.id%2Findex.php%3Fmod%3Ddownload%26sub%3DDownloadFile%26act%3Dview%26typ%3Dhtml%26file%3D321599.pdf%26ftyp%3Dpotongan%26tahun%3D2013%26potongan%3DS2-2013-321599-tableofcontent.pdf&ei=6DMeVcfKH5DguQTQs4CgCw&usg=AFQjCNERZu03n8smKYZdPVKWABUCB6qh1Q&sig2=8YANGpnrlGXSNRTCiWZITQ

TRANSCRIPT

Page 1: Code MultiTools

$ r e g f i l e = " 8 5 3 5 d e f . d a t "$ c r y s t a l = 1 6 0 0 0 0 0 0' $ b a u d = 9 6 0 0

Co n f i g L c d p i n = Pi n , Db 4 = Po r t c . 4 , Db 5 = Po r t c . 5 , Db 6 = Po r t c . 6 , Db 7 = Po r t c . 7 , E = Po r t c . 2 , Rs = Po r t c . 0Co n f i g L c d = 1 6 * 2Cu r s o r Of fCl sCo n f i g Ad c = Si n g l e , Pr e s c a l e r = Au t o , Re f e r e n c e = Av c cSt a r t Ad c

Co n f i g Po r t b = I n p u t

Di m Pi l i h As I n t e g e rDi m Da t a _ l m3 5 As Wo r d , Da t a _ l d r As Wo r dDi m Su h u As Si n g l e , Su h u _ s t r i n g As St r i n g * 5Di m L d r As Si n g l e , L d r _ s t r i n g As St r i n g * 5

Pr o g r a m_ u t a ma :Pi l i h = 0Po r t b = 2 5 5

Up p e r l i n e : L c d " MUL TI TOOL S "L o we r l i n e : L c d " F I SI KA - UGM "

DoI f Pi n b . 0 = 0 Th e nPi l i h = 1' Pr i n t " TERMOMETER MODE"Cl sEn d I f

I f Pi n b . 1 = 0 Th e nPi l i h = 2' Pr i n t " L UXMETER MODE"Cl sEn d I f

Se l e c t Ca s e Pi l i hCa s e 1Go s u b Ba c a _ s u h uUp p e r l i n e : L c d " TERMOMETER ( C) "L o we r l i n e : L c d Su h u ; " "' Pr i n t Su h uCa s e 2Go s u b Ba c a _ l d rUp p e r l i n e : L c d " L UXMETER ( Cd ) "L o we r l i n e : L c d L d r ; " "' Pr i n t L d rEn d Se l e c t

L o o p

Ba c a _ s u h u :St a r t Ad cDa t a _ l m3 5 = Ge t a d c ( 0 )St o p Ad c

Su h u = Da t a _ l m3 5 / 1 0 2 4Su h u = Su h u * 5Su h u = Su h u / 0 . 0 1Su h u _ s t r i n g = Fu s i n g ( s u h u , " # . # # " )Re t u r n

Ba c a _ l d r :St a r t Ad cDa t a _ l d r = Ge t a d c ( 1 )St o p Ad c

L d r = Da t a _ l d r / 1 0 2 4L d r _ s t r i n g = Fu s i n g ( l d r , " # . # # " )Re t u r n