Considering the amount of replies which I received to my previous questions, it would be unfair to not share what I have been working on. It is, in fact, just a simple robotics experiment. A robot which finds its way out of a maze. The switching question I asked was to switch a digital voice recording module @ approx. 6V. The 4066 worked great, thanx for the advice. Now for the bad news. I must once again enlist the services of you all in order to get this off my desk (and my mind!). Here are the questions... 1. The sensors which I have are modulated light sensors, ripped old video game guns, but have analog outputs. Is there any way to change this without implementing an A/D converter? If not, where can I get a digital version. 2. I'm assuming that servos would be easier to implement in this type of project than geared down motors, but this is only an assumption... 3. My code should be much shorter and neater than what it is. (Then again, I may have a future with Microsoft ;-) In fact, I'm not even sure if it will work. There must be a better way to do 'If..then' on a PIC. Actually, is there any way to use a look-up table on a PIC? Which would be better? The code follows. Any posted responses or web resource pointing would be greatly appreciated. Synergetix **WARNING: the following code is plain UGLY. Reader discretion is advised*** Here's the partial code with explanation ; robot program v1.1 ; robot navigates through maze ; PORTB: ; 0= Right motor - ; 1= Right motor + ; 2= Left motor - ; 3= Left motor + ; 4= Right sensor ; 5= Left sensor ; 6= Front sensor ; 7= Switch ; what 'main' should accomplish: ; if fsensor on, lsensor off, turn left ; if fsensor on, lsensor on, rsensor off, turn right ; if fsensor on, lsensor on, rsensor on, turn around ; if fsensor off, rsensor off, turn right ; if fsensor off, rsensor on, lsensor off, turn left ; if fsensor off, rsensor on, lsensor on, go forward ; in other words: ; F L R x ; 0 x 0 right ; 0 0 1 left ; 0 1 1 forward ; 1 0 x left ; 1 1 0 right ; 1 1 1 turn around ; INCLUDES AND JUNK processor 16f84 include __config _RC_OSC & _WDT_OFF & _PWRTE_ON ; VARIABLES J equ H'10' ; J = hex 10 K equ H'11' ; K = hex 11 SENSOR equ H'12' ; SENSOR = hex 12 ; MAIN org 0 ; start at beginning movlw B'01110000' ; set input (1) and output (0) tris PORTB ; set I/O ploop: nop ; program loop ; move forward movlw b'00001010' ; move to acc. (forward) movwf PORTB ; output call motdel ; motor delay time ; check sensors movf PORTB ; move port B to accumulator movwf SENSOR ; then move to memory btfsc SENSOR, 6 ; check for wall at front goto fwall ; if yes, go to fwall btfss SENSOR, 4 ; check for wall at right goto rgt ; if no, go right btfss SENSOR, 5 ; check for wall at left goto lft ; if no, go left goto ploop ; else go forward fwall: btfss SENSOR, 5 ; check for wall at left goto lft ; if no, go left btfss SENSOR, 4 ; check for wall at right goto rgt ; if no, go right goto rev ; else reverse ; turn motors left lft: movlw b'00000110' ; move to acc. movwf PORTB ; output call motdel ; motor delay time goto ploop ; turn motors right rgt: movlw b'00001001' ; move to acc. movwf PORTB ; output call motdel ; motor delay time goto ploop ; turn around rev: call lft ; turn 90 degrees call lft ; turn 90 degrees again goto ploop ; SUBPROCEDURES motdel movlw D'80' ; w := 80 decimal movwf J ; J := w jloop: movwf K ; K := w kloop: decfsz K,f ; K = K-1, skip next if zero goto kloop decfsz J,f ; J = J-1, skip next if zero goto jloop retlw 0 end