My compiler doesn't recognize size_t as a variable type, and it gives me this warning:
warning: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
warning: incompatible...
Type: Posts; User: danlee58
My compiler doesn't recognize size_t as a variable type, and it gives me this warning:
warning: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
warning: incompatible...
This is NOT an assignment. This is for a real piece of hardware. I understand the code that nonpuz posted, and I use similar code in other sections of this program.
nonpuz,
Thanks for your help. I have already made a change to the second if condition. I changed 'return (p);' to 'return (RANGE_ARRAY[p]);'. I have tested it in a static condition and it returns...
I found one mistake and fixed it.
int POLL (int *RANGE_ARRAY) {
int d = 0;
int e = 0;
int f = 0;
int g = 0;
I didn't say it is correct, I said it compiles. I have to download it into my equipment, which is out in the cold, to test it.
The integers are [0, 7].
This is the way I came up with to do the...
I want to find the value occurs most in an 8 integer array. Here is the code that I have. It does compile, but has not been tested.
int POLL (int *RANGE_ARRAY) {
int d = 0;
int e =...
It's only supposed to jump as TPS_INDEX changes, but it changes when TPS_INDEX is steady.
I got an answer to my question. I don't need a break or default after the last case. My Switch/Case code...
It's an Infinite Loop. It tests TPS_INDEX against different tables, based on INDEX, and changes INDEX based on the results of the test. It's a basic Elevator program, where INDEX is the current...
I hope that this is better!
int INDEX = 1;
While(1) {
Sorry, I copied it from Notepad++.
All the indentations got messed up. Notepad++ tracks the brackets.
I'll try to repost it with indentations.
This program seems to jump between cases without any reason.
INDEX = 1;
While(1) {
Excuse me for jumping into this thread, but I have a problem with a Switch/Case. I have a while loop, but the code seems to jump between cases without any reason.
Do you need the last break at the...
This code used to work properly, but in editing it to fix something else, that initialize statement must have been deleted.
grumpy,
Thanks!
I think that you have found the problem, in spite of me not showing enough of the code. I neglected to Initialize i. i is used in several other similar routines, and is initialized...
I have a 10 term array that I use as a lookup table.
const int array[10] (0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
This is the routine that I call to get a number from that table.
int LOOKUP (int...
You are right, and I have considered that myself, but I like to see the active code on one screen or page, so I don't have to jump back & forth while reading the code.
The code that I posted is...
I don't have a debugger. I have to compile & test the code on the hardware. I use 'printf' to debug.
I also don't have an editor that will track (, and ) or {. and }.
I think that I see a problem here:
case 4:
if (A < E) //Do something }
break;
case...
When I say that it gets lost, I mean that the hardware doesn't switch to the proper state, based on the input conditions. It starts out right, but when it gets to case 2 under case 4 it doesn't...
I have a control program that uses a nested Switch Statement. It gets lost while executing the second Switch.
The code looks like this:
int A;
int B = x; //B, C, D and E are constants...
The ROM size is 32K. I am whittling away a what was > 1K more than the 32K. I asked the question to get some insight into the best way to code these decision blocks. They may not seem like much, but...
I am working on a program where the code exceeds the ROM space by ~1K. I'm trying to reduce the size of my program.
There is a lot of code that checks the state of a binary Flag.
int flag =...
I did Google it myself, but none of the sites that came up actually defined it.
Thanks Mats, I understand it's function is to convert a 32 bit Signed Integer to Double Precision Floating Point.
...
When I compile a C program that I am working on, the .lst file shows some routines that I am not familiar with. One of these is __floatsidf.
What does this routine do, and why do I need it in my...
OK, that's it. I was passing a volatile integer to a non-volatile pointer. It's working now. Thanks.