gnupic: Bug in simulation of BSF for in/out ports still present in 0.20.4 :-(


Previous by date: 20 Sep 2000 02:06:23 -0000 Re: Bug in simulation of BSF for in/out ports still present in 0.20.4 :-(, Scott Dattalo
Next by date: 20 Sep 2000 02:06:23 -0000 Re: Bug in simulation of BSF for in/out ports still present in 0.20.4 :-(, Wojtek Zabolotny
Previous in thread: 20 Sep 2000 02:06:23 -0000 Re: Bug in simulation of BSF for in/out ports still present in 0.20.4 :-(, Scott Dattalo
Next in thread: 20 Sep 2000 02:06:23 -0000 Re: Bug in simulation of BSF for in/out ports still present in 0.20.4 :-(, Wojtek Zabolotny

Subject: Re: Bug in simulation of BSF for in/out ports still present in 0.20.4 :-(
From: Scott Dattalo ####@####.####
Date: 20 Sep 2000 02:06:23 -0000
Message-Id: <Pine.LNX.4.21.0009192051180.8703-100000@tempest2.blackhat.net>


On Tue, 19 Sep 2000, Wojtek Zabolotny wrote:

> Hi All,
> 
> I've downloaded & compiled the GPSIM 0.20.4, and the bug reported in my
> previous post ("Bug in sumlation of BSF instruction in GPSIM?", sorry for
> typing error in subject) is still there. The output of GPSIM session is
> the same, only the GPSIM's version number has changed ;-).


gpsim> 16F877  0x0000  0x2840  goto     0x0040
  cycle: 0x01
  cycle: 0x02
16F877  0x0040  0x30FF  movlw   0xff
  wrote: 0xff to W
  cycle: 0x03
16F877  0x0041  0x0087  movwf   portc
   read: 0xff from W
  wrote: 0x00 to portc
  cycle: 0x04
16F877  0x0042  0x1683  bsf     status,5
   read: 0x18 from status
  wrote: 0x38 to status
  cycle: 0x05
16F877  0x0043  0x30C0  movlw   0xc0
  wrote: 0xc0 to W
  cycle: 0x06
16F877  0x0044  0x0087  movwf   trisc
   read: 0xc0 from W
  wrote: 0x3f to portc
  wrote: 0xc0 to trisc
  cycle: 0x07
16F877  0x0045  0x1283  bcf     status,5
   read: 0x38 from status
  wrote: 0x18 to status
  cycle: 0x08
16F877  0x0046  0x1687  bsf     portc,5
   read: 0x3f from portc
  wrote: 0x3f to portc
  cycle: 0x09
16F877  0x0047  0x2847  goto    0x0047
  cycle: 0x0a
  cycle: 0x0b


As you can see, my version did not change portc to 0x20. Hmm. What inlude file
are you using?


------------

Note that this program has floating inputs. Unlike a real pic device which would
oscillate itself to death, gpsim floating inputs will read as zeroes. So if you
change the tris register to make an I/O an input, this line will float low. Just
so this is clear, let's look at the code:

 ; The first two lines will make all of the I/O lines high in
 ; PORTC's output latch. Note that this will not necessarily
 ; drive the I/O lines high. If the I/O lines are programmed
 ; as outputs then, yes, it would make them high. 

main		movlw	0xff
		movwf	PORTC

 ;switch to bank1 so that the tris register can be accessed

		bsf	STATUS,RP0

 ;Make bits 6 & 7 inputs and the rest of the lines outputs.
 ;The output lines will now cause the contents of the holding
 ;latch to be written to the I/O port. So, if PORTC is read
 ;immediately after writing to TRISC, the lower 6 bits will
 ;be outputs and set high (because that's what's in the holding
 ;latch) while the upper two bits which are inputs will be read
 ;low. This means portc will be 0x3f
		movlw	b'11000000'
		movwf   TRISC

 ;switch back to bank 0

		bcf	STATUS,RP0

 ;Bit 5 of portc is now set high. However, since bit 5 is already
 ;high, this has no effect.

		bsf	PORTC,5
loop		goto 	loop
		end




Previous by date: 20 Sep 2000 02:06:23 -0000 Re: Bug in simulation of BSF for in/out ports still present in 0.20.4 :-(, Scott Dattalo
Next by date: 20 Sep 2000 02:06:23 -0000 Re: Bug in simulation of BSF for in/out ports still present in 0.20.4 :-(, Wojtek Zabolotny
Previous in thread: 20 Sep 2000 02:06:23 -0000 Re: Bug in simulation of BSF for in/out ports still present in 0.20.4 :-(, Scott Dattalo
Next in thread: 20 Sep 2000 02:06:23 -0000 Re: Bug in simulation of BSF for in/out ports still present in 0.20.4 :-(, Wojtek Zabolotny


Powered by ezmlm-browse 0.20.