In SX Microcontrollers, SX/B Compiler and SX-Key Tool, PJ Allen wrote: [b][/b] [b]OK[/b] -- It works: [code] DEVICE sx28, oschs3, TURBO, STACKX, OPTIONX IRC_CAL IRC_SLOW FREQ 10_000_000 PROGRAM Start a VAR Byte blink VAR Byte start: TRIS_A = %00000001 'RA.0 analogin's input 'RA.1 analogin's output 'RA.2 Result Indicator YEL 'RA.3 Acquisition annunciator GRN LVL_A = %00000001 Testing: a = 0 RA.2 = 0 RA.3 = 0 ANALOGIN RA.0, RA.1, a, 1 IF a > 150 THEN Good 'Threshold appx 2.9V ? Back: RA.3 = 1 'indicates acquisition PAUSE 2000 FOR Blink = 0 TO 9 'Blink ACQ before re-testing RA.3 = 0 PAUSE 100 RA.3 = 1 PAUSE 100 NEXT Blink GOTO Testing Good: RA.2 = 1 GOTO Back Looks like I cannot IF...THEN...GOSUB (?), so I made the "Back" subroutine. The threshold looks to be approx. 1.2V. I think that's because with my 10MHz clock I should probably have used a smaller value CAP. The "manual" states that the optimal value will be found with experimentation (so, experiment.) I made a video, but [i]youtube[/i] is slag cow today. If I can get it U/L'd later (>15 min. and it never finalized) I'll P-M you and post here same. I've broken practically every "style" rule, but it's documented well, in my opinion, and it's so short that one should be able to follow along anyway. If you leave the input floating then the result LED will be unreliable.[/code] ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m245970 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)