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.

Proteus x Mplab Source Code (Assembly)

Status
Not open for further replies.

Dragnovith

Junior Member level 1
Junior Member level 1
Joined
Apr 17, 2021
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
104
Hi, this standard procedure is usually done to work with PIC16F877A in Mplab.

MPLAB

Code:
org 0x00   ; reset vector
goto Start  ; after reset start

org 0x04   ; interruption vector
goto Start  ; after interruption start

And in the PROTEUS:

Code:
RST code 0x0
    GOTO Start                        ; After reset, start in main function

ORG 4

PGM code

Start

I would like to apply the procedure below (performed in proteus) in mplab.

Code:
RST code 0x0
    GOTO Start                        ; After reset, start in main function

ORG 4
    BTFSC INTCON,1                    ; Check interruption by INT
    GOTO InterrupcionINT                    ; If it is enabled. Interruption by INT
                                    ; It is not activated. Check another interrupt
    BTFSS V_ESTADO_LAVACAR,7            ; Check if the washing machine's status is on
    GOTO DescartarInterrupcao            ; It is not activated. Other interruptions not performed
                                    ; If it is enabled. Compare other interruptions

    BTFSC INTCON,0                    ; Check Interruption by BI
    GOTO InterrupcionRBI                    ; If it is enabled. Interruption by RBI
    GOTO InterrupcionTMR0                ; It is not activated. Interruption by TMR0

DescartarInterrupcao
    BTFSS PORTB,4                        ; We eliminated the mismatch condition to be able to erase the RBI pin
    nop
    BCF INTCON, RBIF                    ; Erases the interruption by RBI
    BCF INTCON, T0IF                    ; Erases the interruption by TMR0
    RETFIE

PGM code

Start

What was done in mplab

Code:
org 0x00   ;vetor de reset                
    GOTO Start                       ; After reset, start in main function

org 0x04                            
    BTFSC INTCON,1                    ; Check interruption by INT
    GOTO InterrupcionINT                    ; If it is enabled. Interruption by INT
                                    ; It is not activated. Check another interrupt
    BTFSS V_ESTADO_LAVACAR,7            ; Check if the washing machine's status is on
    GOTO DescartarInterrupcao            ; It is not activated. Other interruptions not performed
                                    ; If it is enabled. Compare other interruptions

    BTFSC INTCON,0                    ; Check Interruption by BI
    GOTO InterrupcionRBI                    ; If it is enabled. Interruption by RBI
    GOTO InterrupcionTMR0                ; It is not activated. Interruption by TMR0

DescartarInterrupcao
    BTFSS PORTB,4                        ; We eliminated the mismatch condition to be able to erase the RBI pin
    nop
    BCF INTCON, RBIF                    ; Erases the interruption by RBI
    BCF INTCON, T0IF                    ; Erases the interruption by TMR0
    RETFIE

    GOTO Start

Start

It doesn't seem to me to be the same thing, what would be the correct way to do this?
 

Solution
They are all the same thing. After reset or restart, the program counter is loaded with 0x00 and it immediately jumps to the start of the program "Start". The interrupt vector is fixed at 0x04 so the ISR must be at that address, the reset address contains code that jumps over the ISR to where the program execution should start.

Brian.
They are all the same thing. After reset or restart, the program counter is loaded with 0x00 and it immediately jumps to the start of the program "Start". The interrupt vector is fixed at 0x04 so the ISR must be at that address, the reset address contains code that jumps over the ISR to where the program execution should start.

Brian.
 
Solution
They are all the same thing. After reset or restart, the program counter is loaded with 0x00 and it immediately jumps to the start of the program "Start". The interrupt vector is fixed at 0x04 so the ISR must be at that address, the reset address contains code that jumps over the ISR to where the program execution should start.

Brian.
That was it. Thank you again!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top