Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

just a little help in understanding TRIS for PIC16F1787

Status
Not open for further replies.

techristian

Member level 1
Member level 1
Joined
Apr 3, 2013
Messages
41
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
Windsor, Ontario
Activity points
1,612
I'm using MPLABX MPASM to assemble some code to drive LEDs. My code assembles ok but I'm getting warnings on my use of of the TRIS command.

INTOSC equ 0xFFFC
porta equ 0x005
portb equ 0x006
FOSC = INTOSC

clrw
tris porta
Warning[224] /home/dan/Desktop/MPLABX/led.asm 26 : Use of this instruction is not recommended.

clrw
tris portb
Warning[224] /home/dan/Desktop/MPLABX/led.asm 26 : Use of this instruction is not recommended.

Now some listings show porta at 0x000c and portb at 0x000d for the PIC16F1787 but the assembler wants me to keep the address between 0005 and 0007.....that is another issue that puzzles me???????

As you can see above, I want to use the internal oscillator at 16mhz

HELP !!
OK SO I TRIED THIS BELOW

............................................................................................................................................................................

I'm trying this now and I get no errors or warnings but it is real kludgy.


INTOSC equ 0xFFFC
TRISA equ 0x08c
TRISB equ 0x08d
porta equ 0x00c
portb equ 0x00d
FOSC = INTOSC
delay equ 0x0c ;first general purpose register
digit equ 0x0d
digmask equ 0x0e
value equ 0x0f


org 0x000
goto start
org 0x004
goto isrv

start
;configure all port A bits for output
clrw
movlw b'00000000'
movwf TRISA

;configure all port B bits for output
clrw
movlw b'00000000'
movwf TRISB

MUST I ALWAYS TELL THE ASSEMBLER THE ADDRESSES OF PORTS AND TRIS PORTS? I thought it would do the assembly based on the chip I'm using.
Dan
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top