CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

btfsc instruction converted in CCS C

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
horde_fuego



Joined: 31 Mar 2009
Posts: 11

View user's profile Send private message

btfsc instruction converted in CCS C
PostPosted: Sun Jul 12, 2009 9:32 pm     Reply with quote

good morning everyone!!
how do i write a code in CCS which performs the same routine that the btfsc (assembly language instruction in MICROCHIP) does?
thanks!! Very Happy Very Happy Very Happy
bungee-



Joined: 27 Jun 2007
Posts: 206

View user's profile Send private message

Re: btfsc instruction converted in CCS C
PostPosted: Sun Jul 12, 2009 11:19 pm     Reply with quote

horde_fuego wrote:
good morning everyone!!
how do i write a code in CCS which performs the same routine that the btfsc (assembly language instruction in MICROCHIP) does?
thanks!! Very Happy Very Happy Very Happy


Code:

#asm

btfsc ....

#endasm
Rolling Eyes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jul 12, 2009 11:43 pm     Reply with quote

You can generate that ASM instruction by calling the bit_test() function,
as shown below. Look at the .LST file.
Code:

#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)

//======================================
void main()
{
int8 value;
int8 result;

value = 0x55;

if(bit_test(value, 7) == 0)
   result = 0;
else
   result = 1;

while(1);
}

There is probably a CCS function for most things that you want to do.
Look at the list of Bit Manipulation functions on this page:
http://www.ccsinfo.com/content.php?page=compspecific#bit
Then look in the CCS manual or the Help File for more information.
http://www.ccsinfo.com/downloads/ccs_c_manual.pdf
horde_fuego



Joined: 31 Mar 2009
Posts: 11

View user's profile Send private message

PostPosted: Mon Jul 13, 2009 2:14 am     Reply with quote

To bungee and PCM programmer,
Thank you very much for the replies. This will surely help me in my program. Thanks a lot!!
Very Happy Very Happy Very Happy Very Happy


-horde
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

Re: btfsc instruction converted in CCS C
PostPosted: Mon Jul 13, 2009 6:25 am     Reply with quote

horde_fuego wrote:
...how do i write a code in CCS which performs the same routine that the btfsc ...


Often the "if(bit_test(x,y))" will compile to a single btfsc or btfss instruction.
_________________
Robert Scott
Real-Time Specialties
Embedded Systems Consulting
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group