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 support@ccsinfo.com

questions about CCS variables

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







questions about CCS variables
PostPosted: Sat Nov 01, 2008 2:13 am     Reply with quote

Hi all,

I´ll really appreciate than somebody help with this questions:

1-what´s the difference between int8 and byte.
2-is there any built in function that convert to hex form (in fact, I´ll use a procedure that deals with hex, however my variables are bytes, what should I do ?)
3-I sent an integer using bputc() and receive it with bputc(), what is its received type?
Code:

r=bgetc()  // integer ??
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sat Nov 01, 2008 2:45 am     Reply with quote

BYTE is defined as int alias (which by default means int8) in CCS C header files. In case insensitive mode, you can also write byte. In other words, int8 and byte are identical.

I don't understand what you mean with hex form. Hex, in my understanding is one of several formats that can be used to print (read and write) numbers. You usually generate hex representation by printf() respectively sprintf() function. putc() simply sends one character to the interface. bputc() acually isn't a standard function rather than a function name used in a particular CCS programming example.

Sometimes two-digit numbers are BCD-coded to a byte, e.g. when interfacing real time clocks. In this case, the hex printout of the byte is identical to the coded number, e.g. 0x11 means 11th hour.
Dune
Guest







PostPosted: Sat Nov 01, 2008 6:36 am     Reply with quote

hi FvM,

thank you for answers,

to clarify my second question:

suppose this code:

Code:

int a

a=getc()


are
Code:
if (a==0x01)

{ //do somthing}


and

Code:

if (a==1)

{ //do somthing}


the same ?
dbotkin



Joined: 08 Sep 2003
Posts: 197
Location: Omaha NE USA

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Sat Nov 01, 2008 7:10 am     Reply with quote

Yes, exactly the same. So is
Code:
if (a==0b00000001)

{ //do somthing}


and, I think,
Code:
if (a=='\001')

{ //do somthing}


though I've never tried using octal.
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