Author |
Message |
Topic: local & global variables |
planet69
Replies: 6
Views: 9010
|
Forum: General CCS C Discussion Posted: Tue Nov 09, 2010 9:58 pm Subject: local & global variables |
Appreciate the feedback. enlightening.
Anyway, I've done some pretty large programs but always with some RAM to spare.
I guess my 'large programs' are not that 'large' after all.
Th ... |
Topic: local & global variables |
planet69
Replies: 6
Views: 9010
|
Forum: General CCS C Discussion Posted: Mon Nov 08, 2010 9:27 pm Subject: local & global variables |
Why do we need to have separate local & global variables.
I've completed several programs without ever declaring any local variables and everything as globals.
I avoid any 'conflict' that may ... |
Topic: unable to declare a function |
planet69
Replies: 3
Views: 4840
|
Forum: General CCS C Discussion Posted: Wed Nov 03, 2010 2:23 am Subject: unable to declare a function |
thanks |
Topic: unable to declare a function |
planet69
Replies: 3
Views: 4840
|
Forum: General CCS C Discussion Posted: Tue Nov 02, 2010 9:04 pm Subject: unable to declare a function |
I'm using PCH v4.084.
Declaring the below function gives an error: "Expecting a basic type"
void buzzer_off (void);
Able to compile if I put it any other way
void buzzeroff ... |
Topic: divide by 10 |
planet69
Replies: 11
Views: 9120
|
Forum: General CCS C Discussion Posted: Wed Sep 08, 2010 7:34 pm Subject: divide by 10 |
Wouldn't
remainder = numerator - (quotient * 10);
work faster as
remainder = numerator - (quotient * 8 + quotient * 2);
?
actually (quotient * 10) is few instr ... |
Topic: divide by 10 |
planet69
Replies: 11
Views: 9120
|
Forum: General CCS C Discussion Posted: Wed Sep 08, 2010 12:05 pm Subject: Re: divide by 10 |
This annoys me greatly too, and I haven't found a solution. It's even more annoying when you analyse the generated code and find that they're identical, apart from where the two values are retrieved ... |
Topic: divide by 10 |
planet69
Replies: 11
Views: 9120
|
Forum: General CCS C Discussion Posted: Wed Sep 08, 2010 3:50 am Subject: divide by 10 |
thanks PCM p. & Ttelmah
using mplab sim, i'm putting the codes into test.
i find that:
quotient = numerator / 10;
remainder = numerator % 10;
chows down approx. 195 instruction cycles and ... |
Topic: divide by 10 |
planet69
Replies: 11
Views: 9120
|
Forum: General CCS C Discussion Posted: Tue Sep 07, 2010 8:17 pm Subject: divide by 10 |
Please show me a simpler way of implementing:
int8 quotient;
int8 remainder;
int8 numerator;
quotient = numerator / 10;
remainder = numerator % 10;
The two line generates an awful lot of a ... |
|