Author |
Message |
Topic: Union + Structure = me go crazy |
RayJones
Replies: 6
Views: 9128
|
Forum: General CCS C Discussion Posted: Sun Dec 26, 2010 2:15 pm Subject: Union + Structure = me go crazy |
The big potential problem I see is the use of a bit field within a structure, within the union.
Have you tried looking at the generated ASM for the various types of access methods?
Does it look ... |
Topic: Issue with <= statement |
RayJones
Replies: 4
Views: 5598
|
Forum: General CCS C Discussion Posted: Sun Dec 26, 2010 2:05 pm Subject: Issue with <= statement |
I think more importantly you should only be reading the timer value once, and work from the stored value in your timer test routine.
The way I am reading the code in the source as published is you ... |
Topic: How can I divide a 16 bit value into 8 bit values? |
RayJones
Replies: 5
Views: 6010
|
Forum: General CCS C Discussion Posted: Sat Dec 04, 2010 3:08 pm Subject: How can I divide a 16 bit value into 8 bit values? |
I couldn't get any result from your link. Could you write a sample about it?
Huh?
There is an example right there in the link.
As suggested by others, learn the language and you will see how it ... |
Topic: How can I divide a 16 bit value into 8 bit values? |
RayJones
Replies: 5
Views: 6010
|
Forum: General CCS C Discussion Posted: Sat Dec 04, 2010 1:37 am Subject: How can I divide a 16 bit value into 8 bit values? |
My favorite method is to use a structure/union approach.
You can use the inbuilt macro functions to do it, but I simply like the elegance of reading or writing a value directly from/to where it is ... |
Topic: How to convert two hex values into a 16 bit representation. |
RayJones
Replies: 6
Views: 6990
|
Forum: General CCS C Discussion Posted: Mon Apr 20, 2009 2:38 am Subject: Union with a structure - elegant and efficient |
I responded to another poster with a similar question a while back.
After playing around with various methods in the compiler, I found if you define a union, holding a int16 and a structure with tw ... |
Topic: String compare problem... |
RayJones
Replies: 7
Views: 8413
|
Forum: General CCS C Discussion Posted: Sun Nov 23, 2008 2:53 am Subject: String compare problem... |
simplest method is to delimit your strings by converting all control characters (< 0x20) to nulls.
Then simply search for "OK" and forget about CR LF etc.
Ray |
Topic: HW & SW rs232 baudrate error? |
RayJones
Replies: 7
Views: 6251
|
Forum: General CCS C Discussion Posted: Sat Nov 22, 2008 10:24 pm Subject: HW & SW rs232 baudrate error? |
I have experienced problems with occasional corrupt character, as described here http://www.ccsinfo.com/forum/viewtopic.php?t=35733.
But your corruption really looks like the bit rate is not being ... |
Topic: HW & SW rs232 baudrate error? |
RayJones
Replies: 7
Views: 6251
|
Forum: General CCS C Discussion Posted: Sat Nov 22, 2008 8:15 pm Subject: HW & SW rs232 baudrate error? |
Is this a simple human interactive test program?
The reason I ask is you are responding with 8 characters for a single received character.
You are certain to have a rx overrun since both ports a ... |
Topic: String compare problem... |
RayJones
Replies: 7
Views: 8413
|
Forum: General CCS C Discussion Posted: Sun Oct 19, 2008 2:56 am Subject: String compare problem... |
Also, fgets will return once it sees the \r. You won't get to see the \n.
It is possible the \r is also replaces with a \0, and you wont even see the \r
Ray |
Topic: String compare problem... |
RayJones
Replies: 7
Views: 8413
|
Forum: General CCS C Discussion Posted: Sun Oct 19, 2008 2:53 am Subject: String compare problem... |
Your parameter order is backwards in strcpy!
Ray |
Topic: Strange behavior while receiving serial port |
RayJones
Replies: 8
Views: 8656
|
Forum: General CCS C Discussion Posted: Sat Oct 18, 2008 3:22 pm Subject: Strange behavior while receiving serial port |
Hello Jacob.
I am somewhat confused. You have ERRORS in the code you have pasted, and you say it works OK???
HOWEVER, you have totally refactored the way you talk to the modem.
You are now us ... |
Topic: Strange behavior while receiving serial port |
RayJones
Replies: 8
Views: 8656
|
Forum: General CCS C Discussion Posted: Fri Oct 17, 2008 6:03 pm Subject: Strange behavior while receiving serial port |
If you chat with the modem using the PC, I presume you get the correct responses?
Next thing I'd be trying is to add the ERRORS directive to your #use RS232, especially since you are not reading re ... |
Topic: Strange behavior while receiving serial port |
RayJones
Replies: 8
Views: 8656
|
Forum: General CCS C Discussion Posted: Fri Oct 17, 2008 5:56 pm Subject: Strange behavior while receiving serial port |
No,
\r = CR
\n = LF
r = Return
n = NewLine
These hark back from the days when a carriage Return did exactly that, it returned the carriage holding the type keys on teleprinters to the left ... |
Topic: Strange behavior while receiving serial port |
RayJones
Replies: 8
Views: 8656
|
Forum: General CCS C Discussion Posted: Fri Oct 17, 2008 4:17 pm Subject: Strange behavior while receiving serial port |
Doesn't help with your problem, but why do you use
fprintf(pc,"at+cmgf=1%c", 0xD);
When
fprintf(pc,"at+cmgf=1\r");
is far easier to read, and le ... |
Topic: Bit shifting by 12 produces error |
RayJones
Replies: 5
Views: 5556
|
Forum: General CCS C Discussion Posted: Thu Oct 09, 2008 3:15 pm Subject: Bit shifting by 12 produces error |
To increase efficiency, forget about performing bit shifts more than 8 bits, especially if you don't need to preserve the carrys.
The PIC can only ever read/write 8 bit values.
16 bit values are ... |
|