Show Posts
Pages: [1] 2 3 ... 139
1  Using Arduino / Storage / Re: Best way to format data for analysis on: July 26, 2014, 02:42:09 am
Just print all the data delimited by a "," and with cr/lf at the end of a measurement. That's it.

A measurement at time X (use the data_xy as it is in your above code) ie.:
Code:
myFile.print(time);
myFile.print(",");
myFile.print(data1);
myFile.print(",");
myFile.print(data2);
myFile.print(",");
myFile.print(data3);
myFile.print(",");
myFile.print(data4);
myFile.print(",");
...
myFile.print(",");
myFile.print(data15);
myFile.println();

You will get the CSV format:
Code:
time,data1,data2,data3,data4,..,data15
time,data1,data2,data3,data4,..,data15
time,data1,data2,data3,data4,..,data15
..

Before the start of the measurement loop print the headers (column names) in the same manner, ie.:

Code:
myFile.print("Time");
myFile.print(",");
myFile.print("Humidity S1");
myFile.print(",");
myFile.print("Temperature S1");
myFile.print(",");
myFile.print("Dew point S1");
myFile.print(",");
...
myFile.print(",");
myFile.print("Dew point S3");
myFile.println();

So your CSV file will look like (there will be the actual numbers instead of time and data_xy of course):
Code:
Time,Temperature S1,Dew point S1,..,Dew point S3
time,data1,data2,data3,data4,..,data15
time,data1,data2,data3,data4,..,data15
time,data1,data2,data3,data4,..,data15
..
You may load such file directly to a spreadsheet then..

2  Using Arduino / Project Guidance / Re: Any way to add SRAM to Arduino? on: July 26, 2014, 02:31:19 am
You may use an external SPI SRAM/FRAM/MRAM, up to 512kBytes per chip (8pin serial SPI). The access is slow however, maybe 10-15usec/byte with a random byte access with arduino. A block access, ie. 512bytes is much faster, maybe 2-3usecs/byte.
Then you may use the 8MB Ramdisk - it requires 11 pins for signals and it is a bit faster than the SPI SRAM (there is a thread in Other HW development forum about it)..
3  Using Arduino / Sensors / Re: SPI and multiple and different types of sensors on: July 25, 2014, 11:46:31 am
..
From all SPI_CLOCK_DIV different values, SPI_CLOCK_DIV8 is the only one working good with the LDC.
I will study your suggestion on the buffer. For the moment I don't have the option to add more cables.
You may try to provide a kind of simple impedance matching - 10-33ohm in series with the signals (at the atmega side) may help to suppress ringing, also to terminate the cable (at the far end) may help as well (ie. ground all signals with let say 1kohm resistors, or lower, when the sensors are able to create the log1 properly with such impedance).
PS: try to terminate the cable with 270-330ohm at SCK, DO (data output from atmega), CS signals.  I will not terminate the DI (the data output of the sensors) as the sensors may have not a sufficient fanout).
4  Using Arduino / Sensors / Re: How do I use a KTY 81-220 temperature sensor in arduino? on: July 25, 2014, 11:35:07 am
The KTY81-xxx is a thermistor (Rt) with a positive temperature coefficient of resistance. See the datasheet for calibration data..
You may wire it as a part of a bridge, or a part of a simple voltage divider.
Search for "bridge thermistor"
5  Using Arduino / Sensors / Re: SPI and multiple and different types of sensors on: July 25, 2014, 05:32:28 am
2m long wire is too long for an SPI unless it is a cable with proper impedance matching (to suppress ringing, reflections, etc.) , moreover you may need a buffer/driver in order to feed such cable with 16 SPI inputs hanging on it.
Mind each device input loads the SPI bus with a capacitance, which adds. So your capacitance is 16x bigger than with a single device.
Try to use a bus driver for the SPI bus (ie. 74HC125), better to split the bus into more buses in parallel, driven by the drivers. You may also try to use 8-16x slower SPI clock, maybe it will work.
6  Development / Other Hardware Development / Re: Half-Byte Computer 'console'-ATMega 328 based 'computer' and gaming console on: July 15, 2014, 12:04:16 am
Finally, I am need of a storage solution for Tiny Basic. Since only a thousand bytes are left for TB program space, I cannot use the SD card library, which requires 512 bytes for a buffer. I don't want this board to have to be tethered to a computer, so I need something simple and very cheap. 
The simplest and cheapest solution is to redesign the stuff with atmega1284p (or better) and a microsd socket..

7  Community / Exhibition / Gallery / Re: Arduino 6502 emulator + BASIC interpreter on: July 06, 2014, 07:21:00 am
This is the version with transferring deltas only from C64 video RAM to the VT100 terminal (25 rows x 40 columns).
VRAM is a temporary video memory holding "old" characters. We compare the new RAM[] to VRAM and if a difference we print the new character at the VT100 [row,col] position.

