Rikard, Did you clear the ANSEL register? All the A/D pins default to analog mode on reset. Bill Rikard Bosnjakovic wrote: >I've built a small cable-tester. In a loop, I have these lines: > > movlw b'00000001' ; run cable test on GP0 > movwf GPIO > call delay_500ms > > movlw b'00000010' ; run cable test on GP1 > movwf GPIO > call delay_500ms > > movlw b'00000100' ; run cable test on GP2 > movwf GPIO > call delay_500ms > > movlw b'00010000' ; run cable test on GP4 > movwf GPIO > call delay_500ms > > movlw b'00100000' ; run cable test on GP5 > movwf GPIO > call delay_500ms > >Each of the corresponding GPs are connected to an LED and an >(external) AND-gate. The problem is, none of the LEDs are being lit >when using the above code. > >Even more weird, if I insert this piece of test-code (light all LEDs): > > movlw -1 > movwf GPIO > call delay_500ms > clrf GPIO > call delay_500ms > >between the GP0/GP1 tests above, all LEDs are being lit. >Step-debugging in MPLAB and watching the GPIO, I clearly see >"00000001", "00000010" etc in GPIO for the various tests, but none of >them are being lit. > >I also tried this: > > movlw b'11111100' > movwf GPIO > call delay_500ms > >Then the LEDs are instantly flashing (for like 0.1 ms, just barely >noticeable) before turned off. > >I've been scratching my head for a couple of hours now, >double-checking the datasheets but I just can't see what's wrong. It >works for all the LEDs at the same time, but not one at a time. > >Can anyone explain what's happening? Could it be a RMW-problem? I >can't think of anything right now. > > > > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist