|
1171
|
International / Deutsch / Re: Problem mit SD Datenlogger
|
on: June 27, 2012, 11:25:08 am
|
|
Was heisst "bleibt stehen" ? "error opening datalog.txt" ?
oder gar nix ?
Undefiniertes Verhalten ist of ein Speicherproblem. Ich fürchte, SD.open() braucht 512 byte freien RAM am Stück. ( Evtl auch je nach blocksize mehr ?)
Auch ein 2560 hat nur begrenzt RAM.
Aber schon merkwürdig, dass es mit "0" ewig gut geht, mit anderen Werten aber nicht.
dataString += ... ; ist ziemlich aufwändig ! Und wenn dann die temporären Teil-Strings unterschiedlich lang sind, kann es evtl. zu mehr Problemen führen, als wenn es sich immer um String(",") ound String("0") handelt ...
Ich würde ein statisches char array[80] nehmen, und das mit sprintf füllen ( evtl. auch hübsch in Spalten ausgerichtet).
Im playground gibt es mem_check und ähnliche ...
|
|
|
|
|
1172
|
Using Arduino / Programming Questions / Re: serial read
|
on: June 27, 2012, 10:58:05 am
|
|
Your code nearly does it already: what's the purpose of int x ( the one inside getFloatFromSerialMonitor : you might use that as index into your float array to return. )
Questions remaining : How do you distinguish between 2 numbers ? ( A comma , semicolon, space ?) Do you know in advance how many floats you get ?
modify float getFloatFromSerialMonitor() to float* get3FloatsFromSerialMonitor()
Finding nice code is great, but latest to enhance it, you need to understand it.
Another hint Your unused String str; shows that you are not afraid of memory problems. Perhaps dynamically creating the float array might work for you, too. It's better however, if the calling loop() provides the float array, and if you remove that String str;
|
|
|
|
|
1173
|
International / Deutsch / Re: dtostrf() hängt mir immer ein A an den String an
|
on: June 27, 2012, 04:55:42 am
|
Deiner Konstruktion String cppString; char cstring[] = " 3.45\000xy"; // so sollte das Ergebnis von dtostrf(val,6,2, target); aussehen: 7 der 10 byte definiert cppString = cstring; traue ich nicht über den Weg, aber ... ... ausnahmsweise ist der böse String wohl nicht schuld, da : >>Was passiert denn, wenn Du direkt den StrBuffer per Serial.println() ausgibst? > das A ist immer noch dran. ( Du meinst sicher " ist schon dran " )
|
|
|
|
|
1174
|
Using Arduino / Microcontrollers / Re: problem to burn bootloader using usbtinyisp [solved]
|
on: June 27, 2012, 02:58:58 am
|
Solution: the chips were fused to require an external crystal. I had to take my only UNO from its project ( I don't have other crystals, as I think 8MHz is fast enough ), replace the chip with the other one, attach usbtinyISP to the UNO and ran my read signature cmd: Works perfect. No need for -b 115200 option (which I don't understand, btw), no need for -B250 lfuse was FF : changed fuses to recommendation by http://www.engbedded.com fuse calculator successfully Moved modified chip to my minimal breadboard, attached usbtinyISP: works ! --> avrdude: programmer operation not supported is just for fun, this message persists, but avrdude: initialization failed, rc=-1 is serious, the -F option suggestion is rather useless then. (added this follow up just in case other newbies have the patience to read this thread to the end)
|
|
|
|
|
1175
|
Using Arduino / Programming Questions / Re: serial read
|
on: June 26, 2012, 05:08:23 am
|
I guess, once OP has learned how to enter a float number via Serial into a float variable, he could also set it to NaN, -INF, +INF , if he really wants to. I'm not sure what the word "support" means in that scenario, but these bit patterns are possible, the ATMEGA 328 controller itself does not care. What is a "less black hole" ? -- just to keep this thread off topic 
|
|
|
|
|
1176
|
International / Deutsch / Re: ATtiny als Digitalpotentiometer?
|
on: June 26, 2012, 04:14:06 am
|
Ich habe aktuell etwa 20 unterschiedliche Funktionen, die vom 84'er ausgeführt werden sollen OK Zählt da die Funktion "nix tun" dazu ? Sind das Dauerfunktionen ? Wie schnell soll der Wechsel zwischen Funktionen sein ? pulseIn(pin, HIGH) wartet übrigens auf LOW und dann wieder auf HIGH Damit pulseIn sauber funktioniert, müssen also immer Pulse kommen! Ein Vorschlag: 0 - 1999 µs = Grundzustand delay(1)
2000 - 4000 µs = Funktion A delay(3) 4000 - 6000 µs = Funktion B ... 52000 - 54000 µs = Funktion Z delay(53) 54000 - ... = Fehler ??? Zum Dekodieren: byte funktion = (byte)(pulseIn(pin, HIGH)/2000)*2 + 1; switch (funktion) { case 1: break; case 3: Funktion_A(); break; ... } *2 + 1 ist nur dafür da, um auf Sender- (delay ) und Empfängerseite (case ) die gleichen Werte zu haben, ...
|
|
|
|
|
1178
|
International / Deutsch / Re: ATtiny als Digitalpotentiometer?
|
on: June 26, 2012, 03:08:09 am
|
wie genau dieses Verfahren ist Das war eher ein genereller Einwand. Ganz abgesehen davon, dass pulseIn micros liefert, dein delay aber mit millis arbeitet. Wenn du mehrere verschiedene diskrete ( = unterschiedliche, mit unterschiedlicher Bedeutung ) Werte übertragen willst, wäre eine seriell codierte Übertragung besser. Wenn du aber ein quasi analoges Signal haben willst (PWM nur ohne elektrische Glättung), ist dein if(duration == 20) {}ein unpassendes Verfahren
|
|
|
|
|
1182
|
Using Arduino / Programming Questions / Re: CharAt()
|
on: June 25, 2012, 11:24:47 am
|
Strings are evil.  char test[] = "23456";
void setup() { Serial.begin(9600); } void loop() { int i=0; while (i < strlen(test) ) { char pointer = test[i++]; Serial.println(pointer); delay(1000); } }
|
|
|
|
|
1183
|
Using Arduino / Programming Questions / Re: bitfields
|
on: June 24, 2012, 11:27:49 am
|
|
Instead of boolean ( which are bytes ) you can work with single bits.
Instead of if (xyz == true) you'd use if (xy & Z_BIT) or something similar.
You need to know where each bit sits, of course. In the pseudo code above the byte xy hosts a couple of single bits , Z_BIT being one of them.
If you're not familiar with c syntax on single bits, the arduino functions bitSet(), bitClear(), bitRead(), bitWrite() might be interesting for you.
|
|
|
|
|
1184
|
Using Arduino / Programming Questions / Re: How many seconds is Millis()
|
on: June 24, 2012, 11:16:19 am
|
|
It's definitely not 1024 millis in a second. ( Sometimes it does not take 1000 µs fom one millis() value to the next, to compensate for timer0 )
And, on my arduino UNO with 16MHz crystal, it's usually (at 23 °C) rather 998 to 999 millis() in a second.
But 3600000UL is precise enough for your "requirement" (+- 5 min/h)
|
|
|
|
|
1185
|
Using Arduino / Microcontrollers / Re: problem to burn bootloader using usbtinyisp
|
on: June 23, 2012, 08:37:54 am
|
I rechecked the wiring of my 10pin cable between usbtiny and atmega chip and I hope this is correct: atmega usbtiny atmega pin pins 17 MOSI 1 2 +5V 7, 20 3 1 RESET 5 19 SCK 7 18 MISO 9 10 GND 8, 22 Then I got a standalone WinAVR-20100110-install.exe and ran this avrdude cmd, to simply read the signature: C:\WinAVR-20100110\bin>avrdude -p m328p -c usbtiny -v -n -F -U signature:r:mysig.txt:h
avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "C:\WinAVR-20100110\bin\avrdude.conf"
Using Port : lpt1 Using Programmer : usbtiny AVR Part : ATMEGA328P Chip Erase delay : 9000 us PAGEL : PD7 BS2 : PC2 RESET disposition : dedicated RETRY pulse : SCK serial program mode : yes parallel program mode : yes Timeout : 200 StabDelay : 100 CmdexeDelay : 25 SyncLoops : 32 ByteDelay : 0 PollIndex : 3 PollValue : 0x53 Memory Detail :
Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- eeprom 65 5 4 0 no 1024 4 0 3600 3600 0xff 0xff flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00 signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : USBtiny Description : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/ avrdude: programmer operation not supported
avrdude: Using SCK period of 10 usec avrdude: initialization failed, rc=-1 avrdude: AVR device initialized and ready to accept instructions avrdude: Device signature = 0x000000 avrdude: Yikes! Invalid device signature. avrdude: Expected signature for ATMEGA328P is 1E 95 0F
avrdude done. Thank you. programmer operation not supported Is this the root cause ? What does this mean ? avrdude: initialization failed, rc=-1 This is certainly bad ! avrdude: AVR device initialized and ready to accept instructions I do not get this, however ??? avrdude: Device signature = 0x000000 Which is certainly wrong. I'm new to programmers in general, usbtinyISP, barebone atmega µc, bootloader ... The actual chip is new for me. What else can I do with it to test it or get it alive ? Should I rather forget/return it ? Or is it rather a problem between usbtinyISP and avrdude ? ( programmer operation not supported )
|
|
|
|
|