Author |
Message |
Topic: SOLVED: ARM Code Porting Problems |
matthewsachs
Replies: 9
Views: 21337
|
Forum: General CCS C Discussion Posted: Fri Aug 21, 2020 4:10 pm Subject: SOLVED: ARM Code Porting Problems |
GREAt I like seeing
Jay this webpage where it comes from explains it a lot better than I can: https://mouha.be/chaskey/
It generates unique "signatures" based on a secret key and some p ... |
Topic: SOLVED: ARM Code Porting Problems |
matthewsachs
Replies: 9
Views: 21337
|
Forum: General CCS C Discussion Posted: Fri Aug 21, 2020 3:58 pm Subject: SOLVED: ARM Code Porting Problems |
I couldn't isolate the problem, so I basically rewrote everything from scratch. While it won't land me a job at Google, here is the working code in case anyone else needs to implement this functionali ... |
Topic: SOLVED: ARM Code Porting Problems |
matthewsachs
Replies: 9
Views: 21337
|
Forum: General CCS C Discussion Posted: Wed Aug 19, 2020 7:07 pm Subject: SOLVED: ARM Code Porting Problems |
Thanks guys
Jay, the ARM code used m and M which did "get me", so I changed m to mu.
PCM, I changed those two lines and it's still crashing. There is more going on in that function tha ... |
Topic: SOLVED: ARM Code Porting Problems |
matthewsachs
Replies: 9
Views: 21337
|
Forum: General CCS C Discussion Posted: Wed Aug 19, 2020 3:59 pm Subject: SOLVED: ARM Code Porting Problems |
I realize the purpose of this forum is not to teach rookies ANSI C, but I’ve spent days unsuccessfully trying to port some seemingly simple ARM code to a CCS PIC implementation and have no hair left ... |
Topic: Compiler Bug or Do I Need to Get Myself a Good C Book |
matthewsachs
Replies: 17
Views: 32389
|
Forum: General CCS C Discussion Posted: Sun Oct 27, 2019 5:21 pm Subject: Compiler Bug or Do I Need to Get Myself a Good C Book |
I would like to know how he is displaying the result. Is he using printf ?
Or a watch window with the ICD debugger ? Details on this are needed.
The board I am working on has an FTDI device so I ... |
Topic: Compiler Bug or Do I Need to Get Myself a Good C Book |
matthewsachs
Replies: 17
Views: 32389
|
Forum: General CCS C Discussion Posted: Sun Oct 27, 2019 1:48 pm Subject: Compiler Bug or Do I Need to Get Myself a Good C Book |
I'll post the code shortly.
I also thought it may be a case of the value getting corrupted, but the wrong values are not randomly (or ever) changing. For every unique ADC value I get the same uniqu ... |
Topic: Compiler Bug or Do I Need to Get Myself a Good C Book |
matthewsachs
Replies: 17
Views: 32389
|
Forum: General CCS C Discussion Posted: Sun Oct 27, 2019 11:29 am Subject: Compiler Bug or Do I Need to Get Myself a Good C Book |
I'd suggest:
if( ((ADCReading * 1000LL) > (int32)ScaleFactor) res/ =(int32)ScaleFactor);
It seems wasteful to cast a constant to int32. Just declare it as int32 (LL).
Also on a lot of compil ... |
Topic: Compiler Bug or Do I Need to Get Myself a Good C Book |
matthewsachs
Replies: 17
Views: 32389
|
Forum: General CCS C Discussion Posted: Sun Oct 27, 2019 11:21 am Subject: Compiler Bug or Do I Need to Get Myself a Good C Book |
Since you always zero 'res' at the beginning..
you 'might' get tighter code by doing this...
if( ((int32)(ADCReading)) * ((int32)(1000L)) > ((int32)(ScaleFactor))) res = res / ((int32)(ScaleFa ... |
Topic: Compiler Bug or Do I Need to Get Myself a Good C Book |
matthewsachs
Replies: 17
Views: 32389
|
Forum: General CCS C Discussion Posted: Sun Oct 27, 2019 11:12 am Subject: Compiler Bug or Do I Need to Get Myself a Good C Book |
Deleting the old compiler (PICC folder and all) and re-installing a fresh version of 5.090 did NOT solve the problem.
Not a big deal as I have a workaround, but I would love to find out the root ca ... |
Topic: Compiler Bug or Do I Need to Get Myself a Good C Book |
matthewsachs
Replies: 17
Views: 32389
|
Forum: General CCS C Discussion Posted: Sun Oct 27, 2019 8:23 am Subject: Compiler Bug or Do I Need to Get Myself a Good C Book |
I'm wondering if we have a similar issue to the one we had just a few
threads ago, with the install having an old DLL somehow (multiple compilers
or something not cleaned away in the install). It wa ... |
Topic: Compiler Bug or Do I Need to Get Myself a Good C Book |
matthewsachs
Replies: 17
Views: 32389
|
Forum: General CCS C Discussion Posted: Sun Oct 27, 2019 8:22 am Subject: Compiler Bug or Do I Need to Get Myself a Good C Book |
Thanks PCM.
This is more along the lines how this is used in my application:
#include <18F66K80.h>
#device adc=12
#use delay(internal=4M)
#use rs232(baud=9600, UART1, ERRORS ... |
Topic: Compiler Bug or Do I Need to Get Myself a Good C Book |
matthewsachs
Replies: 17
Views: 32389
|
Forum: General CCS C Discussion Posted: Sun Oct 27, 2019 7:26 am Subject: Compiler Bug or Do I Need to Get Myself a Good C Book |
#include <18F66K80.h>
#device adc=12
With the function implemented using 2 casts:
ADCtoFLOW(8, 7371) -> returned 7936 (instead of 1 expected)
ADCtoFLOW(2265, 7371) -> returned 3660 ... |
Topic: Compiler Bug or Do I Need to Get Myself a Good C Book |
matthewsachs
Replies: 17
Views: 32389
|
Forum: General CCS C Discussion Posted: Sat Oct 26, 2019 11:56 pm Subject: Compiler Bug or Do I Need to Get Myself a Good C Book |
PCWH v5.090
I spent hours tracking down this bug.
The original function looked like this:
int16 ADCtoFLOW(int16 ADCReading, int16 ScaleFactor)
{
int32 res = 0L;
r ... |
Topic: PIC18F66K80 CAN Rx Interrupt Not Working |
matthewsachs
Replies: 6
Views: 15068
|
Forum: General CCS C Discussion Posted: Mon Apr 23, 2018 10:51 am Subject: PIC18F66K80 CAN Rx Interrupt Not Working |
So I looked over the datasheet and noticed that RXBnIF behaves differently depending on what mode ECAN is configured for.
When the receive interrupt is enabled, an interrupt will
be generated when ... |
Topic: PIC18F66K80 CAN Rx Interrupt Not Working |
matthewsachs
Replies: 6
Views: 15068
|
Forum: General CCS C Discussion Posted: Mon Apr 23, 2018 10:23 am Subject: PIC18F66K80 CAN Rx Interrupt Not Working |
I assume that implies analyzing the CCS' #include <can-18F4580.c> file, which I will go and do right away. |
|