I've tried to find something useful on the datasheet,tutorials and pic=20 books, i've tried to write it both in c and in assembler, you never know,= =20 but the problem is always there. I don't know if i can reasonably expect=20 someone to look at the code and do the thinking for me, but this is my last= =20 hope, so i will try. The code in the while(1) block should just send a=20 square wave to PORTA, but i put a while(B0!=3D1); before it. What i think it shoul= d=20 do is, it stays still until i press the button (putting a 1 on the first bi= t=20 of PORTB) and then start to play the squarewave, forgetting about the=20 button. Well, i put it on the breadboard and i found that actually it plays= =20 the wave only as long as i keep the button pushed down. If i let a 0 on=20 PORTB it stops again, waiting for a new 1. So somehow it goes back to the= =20 first while, how's that? :-/ ps. i know the code is useless and weird, it was a starting point to develo= p=20 what i wanted to be my first pic project, but then i got blocked on my firs= t=20 steps by this thing. #define __16f628 #include typedef unsigned int config; config at 0x2007 __CONFIG =3D _HS_OSC & _WDT_OFF & _PWRTE_ON ; BIT_AT(PORTB_ADDR,0) B0; void delay(void); unsigned char a,d1; void main(void){ CMCON=3D7; TRISA=3D0; TRISB=3D255; a=3D150; PORTA=3D0; while(B0!=3D1); while(1){ PORTA=3D1; delay(); PORTA=3D255; delay(); } } void delay(void){ _asm movlw _a movwf _d1 Delay_0: decfsz _d1, f goto Delay_0 nop nop _endasm; } -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist