I've used the code I suggested, it seems to work. I have 27 bytes of ROM left!
Type: Posts; User: nigelmercier
I've used the code I suggested, it seems to work. I have 27 bytes of ROM left!
Thanks for the replies. A few points:
The "number" is always positive.
I've already written the code to parse the NMEA string. It does it on the fly, extracting each field into a short string...
First of all, this is not homework; I'm "fifty-eleven" :)
I'm working on a microcontroller project and I need to convert a string (from a NMEA GPS receiver) into a float, I have very limited...
Just a follow up, I had to use the code below, must be my compiler...
bar = (float)(foo1) / (float)(foo2);
I've got a one dimensional array of strings (so actually a two dimensional array) declared as follows:
// Global Constants (text)
const char ErrTab[2][15] = {{"<WIRING SHORT>"}, {"<WIRING...
Yup, you are right.
Thank you, I thought I had tried that, but now it works. Weird!
I'm tearing my hair out (again). This time I will simplify:
unsigned short foo1 = 31 ;
unsigned short foo2 = 49 ;
float bar ;
bar = foo1/foo2 ; // I get zero. I want the result to be 0.633......
Although this needs to be:
if (whatever)
{
foo(TSAft ...);
}
else
{
foo(TLFwd ... );
Hi Jim,
I've looked into this and I really do need to set pointers to the arrays, for the sake of reducing code duplication. I assume this is still possible, although not necessary?
So no * or & prefixes? Or pointer declarations?
I had expected to have to set up some pointers before making the call in code common to both paths, but I guess I can have one call for each switch...
I've just cobbled together what I want to do as far as passing the pointers is concerned, but I also need help with the other stuff ...
while (1)
{ // infinite loop driven by interrupts
...
I need some help with pointers, for some reason I can't get my head around them. I've got two pairs of arrays and associated values defined thus. Note "byte" is short integer, and yes you may have...
So you are suggesting I find the entries either side? I'm not sure how that would work. I could easily hard code it with a switch of course, but not very elegant.
Other points:
There are...
I'm building a water level gauge for my boat, so I'm writing code for a PIC microcontroller with an ADC port connected to a resistive sensor. The references below to getting single bytes is due to...
Yes, some time ago, and it got a bit messy.
Compiler and IDE are mikroC PRO for PIC
Thanks, but I think I'm more confused now :)
So more than one .h file then? I think I need a book.
All the books I have read on C seem to lump everything into a single file, I guess this is because they are relatively short examples. Is there a C Style Guide somewhere that can advise with the...
All sorted, see here
It's the same as the sample I gave at the start of the thread:
const char FONTTABLE[96][5]=
{
{0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x5f,0x00,0x00},
{0x00,0x07,0x00,0x07,0x00},
/**...
Oh dear, I thought I was winning for a moment. Here is my equivalent code:
void charLcd(unsigned char character) // Send any # of bytes to LCD
{
int tablept; // pointer in table - i in...
What I meant was, do I have to pass the size, or can I find in in the called function?
Thanks, but I didn't understand this bit:
void print(const char *data, size_t size) {
size_t x;
It seems to have a type size_t - is that right?
OK, lets say I've calculated elsewhere that I need the data in row i. Now I want to pass this row (a one-dimensional array) to another function. In this function I need to (say) iterate through the...