In SX Microcontrollers, SX/B Compiler and SX-Key Tool, djh82uk wrote: HMM, ive got it testing 2 voltages and it works, but if I drop the coltage on the RB test it's fine, re-apply power and it goes back to testing, but if I drop the voltage on the RC test then it does not update the value and stays in the lower voltage mode, although the relay does click on and off. Any ideas? DEVICE SX48, OSC4MHZ FREQ 4_000_000 PROGRAM Start 'NOSTARTUP a VAR Byte b VAR Byte blink VAR Byte start: TRIS_A = %00000000 TRIS_B = %00000001 TRIS_C = %00000001 'RC.0 analogin's input 'RC.1 analogin's output 'RA.2 Result Indicator YEL 'RA.3 Acquisition annunciator GRN LVL_C = %00000001 LVL_C = %00000001 Testing: 'a = 0 RA.1 = 0 RA.2 = 0 RA.3 = 0 RB.3 = 0 RB.4 = 0 ANALOGIN RC.0, RC.1, a, 2 'pause 1000 ANALOGIN RB.5, RB.6, b, 2 watch a watch b IF a < 190 THEN Charge1 IF b < 190 THEN Charge2 'Threshold appx 2.9V ? Back: RA.1 = 0 RA.3 = 1 RB.3 = 1 'indicates acquisition PAUSE 2000 FOR Blink = 0 TO 9 'Blink ACQ before re-testing RA.3 = 0 RB.3 = 0 PAUSE 100 RA.3 = 1 RB.3 = 1 PAUSE 100 NEXT Blink GOTO Testing Charge1: RA.2 = 1 RA.1 = 1 RB.3 = 1 pause 5000 IF b < 190 THEN Charge2 GOTO Testing Charge2: RA.3 = 1 RB.4 = 1 Pause 5000 GOTO Testing ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=2&m=244365#m246340 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)