{"id":57,"date":"2004-05-24T07:15:09","date_gmt":"2004-05-24T12:15:09","guid":{"rendered":"http:\/\/www.tigoe.com\/pcomp\/code2\/category\/picbasic-pro\/57"},"modified":"2007-08-07T22:27:37","modified_gmt":"2007-08-08T03:27:37","slug":"adc-in","status":"publish","type":"post","link":"https:\/\/www.tigoe.com\/pcomp\/code\/picbasic-pro\/57\/","title":{"rendered":"ADC In"},"content":{"rendered":"<p>This example reads an analog input on PORTA.0 and sends its value out serially on PORTC.6<br \/>\n<!--more--><\/p>\n<pre>\n\n' 10-bit A\/D conversion \n' Connect analog input to channel-0 (RA0)\n\n' Define ADCIN parameters\n' Set number of bits in result\nDEFINE  ADC_BITS        10 \n' Set clock source (3=rc)\nDEFINE  ADC_CLOCK       3   \n' Set sampling time in microseconds\nDEFINE  ADC_SAMPLEUS    10        \n\nadcVar  VAR WORD ' Create variable to store result\n\n' Set PORTA to all input\nTRISA = %11111111     \n\n' Set up ADCON1\nADCON1 = %10000010      \n\nPause 500               ' Wait .5 second\n\nmain:     \n  ADCIN 0, adcVar ' Read channel 0\n  SEROUT2 PORTC.6, 16468, [DEC adcVar, 10, 13]\n\n  Pause 10               ' Wait.01 second\nGoTo main            \n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This example reads an analog input on PORTA.0 and sends its value out serially on PORTC.6<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-57","post","type-post","status-publish","format-standard","hentry","category-picbasic-pro"],"_links":{"self":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts\/57","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/comments?post=57"}],"version-history":[{"count":0,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts\/57\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/media?parent=57"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/categories?post=57"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/tags?post=57"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}