Mind you have to have CapsLock on on your keyboard..

Works nice with VT100 in TeraTerm.

Code:
..
uint8_t VRAM[1000];

void VTposition(uint8_t row, uint8_t col) {
Serial.write(27);
Serial.write('[');
Serial.print(row + 1);
Serial.write(';');
Serial.print(col + 1);
Serial.write('H');
}

void setup () {
Serial.begin (115200);
Serial.println ("Booting the ROM..");
reset6502();
delay(1000);
for (int i=0; i<1000; i++){
VRAM[i] = RAM[i+1024];
}
}

void loop () {
int v_address = 0;
for (uint8_t row=0; row<25; row++) {
for (uint8_t col=0; col<40; col++) {
if (Serial.available()) {
curkey = Serial.read() & 0x7F;
RAM[198] = 1;
RAM[631] = curkey;
}

exec6502(100);

uint8_t petscii = RAM[v_address + 1024];

if (VRAM[v_address] != petscii) {
VRAM[v_address] = petscii;
VTposition(row, col);
if (petscii<32) petscii = petscii + 64;
Serial.write(petscii);
}
v_address++;
}
}
}
8  Development / Other Hardware Development / Re: 8MB Ramdisk (external RAM) for Arduino.. on: July 05, 2014, 06:40:41 pm
We found out that for experimenting with DUE's EMB bus timings it is better to fill in the memory with random numbers. Below find the sketch.
Code:
// DUE EMB Example for 8MB Ramdisk v.1.1
// 1M BYTES RANDOM WRITE/READ
// Library used: https://github.com/delsauce/ArduinoDueParallel
// DUE at 84MHz (12ns clock)
// Provided as-is, no warranties of any kind
// Pito 7/2014

/* Wiring:
 ==============================================
 RDisk   DUE's header    DUE's EMB signal name
 ==============================================
 D0-D7   PIN34-PIN41     D0-D7
 /WR     PIN45           NWE
 /RD     PWM4            NRD
 /DATA   PWM9            A0 (A0=0 wr/rd data, A0=1 wr addresses)
 /MS     GND             GND
 ==============================================
 */

#include <Parallel.h>

// Setting up the rd/wr starting Address (8388607 max)
int set_address(unsigned long address){
Parallel.write(1, address >> 20);  // addr[23..20]
Parallel.write(1, address >> 16);
Parallel.write(1, address >> 12);
Parallel.write(1, address >> 8);
Parallel.write(1, address >> 4);
Parallel.write(1, address);  // addr[3..0]
}

void setup() {

// Configure parallel bus for 8bits, no CS, A0, and NRD and NWE
Parallel.begin(PARALLEL_BUS_WIDTH_8, PARALLEL_CS_1, 1, 1, 1);

// Configure bus timings.. EXPERIMENTAL
// We do not use any real addressing
Parallel.setAddressSetupTiming(1,1,1,1);

// NWE, NCSWE, NRD, NCSRD  - we do not use NCSs
Parallel.setPulseTiming(5,1,7,1);

// better read datasheet for CycleTiming:
Parallel.setCycleTiming(7,9);

// make a dummy read
Parallel.read(0);

// set the Serial
Serial.begin(115200);
}

void loop() {

unsigned i;
unsigned sumr, sumw, elapsedw, elapsedr;
unsigned char data;

randomSeed(micros());

Serial.println("START OF THE TEST");
Serial.println("WRITING 1Mil RANDOM BYTES TO RAMDISK");

// Write 1 million random data
sumw = 0;
elapsedw = millis();
set_address(0L);
for(i=0; i<1000000; i++){
data = random(256);
Parallel.write(0, data);
sumw = sumw + data;
}
elapsedw = millis() - elapsedw;

Serial.println("READING AND SUM 1Mil RANDOM BYTES FROM RAMDISK");
// Read and sum 1million of data from Address=0L
sumr = 0;
elapsedr = millis();
set_address(0L);
for(i=0; i<1000000; i++){
sumr = sumr + Parallel.read(0);
}
elapsedr = millis() - elapsedr;

Serial.print("SUM_W = ");
Serial.println(sumw);
Serial.print("SUM_R = ");
Serial.println(sumr);
Serial.print("ELAPSED WRITE = ");
Serial.print(elapsedw);
Serial.println(" msec");
Serial.print("ELAPSED READ = ");
Serial.print(elapsedr);
Serial.println(" msec");
Serial.println("TEST STOP");
Serial.println(" ");

//while(1);
}
9  Using Arduino / Storage / Re: Any ideas how can one program this SRAM? on: July 05, 2014, 06:21:48 pm
What about this:
http://forum.arduino.cc/index.php?topic=220918.0
8MBytes, 11 wires only, compatible with EMB-SMC bus, existing driver for DUE interface with 4.3MBytes/sec - see the topic.
You can connect several modules in various configurations.
It has got an autoincrement, so you set the initial address and then just write/read the data..
10  Using Arduino / Storage / Re: Using Mighty 1284P with SD card issues. on: July 05, 2014, 06:13:34 pm
Do you use a solderless breadboard? If so try to refresh all the contacts (put out/in the wires/pins few times)..
11  Community / Exhibition / Gallery / Re: Arduino 6502 emulator + BASIC interpreter on: July 05, 2014, 03:54:29 am
I ran it on pic32mx Fubarino o'clocked 120MHz (compiled with chipkit's compiler, USB serial com), and the below trigo test took about 10secs (C64 V2 ROM). I only read the first half of the bottom line to eliminate video. So it seems there is an issue somewhere (provided mips is ~20% faster than arm and my clock is 30% more yours)  smiley For example, if you do not switch CapsLock on, it returns in 1 sec as it does not run the code (the code is empty).. smiley Unless the mips compiler is a crap I would estimate 19.9 secs for your code in the DUE..

