Author |
Message |
Topic: PCM - How to tell if putc() will block |
gustnado
Replies: 3
Views: 7217
|
Forum: General CCS C Discussion Posted: Fri May 06, 2005 3:59 pm Subject: PCM - How to tell if putc() will block |
Because of a dumb mistake. I had tried TXSTA before without success but I suspect it was a syntactical screwup.
The following appears to work:
void sendChar(int c)
{
while( ... |
Topic: PCM - How to tell if putc() will block |
gustnado
Replies: 3
Views: 7217
|
Forum: General CCS C Discussion Posted: Fri May 06, 2005 3:24 pm Subject: PCM - How to tell if putc() will block |
I want a little snippet of code that will tell me if putc() will block before I call it (my application cannot afford to be hung up in a read or write).
I wrote one for the 18F452 in assembly:
... |
Topic: setjmp/longjmp or work-arounds |
gustnado
Replies: 20
Views: 26980
|
Forum: General CCS C Discussion Posted: Tue May 03, 2005 4:58 pm Subject: setjmp/longjmp or work-arounds |
That is true in the example, but not in the actual application, where the setjmp call is from the mainline and the longjmp call is from a few subroutines down from the mainline.
This is sure frust ... |
Topic: setjmp/longjmp or work-arounds |
gustnado
Replies: 20
Views: 26980
|
Forum: General CCS C Discussion Posted: Tue May 03, 2005 3:11 pm Subject: setjmp/longjmp or work-arounds |
Sigh. A friend reminds me that the code above should not work. longjmp must be at a call level below (or maybe the same) as the setjmp, not in another call tree. |
Topic: setjmp/longjmp or work-arounds |
gustnado
Replies: 20
Views: 26980
|
Forum: General CCS C Discussion Posted: Tue May 03, 2005 1:57 pm Subject: setjmp/longjmp or work-arounds |
I think it takes a complex program to fail. I believe I have created one, after analyzing the longjmp code, which fails to save the contents of the top of stack, only saving the stack pointer.
The ... |
Topic: setjmp/longjmp or work-arounds |
gustnado
Replies: 20
Views: 26980
|
Forum: General CCS C Discussion Posted: Tue May 03, 2005 12:40 pm Subject: setjmp/longjmp or work-arounds |
Yeah, I was afraid of that. I can't make a short program that fails! But the big one does. It is, of course, possible that the big one is clobbering the jump environment, but it is unlikely - I am not ... |
Topic: setjmp/longjmp or work-arounds |
gustnado
Replies: 20
Views: 26980
|
Forum: General CCS C Discussion Posted: Tue May 03, 2005 11:34 am Subject: setjmp/longjmp or work-arounds |
You are correct, although it is not in the expected location - the alphabetical list of functions with descriptions. I missed it because I was using the printed version of the same manual. Thanks for ... |
Topic: setjmp/longjmp or work-arounds |
gustnado
Replies: 20
Views: 26980
|
Forum: General CCS C Discussion Posted: Tue May 03, 2005 10:13 am Subject: setjmp/longjmp or work-arounds |
The example works fine in PCH/18F452, but in my application, where things are more complex and the longjmp takes place well down in a subroutine call hierarchy, it doesn't work right - it causes resta ... |
Topic: Symbol Definitions for assembler (or C for that matter) |
gustnado
Replies: 1
Views: 4510
|
Forum: General CCS C Discussion Posted: Sat Apr 30, 2005 2:51 pm Subject: Symbol Definitions for assembler (or C for that matter) |
I wanted to write my own version of putc in assembly language, and in fact did so. However, I only find two symbols in 18f452.h for the USART. Is there another include file with other symbols, or does ... |
Topic: pointers |
gustnado
Replies: 10
Views: 13537
|
Forum: General CCS C Discussion Posted: Mon Apr 25, 2005 1:01 pm Subject: pointers |
Oddly enough, in my tests, the series of printf's are shorter than the strcpy's. The following shows number of instruction words (in decimal):
printf strcpy
14 bit ... |
Topic: pointers |
gustnado
Replies: 10
Views: 13537
|
Forum: General CCS C Discussion Posted: Mon Apr 25, 2005 10:12 am Subject: pointers |
As a new PIC programmer, I understand that the Harvard architecture imposes limitations in this area.
If I wanted to do something like the following normal C code, what is the best way with PCH/PCM ... |
Topic: setjmp/longjmp or work-arounds |
gustnado
Replies: 20
Views: 26980
|
Forum: General CCS C Discussion Posted: Sun Apr 24, 2005 6:11 pm Subject: setjmp/longjmp or work-arounds |
Thanks. It looks like it should do the job, then. |
Topic: setjmp/longjmp or work-arounds |
gustnado
Replies: 20
Views: 26980
|
Forum: General CCS C Discussion Posted: Sun Apr 24, 2005 5:49 pm Subject: setjmp/longjmp or work-arounds |
FYI, I got the interrupt routine working, so no help needed.
It helps to read the data register with a "*" in front of the address of the input data fsf |
Topic: setjmp/longjmp or work-arounds |
gustnado
Replies: 20
Views: 26980
|
Forum: General CCS C Discussion Posted: Sun Apr 24, 2005 5:28 pm Subject: setjmp/longjmp or work-arounds |
I am running PCH Version 3.223.
I have no idea if longjmp/setjmp will work with PCM. If not, I've got a big problem. Unfortunately, I have no way to test it - all I have is a little test board that ... |
Topic: setjmp/longjmp or work-arounds |
gustnado
Replies: 20
Views: 26980
|
Forum: General CCS C Discussion Posted: Sun Apr 24, 2005 5:08 pm Subject: setjmp/longjmp or work-arounds |
I have it working okay on a 18F452.
It's in the middle of a bunch of code, so I'll just post snippets:
#include "setjmp.h"
jmp_buf set_jmp_env;
main() {
....
if(!setjmp(set_j ... |
|