---
+ Post New Thread
Results 1 to 9 of 9
  1. #1
    Newbie level 4
    Points: 718, Level: 5

    Join Date
    Feb 2009
    Posts
    6
    Helped
    0 / 0
    Points
    718
    Level
    5

    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

    •   Alt4th February 2009, 04:31

      advertising

        
       

  2. #2
    Full Member level 3
    Points: 2,881, Level: 12

    Join Date
    May 2006
    Posts
    177
    Helped
    60 / 60
    Points
    2,881
    Level
    12

    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.



  3. #3
    Newbie level 4
    Points: 718, Level: 5

    Join Date
    Feb 2009
    Posts
    6
    Helped
    0 / 0
    Points
    718
    Level
    5

    pic16f84 programming

    Quote Originally Posted by G4BCH
    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



    •   Alt4th February 2009, 14:20

      advertising

        
       

  4. #4
    Newbie level 1
    Points: 766, Level: 6

    Join Date
    Sep 2008
    Posts
    1
    Helped
    0 / 0
    Points
    766
    Level
    6

    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



    •   Alt10th February 2009, 09:27

      advertising

        
       

  5. #5
    Member level 3
    Points: 2,211, Level: 10
    Achievements:
    7 years registered

    Join Date
    Oct 2006
    Posts
    66
    Helped
    4 / 4
    Points
    2,211
    Level
    10

    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



  6. #6
    Advanced Member level 3
    Points: 12,110, Level: 26

    Join Date
    Jan 2004
    Location
    USA
    Posts
    864
    Helped
    94 / 94
    Points
    12,110
    Level
    26

    programming pic16f84

    Quote Originally Posted by abc1122
    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



  7. #7
    Newbie level 4
    Points: 718, Level: 5

    Join Date
    Feb 2009
    Posts
    6
    Helped
    0 / 0
    Points
    718
    Level
    5

    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



  8. #8
    Advanced Member level 3
    Points: 12,110, Level: 26

    Join Date
    Jan 2004
    Location
    USA
    Posts
    864
    Helped
    94 / 94
    Points
    12,110
    Level
    26

    16f84a programing

    Quote Originally Posted by abc1122
    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 ?



  9. #9
    Newbie level 4
    Points: 718, Level: 5

    Join Date
    Feb 2009
    Posts
    6
    Helped
    0 / 0
    Points
    718
    Level
    5

    pic16f84 register in operand not in bank 0

    Quote Originally Posted by CMOS
    Quote Originally Posted by abc1122
    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



+ Post New Thread
Please login