Hi Josef, >after about 2 days of debugging I cannot find any more bugs, but the device >is not working yet. Finally I turned it into a LED blinking circuit, but it >looks, that the pins do not even change to outputs. Have I done something >stupid or should I search the hardware? The config equals 0xffa - MCLR >enabled, no CP, no WDT, internal RC oscillator, and yes, I checked the MCLR >voltage, it is +5V. This is my first project using 12C509, so I may be >overlooking something really trivial. The listing (line numbers deleted) >follows. TIA, and if possible, include cc to snail@iol.cz, so that don't >have to wait for the digest. Have you simulated your code? How do you know that the pins aren't changing to outputs? I'm asking these questions because I can see a very big problem in the code... You have the delay loop: L0: DECFSZ CNT0,F GOTO L0 DECFSZ CNT0,F GOTO L0 Which will never be exited. I think you want to have the code: L0: DECFSZ CNT0,F GOTO L0 DECFSZ CNT1,F <-- Note the Change GOTO L0 Which will delay about a fifth of a second (running at 4 MHz). In your code, after the first "DECFSZ CNTO,F" loop exits (ie "CNT0" will be equal to zero), the next "DECFSZ CNT0,F" instruction will change it to 0x0FF, jump back to "LO" and you will decrement CNT0 to Zero, decrement it again to 0x0FF, and so on forever, never leaving the loop. It is especially important for your first programs to simulate them until you are absolutely sure they work properly. When you said the program isn't running, how do you know that? If you're checking them with a DMM, you might be seeing 0 Volts, which doesn't tell you anything. Invest in a logic anayzer ($20 here in Canada) and check them - Radio Shack actually has a decent one for this price. You should see that they're set either high or low (and not high impedance which has neither light on). Good luck, myke >LOC OBJECT CODE SOURCE TEXT > VALUE > LIST P=12C509,R=DEC > INCLUDE > > INCLUDE > > INCLUDE > LIST > > CBLOCK __GPRAM > 00000007 CNT0, CNT1 > ENDC > > 000F4240 CLOCK: EQU D'1000000' > 00000960 BAUD: EQU D'2400' > >0000 ORG 0 >0000 0C00 MOVLW B'00000000' >0001 0006 TRIS GPIO >0002 02E7 L0: DECFSZ CNT0,F >0003 0A02 GOTO L0 >0004 02E7 DECFSZ CNT0,F >0005 0A02 GOTO L0 >0006 0CFF MOVLW 0XFF >0007 01A6 XORWF GPIO,F >0008 0A02 GOTO L0 > >03FF ORG 0X3FF >Warning[220]: Address exceeds maximum range for this processor. >03FF 0C70 MOVLW 0X70 > END > > Check out the "Handbook of Microcontrollers" as a reference for embedded microcontrollers including information on the Intel 8051, Motorola 68HC05, Microchip PICMicro, Atmel AVR and Parallax Basic Stamp: http://www.myke.com/#MCUHand Hunter S. Thompson's quest for the American Dream, this week in the Book Room. http://www.myke.com/Book_Room/book1a.htm