gnupic: gpsim / TMR0


Previous by date: 7 Feb 2005 12:40:10 +0000 Re: [gnupic] Flex sensors alternative, slimboyfatboyslim
Next by date: 7 Feb 2005 12:40:10 +0000 Re: [gnupic] gpsim / TMR0, Scott Dattalo
Previous in thread:
Next in thread:

Subject: gpsim / TMR0
From: Tobias Schlottke ####@####.####
Date: 7 Feb 2005 12:40:10 +0000
Message-Id: <Pine.LNX.4.58.0502071323260.3577@ws-toby.Netzwert.AG>

Hi

I dont understand the behaviour of TMR0 and gpism.
It seems to me thet the timer is not incremented every
cycle. Instead in conditional and/or goto instructions
one increment is missing.

My testbed looks like this:

I'm simulating a 12c508. For testing I wrote this
stupid little program:


========= 8< =====================
;; test.asm
;; assemble with: gpasm -p p12c508 test.asm
include "p12c508.inc"

	org 0

	movlw 0
	OPTION

main:
	nop
	nop
	nop
	nop
	goto main
end

========= 8< =====================


TMR0 is configured to be incremented every instruction
cycle, (prescaler == 0).

I started the simulator, gpsim version 0.21.2, loaded
one processor and the little prog:

gpsim> processor p12c508
gpsim> load -s test.cod

and ran over the initial part with

gpsim> step 4

.....
  wrote: 0x00 to OPTION
0x0000000000000003  p12c508  0x0002  0x0000  nop

Now I check tmr0:
gpsim> dump s

000  indf = 00      001  tmr0 = 01      002  pcl = 04
003  status = 18
004  fsr = 00       005  osccal = 00    006  gpio = 00

Value is one, ok.
Doing one further step and dumping again:

gpsim> step
0x0000000000000004  p12c508  0x0003  0x0000  nop
gpsim> dump s

000  indf = 00      001  tmr0 = 01      002  pcl = 05
003  status = 18
004  fsr = 00       005  osccal = 00    006  gpio = 00

tmr0 ist still 1

??

Either I didnt understand the behaviour of tmr0 or the
simulator doesnt work correctly.

Someone a hint for me?

Toby

Previous by date: 7 Feb 2005 12:40:10 +0000 Re: [gnupic] Flex sensors alternative, slimboyfatboyslim
Next by date: 7 Feb 2005 12:40:10 +0000 Re: [gnupic] gpsim / TMR0, Scott Dattalo
Previous in thread:
Next in thread:


Powered by ezmlm-browse 0.20.