I'm using MPLAB to simulate a 16F72. For some reason, TRISA, TRISB,
and TRISC are not updating. The Watch window shows that they do not
change at the moment they are supposed to. I think there's one little
thing that I'm missing.
What am I missing?
Here's the code:
list p=pic16f72
include "p16f72.inc"
__config b'11111110111001'
;These are the same settings as those used by Bert Kelley.
;Code protection off, power-up timer disabled, watchdog timer
disabled, XT oscillator
;Bits 13-7: unimplemented, read as '1'
;Bit 6: BOREN, brown-out reset enable bit (0=disabled)
;Bit 5: unimplemented, read as '1'
;Bit 4: CP, FLASH program memory code protection bit (1=off)
;Bit 3: PWRTEN, power-up timer enable bit (1=disabled, 0=enabled)
;Bit 2: WDTEN, watchdog timer enable bit (0=disabled)
;Bits 1-0: FOSC1/FOSC0 oscillator selection bits (01=crystal XT
oscillator)
radix hex
errorlevel -302
org 0x000; Program stored at location 000
start ;Set the microcontroller configurations
;Set the RP bit settings to select Register Bank 1.
bcf STATUS,RP1;Bit RP1 of STATUS register set to b'0'.
bsf STATUS,RP1;Bit RP0 of STATUS register set to b'1'.
;Register Bank 1 selected.
;Set the tris bits to determine which I/O pins are inputs and which
are outputs.
;0=outputs, 1=inputs
movlw b'000011';W register=b'000011'
movwf TRISA;TRISA=b'000011'
;Now RA5, RA4, RA3, and RA2 are outputs while AN1 and AN0 are inputs.
movlw b'00000000';W register=b'00000000'
movwf TRISB;TRISB=b'00000000'
;Now RB7-RB0 pins are all outputs.
movlw b'00000000';W register=b'00000000'
movwf TRISC;TRISC=b'00000000'
;Now RC7-RC0 pins are all outputs.
;Finished setting the tris bits.
------------------------------------
to unsubscribe, go to http://www.yahoogroups.com and follow the instructions

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
I normally use macros to do bank selects, but below it looks like you've
selected bank 3 instead of bank 1. The bsf is setting bank RP1 while I
think you want RP0.
Harold
> ;Set the RP bit settings to select Register Bank 1.
> bcf STATUS,RP1;Bit RP1 of STATUS register set to b'0'.
> bsf STATUS,RP1;Bit RP0 of STATUS register set to b'1'.
> ;Register Bank 1 selected.
--
FCC Rules Updated Daily at http://www.hallikainen.com - Advertising
opportunities available!
------------------------------------
to unsubscribe, go to http://www.yahoogroups.com and follow the instructions

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )