Assembly: What does the btfsc function do?

  • Thread starter Thread starter atlbraves49
  • Start date Start date
  • Tags Tags
    Assembly Function
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 48K views
atlbraves49
Messages
80
Reaction score
0
And how is it different from btfss?



And also, what's the difference between a call and goto command in assembly?
 
Engineering news on Phys.org
atlbraves49 said:
Assembly: What does the btfsc function do?
And how is it different from btfss?

Do you know what btfsc and btfss stand for?
If I was wanting to find this out, I would download the spec sheet for my microcontroller and take a close look at the instruction set. (hint: clear=0, set=1)

And also, what's the difference between a call and goto command in assembly?
You may benefit from working your way through a tutorial on assembly coding.
Here may be a useful http://www.amqrp.org/elmer160/lessons/index.html" . Though this tutorial is based on the PIC micro, the concepts are true for all others.
 
Last edited by a moderator:
The BTFSC function is very different to the BTFSS function. The opposite actually.

BTFSC (Bit test file skip if clear)
BTFSS (Bit test file skip if set)

Meaning, if the logic at location f is high (1), then the BTFSC function will not skip the next line of coding. However, the BTFSS function will skip the next line of coding if the logic level is 1.

e.g.

\\A button is pressed making logic at PORTB 1.

BTFSC PORTB
GOTO x
BTFSS PORTB
GOTO y.

This coding would execute the subroutine at x not y.


Hope this helps :).
 
atlbraves49 said:
And how is it different from btfss?



And also, what's the difference between a call and goto command in assembly?

These two commands are similar but not the same.

A GOTO command will simply Go to a place stated in a program. However, you use the call command when you wish to execute a subroutine and then return back to the previous point of the program where the call command was.

For example:

MOVLW $01
MOVWF PORTA
CALL subrout
ADDLW $F3
MOVWF PORTB
subrout:
MOVLW $00
MOVWF PORTB
GOTO subrout
.END


Hope this helps :)