Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC Enhanced midrange instruction set questions.

Status
Not open for further replies.
Birdman's thread on the PIC16F193X got me thinking more about the 1934s I have sitting around that I haven't play with yet. I've tried to find some tutorials on the net for what some of the extended instructions do, but I haven't found anything, so I've turned to you guys for help:

1)
What is the functional difference in CALLW and BRW?

2)
Should MOVLP be used to jump to another memory page in the program, just like moving a number to W and then ADDWF PCALTH?

3)
What is the advantage to MOVLB over just changing status register bits or using the BANKSEL directive?

4)
MOVIW and MOVWI throw me for a loop when trying to understand anything about them from the datasheet. I understand that they are used for indirect addressing and can be used to read or write, respectively, to/from the register pointed to by the FSR, but beyond that I'm lost. Can some one show how the syntax actually looks in a snip of code with the increments and decrements? I just need this explained in general.

Thanks!
 
For #3 please note that the new chips no longer have status bits for controlling the banks, they have a BankSelectRegister which controls them. This is instruction is to save you from doing movlw movwf
 
1)
What is the functional difference in CALLW and BRW?

CALLW is an absolute call. The program counter is changed to the value of W. (The most significant bits of the program counter come from PCLATH).

BRW is a relative branch. The program counter is increased by W+1.

Also CALLW (and CALL) puts the current program counter onto the stack, so that a RETURN takes the program flow back to the line after CALLW (or CALL).

BRW (or BRA or GOTO) does not change the stack, so it does not change where the next RETURN will send the program to.
 

Attachments

  • likethis.PNG
    likethis.PNG
    18 KB · Views: 347
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top