Assembly: What does the btfsc function do?

  • Thread starter Thread starter atlbraves49
  • Start date Start date
  • Tags Tags
    Assembly Function
Click For Summary

Discussion Overview

The discussion revolves around the assembly language functions BTFSC (Bit Test File Skip if Clear) and BTFSS (Bit Test File Skip if Set), exploring their differences and applications. Participants also inquire about the distinctions between call and goto commands in assembly programming.

Discussion Character

  • Technical explanation
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • Some participants explain that BTFSC and BTFSS are opposite functions, with BTFSC not skipping the next line if the bit is clear, while BTFSS skips if the bit is set.
  • One participant suggests referring to the microcontroller's spec sheet for definitions of BTFSC and BTFSS, indicating that clear=0 and set=1.
  • There is a discussion about the difference between call and goto commands, with some participants noting that GOTO simply directs the program flow, while CALL executes a subroutine and returns to the original point.
  • Examples are provided to illustrate the use of BTFSC and BTFSS in code, as well as the functionality of call and goto commands.

Areas of Agreement / Disagreement

Participants generally agree on the definitions and functionalities of BTFSC and BTFSS, but there are multiple perspectives on the implications of using call versus goto commands, indicating some level of debate.

Contextual Notes

Some participants reference specific examples and coding scenarios, but there is no consensus on the best practices for using these commands in all contexts.

Who May Find This Useful

This discussion may be useful for individuals learning assembly language programming, particularly those working with microcontrollers and interested in understanding control flow commands.

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 :)
 

Similar threads

  • · Replies 102 ·
4
Replies
102
Views
4K
  • · Replies 9 ·
Replies
9
Views
3K
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
2
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
16
Views
4K
  • · Replies 16 ·
Replies
16
Views
5K
  • · Replies 8 ·
Replies
8
Views
5K