gnupic: Re: [gnupic] Re: gpsim register question


Previous by date: 31 Dec 2006 15:35:58 +0000 Re: gpsim register question, Maxim Wexler
Next by date: 31 Dec 2006 15:35:58 +0000 Re: [gnupic] Re: gpsim register question, Maxim Wexler
Previous in thread:
Next in thread: 31 Dec 2006 15:35:58 +0000 Re: [gnupic] Re: gpsim register question, Maxim Wexler

Subject: Re: [gnupic] Re: gpsim register question
From: Robert Pearce ####@####.####
Date: 31 Dec 2006 15:35:58 +0000
Message-Id: <RSwKqNKeQ9lFFwUN@daniel.huneausware.local>

On Sat, 30 Dec 2006, Maxim Wexler ####@####.#### wrote :
>aargh, did it again! Confusing the tab with the caps lock 8(
>
Easily done!

>Anyway
>
>COUNT1 equ 20h
>
>Now when I step through the code and  pass the decfsz command 20h in the
>register viewer fills up with FFh from 00h.
>
I'm not entirely sure I understand you here, but let's see if my 
interpretation is right.

You're single-stepping through the code until you get to the subroutine 
"Delay". Then when you single step over the line
    Loop1   decfsz  COUNT1,1
you see the RAM cell at 0x20 go from 0x00 to 0xFF

Is that right?

If so it's exactly what I'd expect.

>Where does that 255 come from?
It's one less than the zero that was in there before.
> There's no mention anywhere in the previous
>code.
No, but there's already a zero in there, and you've run an instruction 
that subtracts one from that value.
> And besides, according to the pdf for DECFZ f,d f can't be more that
>127.

Ah, perhaps here is the confusion. The 'f' in that mnemonic refers to 
the _address_ of a RAM cell, and the instruction coding only has 7 bits 
for that. Hence 'f' can only be 0..127 - you have defined it as 0x20.

The instruction decrements the _contents_ of the RAM cell at address 
'f', which in your case are currently undefined, and GPSim defaults to 
all zero.

>
>Another thing: In the breadboard window only porta0 to porta5 become
>outputs. 6&7 remain inputs. Why, after being sent all zeros?
>
That would depend on the processor type. Some have restrictions on 
whether certain pins can be outputs - for example, the 12C5xx range 
allocate GPIO3 to the MCLR pin, and force it to always be an input 
regardless of the state of TRIS.3
-- 
Rob Pearce                       http://www.bdt-home.demon.co.uk

The contents of this | Windows NT crashed.
message are purely   | I am the Blue Screen of Death.
my opinion. Don't    | No one hears your screams.
believe a word.      |

Previous by date: 31 Dec 2006 15:35:58 +0000 Re: gpsim register question, Maxim Wexler
Next by date: 31 Dec 2006 15:35:58 +0000 Re: [gnupic] Re: gpsim register question, Maxim Wexler
Previous in thread:
Next in thread: 31 Dec 2006 15:35:58 +0000 Re: [gnupic] Re: gpsim register question, Maxim Wexler


Powered by ezmlm-browse 0.20.