Author |
Message |
Topic: how to send and receive float for serial communication? |
Gavin Pinto
Replies: 7
Views: 19862
|
Forum: General CCS C Discussion Posted: Thu Apr 08, 2010 10:50 pm Subject: how to send and receive float for serial communication? |
Add one more comment to this thread.
In CCS C (for the PIC 12/16/18), the format of FP numbers in memory, is different from the IEEE format used inside a PC.
The file 'ieeefloat.c', contains two rou ... |
Topic: how to convert float to int16? |
Gavin Pinto
Replies: 4
Views: 28299
|
Forum: General CCS C Discussion Posted: Mon Mar 15, 2010 6:09 pm Subject: how to convert float to int16? |
In addition I will show how float is stored. It is stored with 32 bits in memory.
Now look at my demonstration below
Example 1
int buff[10];
int32 *fp;
float F =123.45;
fp = &F;
i ... |
Topic: how to convert float to int16? |
Gavin Pinto
Replies: 4
Views: 28299
|
Forum: General CCS C Discussion Posted: Sun Mar 14, 2010 9:55 pm Subject: how to convert float to int16? |
What is wrong with the obvious:
long L;
float F = 12345.6;
L = F;
Should leave L = 12345
int16 i;
Cast it
i=(int16)F; |
Topic: enum musings |
Gavin Pinto
Replies: 4
Views: 7213
|
Forum: General CCS C Discussion Posted: Wed Mar 03, 2010 6:38 am Subject: enum musings |
Octal representation begins with a 0 not an O
True. Thanks
A Typo I tested it with 0 not O. I have corrected listing above |
Topic: enum musings |
Gavin Pinto
Replies: 4
Views: 7213
|
Forum: General CCS C Discussion Posted: Wed Mar 03, 2010 6:06 am Subject: enum musings |
compiler version PCH 4.104 |
Topic: enum musings |
Gavin Pinto
Replies: 4
Views: 7213
|
Forum: General CCS C Discussion Posted: Tue Mar 02, 2010 9:27 pm Subject: enum musings |
You might look at this ccs thread and ask many questions
https://www.ccsinfo.com/forum/viewtopic.php?t=23400
Now I will show some interesting enum statements that compile with ccs.
1. ... |
Topic: simple questions |
Gavin Pinto
Replies: 17
Views: 15931
|
Forum: General CCS C Discussion Posted: Tue Mar 02, 2010 4:41 pm Subject: simple questions |
You might look at this ccs thread and ask many questions
https://www.ccsinfo.com/forum/viewtopic.php?t=23400
Now I will show some interesting enum statements that compile with ccs.
1. enum{u, ... |
Topic: simple questions |
Gavin Pinto
Replies: 17
Views: 15931
|
Forum: General CCS C Discussion Posted: Thu Feb 25, 2010 4:30 am Subject: simple questions |
But this thread is about the line:-
#define test 0x42
Either, the poster doesn't know much about C so describing the ins and outs of lvalues and const's isn't going to help or John P post is co ... |
Topic: simple questions |
Gavin Pinto
Replies: 17
Views: 15931
|
Forum: General CCS C Discussion Posted: Wed Feb 24, 2010 4:15 pm Subject: simple questions |
Non-modifiable lvalues vs. rvalues (see below for defination)
The crux of the problem with constant objects is that, while an enumeration constant is an rvalue, a constant object is a non-modifiabl ... |
Topic: simple questions |
Gavin Pinto
Replies: 17
Views: 15931
|
Forum: General CCS C Discussion Posted: Wed Feb 24, 2010 3:37 am Subject: simple questions |
Using const and rom takes up space and can add extra processing
"const" construct, on the other hand, does all the type checking that the compiler does, so if you do something that's out ... |
Topic: simple questions |
Gavin Pinto
Replies: 17
Views: 15931
|
Forum: General CCS C Discussion Posted: Wed Feb 24, 2010 2:16 am Subject: Re: simple questions |
What does it mean this line? 0x42?
#define test 0x42
Tks a lot
Nina Pretty Ballerina,
My preferred way of doing things when dealing with values or numbers or instead of always using th ... |
Topic: Question on const char arrays - please help!!! |
Gavin Pinto
Replies: 3
Views: 4913
|
Forum: General CCS C Discussion Posted: Sun Feb 21, 2010 6:05 pm Subject: Re: Question on const char arrays - please help!!! |
hello.
what i don't right do
CONST char TEXT_KSW[]="ÊÑÂ";
CONST char TEXT_POWER[]="ÌÎÙÍÎÑÒÜ";
CONST char TEXT_P_KONTUR[]="Ï-ÊÎÍ ... |
Topic: Errors in the CCS Webpage code |
Gavin Pinto
Replies: 21
Views: 17601
|
Forum: General CCS C Discussion Posted: Tue Feb 16, 2010 12:06 pm Subject: Errors in the CCS Webpage code |
edit - I just noticed your last statement. Why do you think a rom pointer for a PIC18F8722 is 4 bytes ?
I do not think it is 4 bytes. I know it is 4 bytes because the program space is 128K bytes. ... |
Topic: Errors in the CCS Webpage code |
Gavin Pinto
Replies: 21
Views: 17601
|
Forum: General CCS C Discussion Posted: Mon Feb 15, 2010 10:08 pm Subject: Errors in the CCS Webpage code |
....
I would do it differently and report a problem to CCS.
well it should report 16/4 =4. Dont you think so?
sizeof(strings) = 16;
sizeof(rom char*) = 4;
My device is PIC18F8722 so the ... |
Topic: Errors in the CCS Webpage code |
Gavin Pinto
Replies: 21
Views: 17601
|
Forum: General CCS C Discussion Posted: Wed Feb 10, 2010 4:52 pm Subject: Errors in the CCS Webpage code |
Well, my compiler works differently to yours.
Or did you work it out some other way ?
So whose compiler is doing the right thing? |
|