I don't see where you're clearing ANSEL. It powers up as all 1s. making=20 all pins that are analog capable into analog inputs. Kerry Clint Sharp wrote: > I've written a program for a 16F88 that is meant to control an RC servo=20 > with pulses in the range 1.0-2.0 mS. I simulated with MPSIM and=20 > stopwatch, it gives consistent and accurate timings, programming a chip=20 > gives the same results verified with a 'scope and PICKIT2 in logic=20 > analyser mode but as soon as the servo is connected, RB0 pulls high and=20 > stays there. > > Changing just the #define in my code to use RA1 (TRISA and TRISB are=20 > cleared) gives me a servo that centres reliably and I can see clean=20 > pulses with the 'scope. > > My question, what's different about RA0 and RB0, is it a code issue or=20 > an electrical issue? If I've made a simple mistake or oversight please=20 > put me right, I think I've gone code blind.. > > I've copied my init sub below, TRISA,0 is set in later code for ADC use=20 > but other than that nothing writes to the TRIS registers once the main=20 > loop is entered. > > INIT > BANKSEL OSCCON > MOVLW 0X72 ; 8MHz USE INT RC AS SYS CLK > IORWF OSCCON,F > BANKSEL PORTA > CLRF PORTA > CLRF PORTB > BANKSEL TRISB > CLRF TRISA > CLRF TRISB > BANKSEL PORTA > BCF INTCON,GIE ; DISABLE INTERRUPTS > CLRWDT > BANKSEL OPTION_REG ; ASSIGN PRESCALER TO TIMER 0 > MOVLW B'01010000' > ANDWF OPTION_REG,W ; WE END UP WITH 01010111 > IORLW B'00000111' ; RBPU=3D0,CLKO FOR TIMER0, PS TO=20 > TMR0 > MOVWF OPTION_REG ; 1:256 > BANKSEL TMR0 > MOVLW 0X64 ; LOAD TIMER 0 FOR 20MS INTERRUPTS > MOVWF TMR0 > BCF INTCON,TMR0IF ; CLEAR TIMER 0 INTERRUPT FLAG > MOVLW 0X04 ; INT CLOCK,1:1,OSC OFF,NO=20 > SYNC,STOPPED > MOVWF T1CON > CLRF PIR1 > BANKSEL PIE1 > BSF PIE1,TMR1IE > BANKSEL PORTA > =20 --=20 Internal Virus Database is out-of-date. Checked by AVG Anti-Virus. Version: 7.0.289 / Virus Database: 267.11.13 - Release Date: 10/6/05 --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .