Electronic Circuits and Projects Forum



Abnormal behaviour PIC18 Simulator IDE v2.81

  1. #1
    robertkendrick robertkendrick is offline

    Abnormal behaviour PIC18 Simulator IDE v2.81

    Hi

    Try this simple code using FSR1 with andwf and iorwf instructions.
    label one works. label two and three fail.

    Wondering if anyone has had similar problems and knows of a fix.


    Code :
    ; 18F4520
    ; abnormal behaviour in PIC18 Simulator IDE
    	org 0
    	goto 0x100
     
    	org 0x100
    one:	; works as defined
    	movlb 0
    	setf FSR1H
    	movlw 0x93
    	movwf FSR1L
    	movlw 0xee
    	movwf preinc1
     
    two:	;this code snippet does not alter
    	;TRISC and corrupts TRISD. Also
    	;FSR1 is incremented twice.	
    	movlw 0x93
    	movwf FSR1L
    	movlw	0x7f
    	andwf	preinc1,f
     
    three:	;this code snippet does not alter
    	;TRISC and corrupts TRISD. Also
    	;FSR1 is incremented twice.		
    	movlw 0x93
    	movwf FSR1L
    	movlw	0x0f
    	iorwf	preinc1,f
     
    	end

  2. #2
    ericgibbs ericgibbs is offline
    Super Moderator
    hi,
    Would you please post the remainder of the code.?

    Lets see the snippets in context.
    0
    Eric " Good enough is Perfect "
    I will NOT answer PM's requesting technical help, please use the Forum
    "Nigels Asm tutorials:" www.winpicprog.co.uk/
    "Ian Rogers 'C' conversion of Nigels Asm tutorials:" http://www.electro-tech-online.com/c...torials-c.html

  3. #3
    Ian Rogers Ian Rogers is offline
    Super Moderator
    Eric... I very much think that it.... "org" at the beginning and "end" at well... the end..
    0
    I'd give my left arm to be ambidextrous
    Nigel's tutorials in asm... http://www.winpicprog.co.uk/
    Nigel's tutorials.. re-written in C. http://www.electro-tech-online.com/c...torials-c.html

  4. Thread Starter #4
    robertkendrick robertkendrick is offline
    Eric, thanks for the reply.

    I don't have any code I would like you to fix (not today anyway ..)

    The posted code illustrates a pretty serious bug in Pic18 Simulator.

    Place these five instructions into the Assembler and 'assemble & load'
    Then single step them.
    TRISC (0x0f94) should be updated by the IORWF instruction but isn't.
    TRISD (0x0f95) is corrupted.
    FSR1 is incremented twice instead of once.

    ;This does not alter
    ;TRISC and corrupts TRISD. Also
    ;FSR1 is incremented twice.
    setf FSR1H
    movlw 0x93
    movwf FSR1L
    movlw 0x0f
    iorwf preinc1,f

    Do the same assembly and single step in MPLAB (8.70) and it works as expected and documented in the data sheet.

    Further tests within PIC18 sim also show that this bug applies to all IORWF/ANDWF instructions whilst using PREINCx with any FSR.
    0

Tags
Similar Threads
Thread Starter Forum Replies Last Post
PIC Simulator IDE moonstreat General Electronics Chat 8 28th January 2010, 06:54 AM
Need Help With Pic Simulator Ide WHO Microcontrollers 18 29th March 2008, 07:33 PM
PIC Simulator IDE v5.33 problem winjohan Microcontrollers 2 2nd August 2007, 01:11 PM
ds18b20 pic simulator ide problem wchpikus Microcontrollers 1 12th June 2007, 05:08 PM
looking for PIC simulator IDE V 4.0 HighWay Microcontrollers 0 8th January 2004, 01:10 PM
Electronic Circuits  |  Learning Electronics

Join our community with over 100,000 Members! It's free, easy and when you're logged in you have many more features! Click to register.
Page Time: 0.06583 seconds      Memory: 7,296 KB      Queries: 17      Templates: 0