Assembly: What does the btfsc function do?

In summary, the BTFSC function is different to the BTFSS function. The opposite actually. The BTFSC function will not skip the next line of coding if the logic level is 1, while the BTFSS function will skip the next line of coding if the logic level is 1. Additionally, the BTFSC function is used to skip bits in a file while the BTFSS function is used to set bits in a file.
  • #1
atlbraves49
81
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
  • #2
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:
  • #3
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 :).
 
  • #4
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 :)
 

Related to Assembly: What does the btfsc function do?

1. What is the purpose of the btfsc function?

The btfsc function, also known as "bit test, skip if clear," is used to check the state of a particular bit in a register or memory location. It allows the program to determine whether a specific bit is set or cleared, and then skip the following instruction if the bit is cleared.

2. How does the btfsc function work?

The btfsc function works by first specifying the register or memory location to be checked, followed by the bit position within that location. The function then performs a logical AND operation between the specified bit and the value in the register or memory location. If the result is 0, meaning the bit is clear, then the following instruction is skipped. If the result is not 0, meaning the bit is set, then the following instruction is executed.

3. Can the btfsc function be used with any type of bit?

Yes, the btfsc function can be used with any type of bit, whether it is a single bit or a group of bits. The function allows for a lot of flexibility in checking and manipulating specific bits within a register or memory location.

4. How is the btfsc function different from the btfss function?

The btfsc function and the btfss function are very similar, but they have one key difference. The btfsc function skips the following instruction if the specified bit is clear, while the btfss function skips the following instruction if the specified bit is set. In other words, the "c" in btfsc stands for "clear," while the "s" in btfss stands for "set."

5. When is the btfsc function typically used?

The btfsc function is often used in conditional branching, where the program needs to make a decision based on the state of a particular bit. It is also commonly used in bit manipulation operations, such as setting or clearing specific bits within a register or memory location.

Similar threads

  • Electrical Engineering
Replies
9
Views
2K
  • Electrical Engineering
Replies
6
Views
972
  • Programming and Computer Science
Replies
16
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
Replies
4
Views
1K
Replies
22
Views
2K
  • Mechanical Engineering
Replies
3
Views
290
  • Programming and Computer Science
Replies
16
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
4K
  • Electrical Engineering
Replies
10
Views
1K
Back
Top