In SX Microcontrollers, SX/B Compiler and SX-Key Tool, g_daubach wrote: Kevin, in the schematic I have suggested, decoupling is done by the resistor in series with the audio signal, and not with the diode. Using the comparator is pretty easy: ; Configuring the comparator mode $08 ; access CMP_B mov w, #%01000000 mov !rb, w ;enable comparator, do not enable comp. output at rb.0 ; Insert a delay to allow comparator to respond ; Reading the comparator (same as above) mode $08 ; access CMP_B mov w, #%01000000 mov !rb, w ;enable comparator, do not enable comp. output at rb.0, and copy comp. result into w ; When bit 0 in w is set (w = 1), the voltage at rb.2 is greater than the voltage at rb.1 When you don't neet port pin rb.0 for other purposes, you could enable the comparator output (write %00000000 to !rb instead of %01000000). You then can directly check the state of rb.0 for the current comparator result, i.e. you don't need to execute the second mode $08 ; access CMP_B mov w, #%01000000 mov !rb, w ;enable comparator, do not enable comp. output at rb.0, and copy comp. result into w in a loop for reading the result. Assuming the potentiometer is set correctly, the comparator status would be 1 for no audio, and 0 for audio. You can always exchange the rb.1 and rb.2 pins if you like an inverted result, i.e. 1 for audio, and 0 for no audio. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=149297#m150012 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)