Show Posts
|
|
Pages: [1] 2 3 ... 81
|
|
2
|
Using Arduino / Networking, Protocols, and Devices / Re: Ethernet Shield stopping at "begin"
|
on: September 09, 2012, 07:47:12 pm
|
The odd thing is that you *only* see "Attempting..." This code: if ( Ethernet.begin( mac ) == 0 ){ delay( 5000 ); Serial.println( "Ethernet failed to begin." ); }else{ delay( 5000 ); Serial.println( "Success!" ); } Should either print "Ethernet failed to begin." or "Success!", no matter what. Maybe the code is hanging within the Ethernet.begin()... baum
|
|
|
|
|
6
|
Using Arduino / Programming Questions / Re: SRAM and storing strings
|
on: April 08, 2012, 01:43:26 pm
|
|
Without the F() syntax, "hello" would be stored in your SRAM. But you don't have a lot of SRAM, so using the F() stores the string in the flash (program) memory, of which you have a lot. Projects that need a lot of strings will benefit from storing strings in flash, as it will free up ram for things like variables. But a flash string cannot be modified.
baum
|
|
|
|
|
10
|
Using Arduino / Storage / Re: Wire and 24LC256 Issue
|
on: February 02, 2012, 07:22:43 pm
|
So I (tried) to incorporate in a page write, and now it won't erase. Odd thing is that the writeArray function is copied from another program, where it works. /* Science Research Timer Erase * Erases both the internal and * external 24LC256 EEPROMs. */
#include <Wire.h> #include <EEPROM.h>
#define EEPROM_ADDRESS 0x50 #define EXTERNAL_EEPROM_SIZE 32768L //size of 24LC
#define L_PIN 3
void setup() { unsigned long memPointer = 0; Serial.begin(19200); Wire.begin();
pinMode(L_PIN, OUTPUT);
/* First clear the internal. */ for (int i = 0; i <= E2END; i++) { EEPROM.write(i, 0); }
blink(L_PIN);
/* And now the external EEPROM. */ char eraseArray[BUFFER_LENGTH]; //32 bytes for standard Wire library for(int i = 0; i < BUFFER_LENGTH; i++) { eraseArray[i] = 0xFF; } //Now eraseArray[] is filled with 0xFF. while(memPointer < EXTERNAL_EEPROM_SIZE) { writeArray(eraseArray, BUFFER_LENGTH, memPointer); memPointer += BUFFER_LENGTH; //increase the address. Serial.println(memPointer); } digitalWrite(L_PIN, HIGH); } //end setup
void loop() { }
void blink(byte pin) { digitalWrite(pin, HIGH); delay(200); digitalWrite(pin, LOW); return; }
/* writes an Array to the 24LC56.*/ void writeArray(char data[], int length, unsigned int address) {
if((length + 2) > BUFFER_LENGTH) { //too big for Wire buffer! return; }
unsigned int i;
Wire.beginTransmission(EEPROM_ADDRESS); Wire.write(highByte(address)); Wire.write(lowByte(address));
/* Now do a page write */
for(i = 0; i < length; i++) { Wire.write(data[i]); }
Wire.endTransmission(); //send the data.
return; }
|
|
|
|
|
12
|
Using Arduino / Storage / Re: Wire and 24LC256 Issue
|
on: February 01, 2012, 10:19:30 pm
|
You could increase the buffer size, bearing in mind there are 5 of them. So already you are using 5 x 32 bytes. So there are 5 buffers, each 32 bytes. I am using all 5 of them (160 bytes) yet only have a 32 byte buffer...? Which one's which? Thanks for clarifying about endTransmission(). baum
|
|
|
|
|
14
|
Using Arduino / Storage / Re: Wire and 24LC256 Issue
|
on: February 01, 2012, 08:51:45 pm
|
Would this be good? I can only do half of a page b/c of Wire buffer size. /* Erases both the internal and * external 24LC256 EEPROMs. */
#include <Wire.h> #include <EEPROM.h>
#define EEPROM_ADDRESS 0x50 #define EXTERNAL_EEPROM_SIZE 32768 //size of 24LC
#define L_PIN 13
#define arrayLength(array) (sizeof(array)/sizeof(array[0]))
void setup() { unsigned int memPointer = 0; Serial.begin(19200); Wire.begin();
pinMode(L_PIN, OUTPUT);
/* First clear the internal. */ for (int i = 0; i <= E2END; i++) { EEPROM.write(i, 0); }
blink(L_PIN);
/* And now the external EEPROM. */ byte eraseArray[BUFFER_LENGTH]; //32 bytes for standard Wire library memset(eraseArray, byte(0xFF), sizeof(eraseArray)); //Now eraseArray[] is filled with 0xFF. while(memPointer < EXTERAL_EEPROM_SIZE) { writeArray(eraseErray[], memPointer); } blink(L_PIN);
} //end setup
void loop() { }
void blink(byte pin) { digitalWrite(pin, HIGH); delay(200); digitalWrite(pin, LOW); return; }
/* writes and Array to the 24LC56.*/ void writeArray(byte data[], unsigned int& address) {
if(arrayLength(data) > BUFFER_LENGTH) { //too big for Wire buffer! return; }
unsigned int i;
Wire.beginTransmission(EEPROM_ADDRESS); Wire.write(highByte(address)); Wire.write(lowByte(address));
/* Now do a page write */
for(i = 0; i < arrayLength(data); i++) { Wire.write(data[i]); }
address += arrayLength(data); //increase the address.
Wire.endTransmission(); //send the data.
return; }
Thanks, baum
|
|
|
|
|