John Coppens wrote 2012-08-24 21:17: > Hello all... > > As mentioned in my mail, I submitted the strange behaviour I > experienced with mplab x to the Microchip bug list, and got as answer: > > > We believe that this is due to the read-modify-write > nature of the bsf instructions. You should keep an image and update the > image > (...and closed the bug) > > If I understand the RMW behaviour, then the possible problems are due > to either capacitive (or other) loading of the outputs, or having some > internal peripheral enabled which could cause the same loading. > > Is there any way this could explain my problem? I even tried the > 'image' method to update port A, and the mplab X simulator _still_ > doesn't show any change to the port A output. > Now, Note that the RWM problem *never* hits the *same pin* as your are BCF/BSF'ing !! The RWM problem will show up as random changes of *other* pins then the one you are targeting with your BCF/BSF. Usualy another pin changed with a BCF/BSF directly before the other BCF/BSF. That is when the RMW might reset the first pin since it hadn't had time to get to a stable level on the pin. Now, it you are BSF'ing a pin that is configured as an analog input, it *should* show as "0" in the simulator because that is how the hardware sees it. But *that* is *not* a RWM issue ! It's absolutely normal. :-) Have you given them a reproducer? That is, actual code that shows the problem? Jan-Erik. > Am I really that far off my game? Could someone try to run this code and = check > if they have the same problems? (MPLAB X is Linux 64bit version 1.30 here= ) > Gpsim and the actual hardware say I'm right... > > John > > BSF Code: > processor pic16f874 > include P16F874.INC > > org 0 > > goto start > > org 4 > > start > banksel TRISA > movlw b'00000111' > movwf ADCON1 > > movlw b'00111001' > movwf TRISA > > clrf TRISB > > banksel PORTA > loop > bsf PORTA,1 > bsf PORTA,2 > > bcf PORTA,1 > bcf PORTA,2 > goto loop > > end > > Direct modification code (no RMW): --------------------------- > > processor pic16f874 > include P16F874.INC > > org 0 > > goto start > > org 4 > > start > banksel TRISA > movlw b'00000111' > movwf ADCON1 > > movlw b'00111001' ; Bits 1 & 2 as outputs > movwf TRISA > > clrf TRISB > > banksel PORTA > loop > movlw 2 > movwf PORTA > movlw 6 > movwf PORTA > movlw 4 > movwf PORTA > movlw 0 > movwf PORTA > > goto loop > > end > --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .