Author |
Message |
Topic: Function returns wrong value - fixed by declaring unused int |
Ken Johnson
Replies: 21
Views: 18898
|
Forum: General CCS C Discussion Posted: Thu Feb 24, 2011 8:51 am Subject: Function returns wrong value - fixed by declaring unused int |
I have been very happy with Microchip's compilers for our PIC18 and PIC24 projects (and with MPLAB). Of course there is a learning curve, and you lose the peripheral setup features that CCS provides. ... |
Topic: Problem understanding why my interrupt isn't working |
Ken Johnson
Replies: 14
Views: 19547
|
Forum: General CCS C Discussion Posted: Mon Jan 17, 2011 8:26 am Subject: Problem understanding why my interrupt isn't working |
One thing I have done in the past that works well is to set an unused bit high at the start of the ISR then clear it at the end of the ISR - makes it very easy to see just how much of your total time ... |
Topic: icd-u64 |
Ken Johnson
Replies: 6
Views: 7955
|
Forum: General CCS C Discussion Posted: Tue Jan 04, 2011 1:15 pm Subject: icd-u64 |
There are notches in the sides of the case. Using a flat-blade screwdriver, pry the case apart at the seams - it just snaps together.
Ken |
Topic: Simple tempo routine => Glitch |
Ken Johnson
Replies: 3
Views: 4903
|
Forum: General CCS C Discussion Posted: Tue Oct 05, 2010 12:37 pm Subject: Simple tempo routine => Glitch |
Ummm . . .
how about just always
DiffTmr = NewTmr-OldTmr;
This always gives the correct result, even after an overflow.
Ken |
Topic: Writing to a standard 20x2 lcd: How fast can it display ? |
Ken Johnson
Replies: 16
Views: 18819
|
Forum: General CCS C Discussion Posted: Thu Sep 30, 2010 12:20 pm Subject: Writing to a standard 20x2 lcd: How fast can it display ? |
Just a little more . . .
Yes, read the encoder as fast as required (sounds like you are).
But, update the display at a rate that is comfortable to the human observer. That is probably no more t ... |
Topic: More ICD-U64 Weirdness |
Ken Johnson
Replies: 2
Views: 4495
|
Forum: General CCS C Discussion Posted: Wed Sep 22, 2010 9:46 am Subject: More ICD-U64 Weirdness |
Using CCSLoad and ICD-U64, I do one of three things to run:
unplug the ICD
click "Run Target" in CCSLoad
exit CCSLoad
Does this help any?
Ken |
Topic: i am having doubt in sizeof(arrayname[])/sizeof(datatype) |
Ken Johnson
Replies: 4
Views: 8020
|
Forum: General CCS C Discussion Posted: Wed Aug 25, 2010 12:04 pm Subject: i am having doubt in sizeof(arrayname[])/sizeof(datatype) |
I use this macro:
#define nElements(array) (sizeof(array) / sizeof(array[0]))
Ken |
Topic: why delay function disables interrupts? |
Ken Johnson
Replies: 17
Views: 25745
|
Forum: General CCS C Discussion Posted: Wed Jun 09, 2010 1:31 pm Subject: why delay function disables interrupts? |
Yes, but this is the bit-time, not the character time.
There are 10 bits per character (8 data, 1 start, 1 stop), so the char time is 1.04 msec; X 3.5 is 3.65 msec
Anyway, how is your project co ... |
Topic: why delay function disables interrupts? |
Ken Johnson
Replies: 17
Views: 25745
|
Forum: General CCS C Discussion Posted: Tue Jun 08, 2010 8:55 am Subject: why delay function disables interrupts? |
delay_us(3500000/MODBUS_SERIAL_BAUD); //3.5 character delay
This is my longest delay routine in interrupt. it is 364uS (9600baud)
This bothers me . . .
3.5 characters at 9600 baud is 3.64 msec, ... |
Topic: Data type conversion question |
Ken Johnson
Replies: 7
Views: 10759
|
Forum: General CCS C Discussion Posted: Wed May 12, 2010 2:22 pm Subject: Data type conversion question |
One more note:
Your "int function" will take the float error, truncate it, and return whatever fits in an "int" - CCS int is an 8-bit unsigned thingy, as I recall
Ken |
Topic: bye for now. |
Ken Johnson
Replies: 13
Views: 10300
|
Forum: General CCS C Discussion Posted: Sun Dec 20, 2009 9:08 am Subject: bye for now. |
I scan this forum frequently, both for new ideas and good ol' general education - wish I could contribute more
So, thank you triet, and many many others. Add hope you enjoy your new endeavors !
... |
Topic: H4 vs HS |
Ken Johnson
Replies: 17
Views: 13638
|
Forum: General CCS C Discussion Posted: Sun Dec 20, 2009 9:01 am Subject: H4 vs HS |
This would have no impact on a "blinking led test", but . . .
Check the timing requirements for the lcd enable or write pulses; at 40 MHz the pulse may be too fast for the lcd ? ? ?
Ke ... |
Topic: macro syntax to set parameters that must be constants? |
Ken Johnson
Replies: 2
Views: 3917
|
Forum: General CCS C Discussion Posted: Sun Dec 06, 2009 1:29 pm Subject: macro syntax to set parameters that must be constants? |
While reading your 1st post, my mind suggested a switch.
Sounds like you've got it!
Ken |
Topic: How do I convert float to Int or long? |
Ken Johnson
Replies: 3
Views: 9245
|
Forum: General CCS C Discussion Posted: Wed Nov 25, 2009 7:54 am Subject: How do I convert float to Int or long? |
Depending on your needs, you may want to round up when doing this, e.g.
myval = (int) (test + 0.5);
But, consider the impact when test is negative!
Ken |
Topic: Faster computations |
Ken Johnson
Replies: 5
Views: 4180
|
Forum: General CCS C Discussion Posted: Wed Nov 11, 2009 3:04 pm Subject: Faster computations |
Your are right, you must divide (somehow).
However, the compiler will compute (x * y) for you - you don't have to explicitly do that.
Ken |
|