Sign in

username:

password:



Not a member?

Search piclist



Search tips

Subscribe to piclist



piclist by Keywords

12F675 | 16F628 | 16F84 | 16f877 | 16F877A | 16F88 | 18F458 | ADC | AVR | Bootloader | CAN | CCS | CRC | EAGLE | EEPROM | ICD | ICSP | IDE | JDM | LED | Macros | Microchip | MPLAB | PCB-CAD | PIC10F | Pic12f675 | PIC16F84 | PIC16F84A | PIC16F877 | PIC18 | PIC18F452 | PicBasic | PICC | PICSTART | PWM | RS-485 | RS232 | SMT | SPI | UART | USART | USB | Wireless | Wisp628 | Xilinx

Ads

Discussion Groups

Discussion Groups | Piclist | TRISA/B/C not changing for 16F72

A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.

TRISA/B/C not changing for 16F72 - Jason Hsu - May 22 20:19:51 2008

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 )


Re: TRISA/B/C not changing for 16F72 - Harold Hallikainen - May 23 0:01:17 2008

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 )