When it comes to RMW, it should only be a problem with regards to pins configed as analog input. They always (also in SIM) reads as "0". SIM doesn't have any timing issues as when you have a pin connected to something physical that delays the switch (capacitive load). I do not think that SIM can simulate capacitive loads. The code as-is simulates perfectly well in MPLAB8/MPSIM. For clearity and to not have to check the datasheet, it it better to use the correct register to banksel : .... banksel TRISA movlw b'00000111' ; Tried both 6 and 7 movwf ADCON1 .... In this case TRISA and ADCON1 happends to be in the same bank. Maybe you knew that, I didn't and had to check with the datasheet... > > I had a lot of misterious problem... RMW issues can always be explained. :-) Jan-Erik. G=E1l Zsolt wrote 2012-08-20 09:38: > Hello, > > I would say first, I never used mplabx simulator. > Your problem with example could be according the READ-MODIFY-WRITE > sequence. I used to define a shadow register in the shared area to > avoid this problem. > I had a lot of misterious problem before I started to use shadow > register. Here is a simple example to showing it: > > ... > > SHADOWREGISTERS UDATA_SHR > > PORTAOUT res 1 > > ... > > banksel PORTA > > bsf PORTAOUT,0 > movf PORTAOUT,w > movwf PORTA > > bsf PORTAOUT,1 > movf PORTAOUT,w > movwf PORTA > > ... > --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .