Rikard Bosnjakovic wrote: > I've written a small assembly-code in MPLAB and simulate it. I open a > watch-window (View->Watch) and add a couple of symbols and SFRs. To > change the values, I simply double-click it and type in a new one. > Works fine, except for PORTA. No matter which value I try to set in > PORTA, it returns to the initial zero. Does this have something to do > with that I've set MCLRE in the config word to zero, or what's the > reason? > > Snippets of my initialization code: > > __CONFIG _CP_OFF & _WDT_ON & _BODEN_ON & _PWRTE_ON & _ER_OSC_CLKOUT & > _MCLRE_OFF & _LVP_ON Part of the problem is right here. You need to use INTOSC to be able to free up the OSC1 and OSC2 pins. It is only two speeds (37kHx and 4MHz), you set the speed using the OSCF bit in the PCON sfr. So instead of _ER_OSC_CLKOUT, you want something like "_INTRC_OSC_NOCLKOUT". If the assembler doesn't like that, try "_INTOSC_OSC_NOCLKOUT". Microchip has a problem with consitency on this stuff. Be careful with that LVP_ON stuff and trying to use /MCLR as an input pin, I'd change that too if I were you. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist