gnupic@linuxhacker.org
gnupic@linuxhacker.org
Am Mon, 11 Aug 2003 16:04:46 +0200 schrieb Leva <leva@interware.hu>:
> I have a "movlw 0x07; movwf CMCON" executed before the dance begins! :-) Also
> have disconnected the voltage references by a "clrf VRCON".
Should work. This is how I do it in the project I mentioned:
; disable comparator module
MOVLW 0x07
MOVWF CMCON
; set in/out for porta pins
MOVLW TRISA ; get adress for porta control reg
MOVWF FSR ; setup fsr
MOVLW b'00000000' ; all outputs
MOVWF INDF ; and set it
; setup PORTB
; set in/out for portb pins
MOVLW TRISB ; get adress for portb control reg
MOVWF FSR ; setup fsr
MOVLW b'00100111' ; all outputs except RB0 (SCK), RB1 (RXD),
; RB2 (TXD) and RB5 (SDA)
MOVWF INDF ; and set it
I haven't tried to simulate this with gpsim yet because I ran into the
interrupt problem that gpsim seems to have with the 16F628. But the code above
works with the MPLAB-simulator and also works on the actual target hardware.
Regards,
Jan
--
Dipl.-Ing. Jan Reucker email: jan@reucker-online.de
Ober-Ramstadt, Germany home: http://www.reucker-online.de/
ICQ# 46584597 PGP-Key: http://www.reucker-online.de/pgpkey.asc
Linux - because life is too short to reboot.
gnupic@linuxhacker.org