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.

need help for PIC 16F84A programming

Status
Not open for further replies.

abc1122

Newbie level 4
Joined
Feb 4, 2009
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,325
16f84a programming

hie,
Im very new to PIC programming. Have no basic knowledge at all. Am currently doing a final year project.
Below are part of my code:

PORTA equ 05h
TRISA equ 85h
PORTB equ 06h
TRISB equ 86h

org 0 ;reset vector to origin 0
bsf STATUS,5 ;go to BANK 1
movlw PORT_RA ;set RA2 and RA3 as input
movwf TRISA ;move 04h to TRISA
movlw PORT_RB ;set all RB ports as output
movwf TRISB ;move to TRISB
bcf STATUS,5 ;back to BANK 0


there are 2 error in the BOLD.

Message[302] C:\PROJECTS\16F84ATMPO.ASM 101 : Register in operand not in bank 0. Ensure that bank bits are correct.

Message[302] C:\PROJECTS\16F84ATMPO.ASM 103 : Register in operand not in bank 0. Ensure that bank bits are correct.

can somebody help me? Thanks
 

pic16f84a programming

Look at example 4.1 on page 15 of the PIC16F84 data sheet.

You need to add BSF STATUS RP0 before you write data to the TRIS registers and BCF STATUS RP0 afterwards.
 

pic16f84 programming

G4BCH said:
Look at example 4.1 on page 15 of the PIC16F84 data sheet.

You need to add BSF STATUS RP0 before you write data to the TRIS registers and BCF STATUS RP0 afterwards.


I have both BSF and BCF already. Or should i change the the sequence?

By the way, i have another problem. This is regarding the Link Step Failed.

'SERVICE movlw RA1 ;switching to service line'

Warning[207] C:\PROJECTS\16F84ATMPO.ASM 118 : Found label after column 1. (SERVICE)

thanks

Added after 43 minutes:

i have found the solution.
But i have new error here.

Error - section 'ISR' can not fit the absolute section. Section 'ISR' start=0x00000004, length=0x00000010

What does it mean?

thanks
 

pic16f84.inc

Hi i think you should write this


#include pic16f84.inc
list p=16f84

bsf STATUS,RP0
movlw b'00001100' ;port ra2, ra3 as input, rest as outut
movwf TRISA
movlw b'00000000' ; port b sa output
movwf TRISB
bcf STATUS,RP0

sorry for my english
 

movwf trisa

if you use this :

#include pic16f84A.inc
list p=16f84A


you don't need this

PORTA equ 05h
TRISA equ 85h
PORTB equ 06h
TRISB equ 86h
 

programming pic16f84

abc1122 said:
But i have new error here.

Error - section 'ISR' can not fit the absolute section. Section 'ISR' start=0x00000004, length=0x00000010

What does it mean?

thanks

It may be because your code overwrites Interrupt Vector location 0x0004. Use a GOTO in the beginning like this or show us your full code. May be its something else.
Code:
org 0x0000 ;reset vector to origin 0
    goto main

org 0x0020
main
    bsf STATUS,5 ;go to BANK 1
    movlw PORT_RA ;set RA2 and RA3 as input
    movwf TRISA ;move 04h to TRISA
    movlw PORT_RB ;set all RB ports as output
    movwf TRISB ;move to TRISB
    bcf STATUS,5 ;back to BANK 0
 

in pic programming what happen trisa

i have my code build successfully.
but i cant write it in my pic. when i program and check the memory status is not correct
 

16f84a programing

abc1122 said:
i have my code build successfully.
but i cant write it in my pic. when i program and check the memory status is not correct
Which programmer are you using ?
 

pic16f84 register in operand not in bank 0

CMOS said:
abc1122 said:
i have my code build successfully.
but i cant write it in my pic. when i program and check the memory status is not correct
Which programmer are you using ?

its ok.. problem solved.. th
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top