
Originally Posted by
T.Jackson
As pointed out earlier, RCTIME is a digital function not analog. So you'll need to enable the port in digital mode. Your code gears the port up in analog mode. BS2 is an unpopular joke in my opinion.
Alright Thankyou for your help i now got it to work. For other newbs who would prefer not make a fool of themselves. The working code is below.
Thanks again. it now results in different things depending on the light. ^^
Code:
'---clock settings
define OSC 8
OSCCON = %1111110 ' sets internal osc to run at 8MHZ
'----------turn analog on porta off, and use as digital input/output
CMCON = 7 'Comparators off
ANSEL = 0 'A/D off -- Port pins all digital
'----------^^^^^^^^^^
'----------the change is in this block of code
'---** Constants
rcpin var porta.3
'---**variables
rcreturn var byte
'------**main program
loop:
'----its rctime!
pause 1000
high rcpin
pause 5
rctime rcpin,1,rcreturn
low rcpin
'----(end rctime) shows over folks ^^
'----send serial feedback
serout2 porta.0, 16468, ["rc time was: ",dec rcreturn] 'call for data
'-----end serial feedback
goto loop 'loop forever
end
Bookmarks