|
767
|
Using Arduino / General Electronics / Current question
|
on: March 24, 2011, 05:55:40 am
|
|
Hi All...
So, if I have a chip that uses .65 micro amp (.65 uA) and another that uses 100 nA, which is using less power? I don't know what an "nA" is...
Thanks...
|
|
|
|
|
770
|
Using Arduino / Storage / Looking for schematic for an SD card to Arduino interface
|
on: March 20, 2011, 02:17:38 am
|
|
I all...
I looked around a bit, but nothing very clear was found. I am thinking of adding an SD card to a project, and wondering how I interface one to an Arduino electronically? What circuitry needs to go between the SD card socket and the Arduino? Does it use SPI or something else?
Thanks...
|
|
|
|
|
773
|
Community / Bar Sport / Re: Feeling stupid
|
on: March 02, 2011, 10:18:51 pm
|
|
Thanks Rob, is it source level debugging (so I can step through the actual C/C++ code) or is it assembly level?
|
|
|
|
|
775
|
Community / Bar Sport / Re: Feeling stupid
|
on: March 02, 2011, 10:10:49 pm
|
|
Along these lines, I would love to use the JTAG port on an Atmel for actual debugging. i did some searching here and learned that the JTAG fuses are off by default, but didn't find much more than that. Does anyone know how I can use JTAG to debug code that is actually running on the CPU?
|
|
|
|
|
779
|
Using Arduino / Programming Questions / Re: Code Book
|
on: February 15, 2011, 05:13:18 pm
|
|
A computer language is a tool, and like all tools, you select the best one for the job at hand. For learning generic computer programming, I like Java. C/C++ are more complex for several reasons, and these reasons make them more popular. Jave is not going to run on an Arduino, but that's fine for your purposes (learning).
Things like PHP, PERL, Python and so on are handy, but you can learn some bad habits playing with them. Java anc C/C++ are what are referred to as "type safe" languages. That's a big advantage, because the compiler helps catch errors that can otherwise be hard to find. Java handles what is called "dynamic memory allocation" for you, C/C++ does not. That makes C/C++ more powerful and a better choice when that kind of flexability is needed, but also makes writing insidious bugs very easy.
Bottom line, you'll learn good habits with Java and C/C++, and those skills will position you to quickly adapt to PHP, Python and so on. Its a lot harder to go from say PHP to C.
|
|
|
|
|
780
|
Using Arduino / Storage / Any SPI / Flash experts out there?
|
on: February 15, 2011, 04:50:20 am
|
Hi All... I am trying to get my Uno to talk to a Winbond 8MB Flash chip via SPI. I checked the leading edge/falling edge stuff and the other things that need to be considered on SPI. The code below simply tries to read the status register, set write enable, then read the status register again. It then looks for a change in the status register. The code below executes the same whether the flash chip is hooked up or not. I'm pretty sure I have it hooked up right. Its pretty simple actually. I'm hopeing someone can help me find the issue before I decide my chip is bad. The data sheet for the chip is referenced int eh code, in a comment. Thanks! // Some code to play with the Winbond flash
#define DATAOUT 11//MOSI #define DATAIN 12//MISO #define SPICLOCK 13//SCK #define SLAVESELECT 10//SS #define WP 8//Write protect
// Opcodes // Taken from Winbond datasheet: // http://www.winbond.com/NR/rdonlyres/591A37FF-007C-4E99-956C-F7EE4A6D9A8F/0/W25Q64BV.pdf
#define WREN 0x06 // Write Enable #define WRDI 0x04 // Write Disable #define RDSR1 0x05 // Read Status Register 1 #define RDSR2 0x35 // Read Status Register 2 #define WRSR 0x01 // Write Status Register #define READ 0x03 // Read Data #define READID 0x90 // Read Manufacturer / Device ID #define READUNID 0x4B // Read Unique ID Number (factory set 64-bit ID) - optional feature on chip
void setup() { Serial.begin(9600); pinMode(DATAOUT, OUTPUT); pinMode(DATAIN, INPUT); pinMode(SPICLOCK, OUTPUT); pinMode(SLAVESELECT, OUTPUT); pinMode(WP, OUTPUT); digitalWrite(SLAVESELECT, HIGH); //Disable device digitalWrite(WP, HIGH); // Disable write protect
// Set CPUs SPI status register to 0101 0000 SPCR = (1 << SPE) | (1 << MSTR); // Read any junk data from status registers byte clr; clr = SPSR; clr = SPDR; byte readA = 0; byte readB = 0; byte readC = 0; delay(100); Serial.print("Reading status register\r\n"); digitalWrite(SLAVESELECT, LOW); readA = spiTransfer(RDSR1); digitalWrite(SLAVESELECT, HIGH);
delay(100);
Serial.print("Sending write enable\r\n"); digitalWrite(SLAVESELECT, LOW); byte response = spiTransfer(WREN); digitalWrite(SLAVESELECT, HIGH);
Serial.print("Reading status register\r\n");
delay(100); digitalWrite(SLAVESELECT, LOW); readB = spiTransfer(RDSR1); digitalWrite(SLAVESELECT, HIGH);
if(readA != readB) { Serial.print("Values differ\r\n"); } else { Serial.print("Values the same\r\n"); } }
void loop() { }
byte spiTransfer(volatile byte data) { SPDR = data; while (!(SPSR & (1<<SPIF))) { }; return SPDR; }
|
|
|
|
|