> 2nd. Your system is being resetted, first lets see if that's right, then we > figure out why. Try the following: > > Right on top of main, but once you have configured all ports, put something > like: > > Bsf portpin > Delay1sec > Bcf portpin > > And hook up an LED to that pin so you'll see that secuence everytime your > system starts. AS you know, you should only see that one time when you turn > on the system. Well, it turns out watchdog was not the only source of resets. I cannot find where the rest is coming from, though. Below is the minimum code that reproduces the problem (basically I poll RCREG until I get something, then toggle the state of a led). I *guess* a reset is what's happening because, if all went well, the led should be turned on by sending one byte to the serial, then turned off with another byte, and so on. Instead, it only flashes briefly whenever a byte arrives. Can anyone point me in the right direction? (other debugging techniques more than welcome as well). list p=18f458 include "p18f458.inc" __config _CONFIG1H, _HS_OSC_1H __config _CONFIG2H, _WDT_OFF_2H radix dec LEDPIN equ 0 LEDPORT equ PORTB LEDTRIS equ TRISB _main _setup_io bcf LEDTRIS,LEDPIN bcf LEDPORT,LEDPIN _setup_serial movlw 25 ; 9600 bps when clock @20Mhz movwf SPBRG bsf TXSTA,BRGH ; high speed bcf TXSTA,SYNC ; async bcf TRISC,6 ; rc6 output bsf TRISC,7 ; rc7 input bcf RCSTA,RX9 ; 8-bit receive bsf RCSTA,SPEN ; serial port enable bsf RCSTA,CREN ; enable receiver _loop _get_char nop btfss PIR1,RCIF goto _get_char movf RCREG,W btg LEDPORT,LEDPIN goto _loop end -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist