Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Logger Shield and Negative Numbers
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Logger Shield and Negative Numbers

by fat16lib on Mon Jun 14, 2010 10:12 am

No, you only get packet[0] through packet[18] for
Code: Select all | TOGGLE FULL SIZE
 int packet[19];

using packet[19] will overwrite something.
fat16lib
 
Posts: 593
Joined: Wed Dec 24, 2008 1:54 pm

Re: Logger Shield and Negative Numbers

by adafruit_support_bill on Mon Jun 14, 2010 10:15 am

Array indexing is zero-relative. Sizing is not.

A one byte array is: byte array[1]
The first byte of it is: array[0]

adafruit_support_bill
 
Posts: 78735
Joined: Sat Feb 07, 2009 10:11 am

Re: Logger Shield and Negative Numbers

by Volkemon on Mon Jun 14, 2010 10:30 am

Ya beat me to the next question, Arduwino :)
Livin' , learnin' , lovin' and laffin'. Thanks for the help!
Image
User avatar
Volkemon
 
Posts: 127
Joined: Mon May 10, 2010 8:24 pm
Location: Melbourne FL USA

Re: Logger Shield and Negative Numbers

by Volkemon on Mon Jun 14, 2010 10:41 am

OK, I have to do "Monday Lunch with Mom" and will be back.

Commenting out the '#include <Wire.h> ' and 'Wire.begin(); ' everything works perfectly.

Enable them, the serial monitor starts to lose it. Stops printing many of the ("xxx") items.

SD card data still going on correctly, however.

Be back around 1230 HRS EDT.


:D THANKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :D
Livin' , learnin' , lovin' and laffin'. Thanks for the help!
Image
User avatar
Volkemon
 
Posts: 127
Joined: Mon May 10, 2010 8:24 pm
Location: Melbourne FL USA

Re: Logger Shield and Negative Numbers

by Volkemon on Mon Jun 14, 2010 3:25 pm

Once again, I am horribly off topic...in my own post!!! The negative # problem is long solved.... :roll:

and it appears that there is a distinct conflict with the Wire library and my process.

Put the XBee on pins 2 and 3 using SoftwareSerial. Nice not to have to flick the switch to upload...and now the data stream coming into the serial monitor is nice and smooth. Accepts either of the two sending XBee's by chance for now, whichever one happens to be transmitting when I call for a mySerial.read(). I will be adding something to wait for the desired one, and toggles back and forth between them.

BUT.. for now, including the Wire library causes no problems. BUT, enabling it, Wire.begin(); , and the serial output to the monitor, and to the LCD both are affected.

Not a RAM issue, as I have that monitored in the serial window. Never below 800.

I am going to delete all traces of the Wire library, and do a fresh install. Besides deleting the Wire folder in Libraries, is there any other things I should delete? I have recollections of a " .o " (or sumptin..) file that was mentioned in the deletion and reloading of other libraries.
Livin' , learnin' , lovin' and laffin'. Thanks for the help!
Image
User avatar
Volkemon
 
Posts: 127
Joined: Mon May 10, 2010 8:24 pm
Location: Melbourne FL USA

Re: Logger Shield and Negative Numbers

by Volkemon on Mon Jun 14, 2010 4:59 pm

OK, Wire is a part of the Arduino environment. So... time to upgrade. I was on 17, now 18.

And 'Wadda you know'... It works perfectly!

The '0' entries before the TMP36 are correct- those are the grounded inputs. I ordered 10 more TMP36's today to fill the void. The one reading -31 might be a hardware fault. I have been opening and closing that box often reseting sample times.

Serial Monitor:
Image

SD card Data:

Image

and the LCD display, :)

Image

Not the end of the project, but rolling along again.

Now I see the value in asking : Are you using the latest version?

But MANY good lessons were learned in the process. Back to the real job in 12 hours...


HUGE THANKS to fat16lib. Above and beyond.
Livin' , learnin' , lovin' and laffin'. Thanks for the help!
Image
User avatar
Volkemon
 
Posts: 127
Joined: Mon May 10, 2010 8:24 pm
Location: Melbourne FL USA

Re: Logger Shield and Negative Numbers

by FazJaxton on Tue Jun 15, 2010 2:12 pm

I don't see that anyone answered your questions about what the "32 somethings" were. The number at the end of the uintXX_t values is the number of bits the variable type uses. uint32_t is a 32-bit type.

One bit can store 2 values, 0 or 1. 2 bits can store 4 values, 00, 01, 10, 11; 3 bits, 8 values: 000 001 010 011 100 101 110 111, and so on. The number of values is 2^(bits), and thus the 2^32 mentioned before.

Types are only defined in even numbers of bytes, so you will only find uint8_t (one byte of 8 bits), uint16_t, and uint32_t. If you are using signed numbers, it is appropriate to use the Signed INTegers, sint8_t, sint16_t, sint32_t. From the processor's point of view, the signed and unsigned types are no different, but the compiler will generate different code based on the type in some situations.
FazJaxton
 
Posts: 59
Joined: Mon Sep 28, 2009 2:18 pm
Location: Kansas, USA

Re: Logger Shield and Negative Numbers

by uhe on Tue Jun 15, 2010 6:32 pm

FazJaxton wrote: If you are using signed numbers, it is appropriate to use the Signed INTegers, sint8_t, sint16_t, sint32_t.
Are you sure about that?
It doesn't make sense to me since integers are signed by default. Besides that sint{8,16,32}_t is not defined in the avr-libc stdint.h...
"I have not failed. I've just found 10,000 ways that won't work." - Thomas Edison
uhe
 
Posts: 178
Joined: Mon Sep 03, 2007 4:50 pm
Location: metric world

Re: Logger Shield and Negative Numbers

by Volkemon on Tue Jun 15, 2010 6:33 pm

Thanks for sweeping up, FazJaxton! :)

That is a very clear and brief explanation.

I had yet to find a good definition, so all that was still a tad murky.
Livin' , learnin' , lovin' and laffin'. Thanks for the help!
Image
User avatar
Volkemon
 
Posts: 127
Joined: Mon May 10, 2010 8:24 pm
Location: Melbourne FL USA

Re: Logger Shield and Negative Numbers

by pstemari on Sun Jun 20, 2010 1:31 am

signed is the default, look for int16_t, int32_t, etc.

There's two differences between signed and unsigned as far as the processor is concerned: multiplication/division requires converting to a positive value and then adjusting the signed after completion, and comparisons wrap at a different point--signed numbers treat the values from 10....00 to 11....11 as negative values from -maxint to -1. For bit operations, addition, and subtraction, there's absolutely no difference between them.
--Paul

A wholly owned subsidiary of:
Persephone: DL R+W+B C 7 X L W C++ I++ T+ A E H++ S+ V-- F+ Q P B PA+ PL
Aldebaran: DM Rt H 5 Y L- W+ C+ I++ T++ A+++ E H++ S+ V+ F++ Q+ P B++ PA- PL--
User avatar
pstemari
 
Posts: 310
Joined: Sun Mar 21, 2010 6:10 pm
Location: Seattle, WA

Please be positive and constructive with your questions and comments.