PS: The test for reference:
Code:
5  REM PITO'S TRIGONOMETRIC FUNCTIONS TEST 0..89 DEGREE
6  REM FOR C64 V2 BASIC ROMS
7  REM BASED ON WELLKNOWN "9 DEGREE" CALC FORENSIC TEST
8  REM ASIN(ACOS(ATAN(TAN(COS(SIN(9.0)))))) = 9.0 IN DEGREE
10 PH = 3.1415926536/2.0
15 REM DEFINE ARCSIN AND ARCCOS
20 DEF FN ASN(X) = ATN(X/SQR(1.0-X*X))
30 DEF FN ACS(X) = PH-ATN(X/SQR(1.0-X*X))
35 REM TR, TD - TO RAD, TO DEG
40 TR = 3.1415926536 / 180.0
50 TD = 180.0 / 3.1415926536
55 REM INPUT IN DEGREE (0..89)
60 FOR D = 0 TO 89
70 T = SIN(TR*D)
72 T = COS(TR*T)
74 T = TAN(TR*T)
76 T = TD*ATN(T)
80 T = TD*FN ACS(T)
90 T = TD*FN ASN(T)
100 PRINT D; "="; T; " DELTA="; T-D
110 NEXT D
120 END

Code:
READY.
RUN
 0 = .0708403071  DELTA= .0708403071
 1 = 1.00188405  DELTA= 1.88405439E-03
 2 = 2.00156704  DELTA= 1.56704057E-03
 3 = 3.00102166  DELTA= 1.02166273E-03
 4 = 4.00055188  DELTA= 5.51875681E-04
 5 = 5.00046232  DELTA= 4.62317839E-04
 6 = 5.99979405  DELTA=-2.05950812E-04
 7 = 6.99975351  DELTA=-2.46489421E-04
 8 = 8.00046608  DELTA= 4.6607852E-04
 9 = 9.00044075  DELTA= 4.40750271E-04
 10 = 10.0001669  DELTA= 1.66922808E-04
..
 84 = 83.9999204  DELTA=-7.96020031E-05
 85 = 85.0002601  DELTA= 2.60084868E-04
 86 = 86.0004052  DELTA= 4.05162573E-04
 87 = 87.0003106  DELTA= 3.10570002E-04
 88 = 88.0004901  DELTA= 4.90099192E-04
 89 = 89.0023091  DELTA= 2.30902433E-03

READY.
12  Community / Exhibition / Gallery / Re: Arduino 6502 emulator + BASIC interpreter on: July 04, 2014, 05:08:09 am
And your program completes in 1.5 seconds on the emulator running on the DUE smiley
Hard to believe smiley
13  Community / Exhibition / Gallery / Re: Arduino 6502 emulator + BASIC interpreter on: July 03, 2014, 04:32:34 pm
I don't know what you want to measure?
People might be interested to see how the cpu.c emulator performs with avr, CM0, CMO+, CM3, CM4, pic32MX, pic32MZ, etc.. compiled with X, Y, Z compilers..  So when they want start to measure the enhBasic running a benchmark is the good option..
14  Community / Exhibition / Gallery / Re: Arduino 6502 emulator + BASIC interpreter on: July 03, 2014, 04:19:22 pm
When you need to compare architectures/compilers running the cpu.c emulator then the best option is to use the enhBasic as it communicates via Serial only. So the error related to the communication with the emulated system (with Basic) is small.
The C64 rom communicates via video stream, where the stream takes a lot of time in comparison to the time spent in the emulator. That issue is the same for my Terminal printing, as well as for your tft video emulation.
15  Community / Exhibition / Gallery / Re: Arduino 6502 emulator + BASIC interpreter on: July 03, 2014, 04:03:31 pm
Unless some tricks applied I cannot do it easily with C64 as when I stop the video I cannot see the test has finished smiley
With enhBasic you may print start/stop and measure the elapsed time. No video buffer needs to be read.
Pages: [1] 2 3 ... 139