Show Posts
|
|
Pages: 1 [2] 3 4 ... 10
|
|
17
|
Using Arduino / Networking, Protocols, and Devices / Re: Interfacing ADS1244
|
on: October 26, 2012, 09:47:48 am
|
some fine tuning to make it human readable: thanks a smart solution from "dhenry" /* ADS1244 */
int DATA = 4; int SCLK = 5;
void setup() { pinMode(DATA, INPUT); pinMode(SCLK, OUTPUT); Serial.begin(115200); // generate a 2.4MHz clock signal on pin 3 pinMode(3, OUTPUT); //CLK // 17.11 Register Description TCCR2A = 0x33; // 0011 0011 TCCR2B = 0x09; // 0000 1001 OCR2A = 0x06; // 0000 0110 OCR2B = 0x03; // 0000 0011 Serial.print("ADS1244\n"); // output 'AADS1244' (?) additional 'A' in front delay(100); }
void loop() { // Code for reading the data: int32_t value = 0; //digitalWrite(SCLK, HIGH); //enter slleep mode delay(300); digitalWrite(SCLK, LOW); // wake up ADC // wait for data ready, stay in while-loop until LOW while (digitalRead(DATA) == HIGH);
value = shiftIn(DATA, SCLK, MSBFIRST); value <<= 8; value |= shiftIn(DATA, SCLK, MSBFIRST); value <<= 8; value |= shiftIn(DATA, SCLK, MSBFIRST);
digitalWrite(SCLK, HIGH); // enter sleep mode //digitalWrite(SCLK, LOW); // 25th pulse to keep DATA high till next data ready // process as int24_t (two's compliment 24bit) value = ((signed long) (value << 8)) >> 8; Serial.println(value, DEC); Serial.flush();
}
|
|
|
|
|
19
|
Using Arduino / Programming Questions / Re: 3Byte Two's Compliment
|
on: October 26, 2012, 08:18:42 am
|
dhenry, "Smart" is highly subjective. agree  void setup() { Serial.begin(115200); Serial.println("signed 24bit test\n"); int32_t value[]={0x800000, 0xFFFFFF, 0x0, 0x000001, 0x7FFFFF}; // exp result -8.388.608, -1 , 0 , +1 , 8.388.607 for(int i=0; i<5; i++) { Serial.print(value[i], HEX); Serial.print("\t"); Serial.println(value[i], DEC); } Serial.print("___________________");
output: signed 24bit test 800000 8388608 // expected -8.388.608 FFFFFF 16777215 // expected -1 0 0 1 1 7FFFFF 8388607 _________________ i', playing around with bit manipulation (shift, toggle, etc.) but it always end up in requirement to use an IF condition. "smart" would be without 'IF' but a straight conversion line ( or 2) wally
|
|
|
|
|
20
|
Using Arduino / Programming Questions / 3Byte Two's Compliment
|
on: October 26, 2012, 07:39:41 am
|
|
Hello,
is there a smart way to handle signed 24 bit integers ? (without using "if" etc.)
Seems gcc > 4.7 supports a uint24_t nad int24_t datatype.
My ADC returns 3 Bytes conversion result as int24_t.
wally
|
|
|
|
|
21
|
Using Arduino / Networking, Protocols, and Devices / Re: Interfacing ADS1244
|
on: October 26, 2012, 03:58:09 am
|
better results with pos.Vref = +2.5V +5V 7FFFFF 8.388.607 +2,5V 40ACA4 ~4.238.500 +0,1V 5DC ~1,500 <+0,1 FFXXXX 16.xxx.xxx /* ADS1244 */
int DATA = 4; int SCLK = 5;
void setup() { pinMode(DATA, INPUT); pinMode(SCLK, OUTPUT); Serial.begin(115200); // generate a 2.4MHz clock signal on pin 3 pinMode(3, OUTPUT); //CLK // 17.11 Register Description TCCR2A = 0x33; // 0011 0011 TCCR2B = 0x09; // 0000 1001 OCR2A = 0x06; // 0000 0110 OCR2B = 0x03; // 0000 0011 Serial.print("ADS1244"); // output 'AADS1244' (?) additional 'A' in front delay(100); }
void loop() { // Code for reading the data: int32_t value = 0; //digitalWrite(SCLK, HIGH); //enter slleep mode delay(1000); digitalWrite(SCLK, LOW); // wake up ADC // wait for data ready, stay in while-loop until LOW while (digitalRead(DATA) == HIGH);
value = shiftIn(DATA, SCLK, MSBFIRST); value <<= 8; value |= shiftIn(DATA, SCLK, MSBFIRST); value <<= 8; value |= shiftIn(DATA, SCLK, MSBFIRST);
digitalWrite(SCLK, HIGH); // enter sleep mode //digitalWrite(SCLK, LOW); // 25th pulse to keep DATA high till next data ready Serial.println(value, DEC); Serial.flush();
}
|
|
|
|
|
23
|
Using Arduino / Networking, Protocols, and Devices / Re: Interfacing ADS1244
|
on: October 25, 2012, 01:28:23 am
|
Pylon, thanks a lot !  I am ashamed but i must say i see the 'shiftIn/ shiftOut' commands the first time. I still get some errors when compiling, but i think i can fix it after some readings. And i must solder the ADC on a adapter-PCB (MSOP) now to test during weekend. regards Wally
|
|
|
|
|
25
|
Using Arduino / Networking, Protocols, and Devices / Re: Interfacing ADS1244
|
on: October 24, 2012, 11:01:10 am
|
|
Hi,
I'm preparing to try, Yes, looks simple, but I'm not sure about the interface. Seems to be neither SPI nor I2C It does not have a CS pin and usess 2 clocks, the system clock at 2,5 MHz. I fear it's not entirely trivial. I did not find anything useful on the web , e.g. example code
wally
|
|
|
|
|
28
|
Using Arduino / Installation & Troubleshooting / Re: Arduino 1.0.1 Save as ...
|
on: October 04, 2012, 12:59:08 pm
|
|
I'm nearly sure it was even in 1.0.1 an IDE-own 'save as' dialog. Now it appears to be the save as dialog of the underlying OS.
explaining what i wanted to say is: let say actual project is 'MyProject_004' and i want to save as 'MyProject_005'. In the old method the dialog suggested the actual project name and i just have to increase the last number. Now i must type the entire new project name
wally
btw. i tried with very old 0.19 and its the same as 1.0.1, so i assume its defined in preferences.txt and/or friends and should be changeable so.
|
|
|
|
|
29
|
Using Arduino / Installation & Troubleshooting / Re: Arduino 1.0.1 Save as ...
|
on: October 04, 2012, 12:34:54 pm
|
|
Yes, sorry, it saves the entire folder. Is there a way to let 'save as' suggest the new folder name on base of the actual projectname as it was in the former version ? Is it possible to switch back to the old way ? When it was changed ? i still have 1.0.1
wally
|
|
|
|
|
30
|
Using Arduino / Installation & Troubleshooting / Arduino 1.0.1 Save as ...
|
on: October 04, 2012, 06:16:39 am
|
|
Hi,
i did not use Arduino for a while and wanted to use it now for editing some projects. When i do "Save as ..." on a modified project, now an externeal (i think GTK) save as appears and it stores only the actual single project.ino. As far as i remember the Arduino IDE always uses a new folder and saved all files from a project in the preferred sketchbook.
Any ideas what i do wrong or whta i should check for ?
thx wally
|
|
|
|
|