gnupic: hiccoughs on the learning curve.
Subject:
Re: hiccoughs on the learning curve.
From:
Samuel Tardieu ####@####.####
Date:
26 Sep 2002 14:32:26 -0000
Message-Id: <2002-09-26-16-30-00+trackit+sam@rfc1149.net>
On 26/09, Declan Moriarty wrote:
| movlw 0x3f ; W = 0011 1111
| movf PORTC, 1 ; should put W in PORTC but doesn't
| but this does
| movlw 0x3f ; W = 0011 1111
| movwf PORTC
movf does not move W anywhere: it moves the content of a register (PORTC
in your case) either in W or in the register itself (the latter case may
be used to set STATUS flags or to change the status of open-collector
outputs of port C).
movwf, on the other hand, does what is expected, namely moving W into
register PORTC.
However, do not forget to set TRISC before, as PORTC pins are inputs by
default.
| 2. Again to look at gpsim, this writes to TMR1L but not to TMR1H :-o
| clrf STATUS ; BANK 0.
| movlw 0x04 ; W=0000 0101
| movwf T1CON ; Sets TMR1 @ 1:1 prescale, & internal clk, & off.
| clrf TMR1L ; Sets TMR1L as zero
| movlw 0xfb ; w=0xfb
| movwf TMR1H ; Timer 1 prescaler = FB
|
| I can't spot the obvious mistake.
It looks like a bug in gpsim, TMR1H contains zero just after the write. Or
something obscure is hidden deep in the datasheet that I can't spot right
now :)
Sam