View previous topic :: View next topic |
Author |
Message |
horde_fuego
Joined: 31 Mar 2009 Posts: 11
|
btfsc instruction converted in CCS C |
Posted: Sun Jul 12, 2009 9:32 pm |
|
|
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!! |
|
|
bungee-
Joined: 27 Jun 2007 Posts: 206
|
Re: btfsc instruction converted in CCS C |
Posted: Sun Jul 12, 2009 11:19 pm |
|
|
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!! |
Code: |
#asm
btfsc ....
#endasm
| |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jul 12, 2009 11:43 pm |
|
|
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
|
|
Posted: Mon Jul 13, 2009 2:14 am |
|
|
To bungee and PCM programmer,
Thank you very much for the replies. This will surely help me in my program. Thanks a lot!!
-horde |
|
|
RLScott
Joined: 10 Jul 2007 Posts: 465
|
Re: btfsc instruction converted in CCS C |
Posted: Mon Jul 13, 2009 6:25 am |
|
|
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 |
|
|
|