Hey
How much time does it take to write to RAM of Arduino duemilanove( atmega 328p). I know it takes 3.3 ms to write 1 byte to EEPROM but couldnt find about RAM
thanks
62.5ns
1 byte for 62.5 ns?
How did you get that? I mean does it depend upon 16Mhz crystal?
I mean 1 clock cycle is required for 1 bit writing?
I understand you took timeperiod of clock pulse 16MHz?
I mean does it depend upon 16Mhz crystal?
Yes.
I mean 1 clock cycle is required for 1 bit writing?
No. One clock cycle to write one byte.
Also Does arduino duemilanove supports baudrate to be 14400 in serial.begin(14400)?
I am getting correct reading at 9600 but not at 14400? I just gives 111111111
Also Does arduino duemilanove supports baudrate to be 14400 in serial.begin(14400)?
Yes, it does.
I am getting correct reading at 9600 but not at 14400? I just gives 111111111
Fix line 27.
Line 27 my side is SPI.transfer(33)?
What is wrong with it?
What's wrong is that we can't see your code.
Line 27 my side is SPI.transfer(33)?
What is wrong with it?
Classic. ![]()
Graynomad:
Line 27 my side is SPI.transfer(33)?
What is wrong with it?Classic.
It was bound to happen sooner or later
Hey sorry
I posted the code on other post which paul was already following and earlier asked me to share code.
Thats why I wrote. Let me uplaod the code once again here.
#include "SPI.h"
int ss=10;
unsigned int adcValue=0;
byte highByte;
byte lowByte;
long previousMillis=0;
long interval=1000;
unsigned int adcValue1[500];
unsigned int k=0;
void setup()
{
pinMode(ss, OUTPUT); // setting SS pin as output
SPI.begin();
SPI.setBitOrder(MSBFIRST);
SPI.setClockDivider(SPI_CLOCK_DIV2);
Serial.begin(9600);
}
void loop()
{
//series of command bit
digitalWrite(ss,LOW); // Selecting chip by making CS low
SPI.transfer(32); //command for comm reg to select ch1 and write to clock register
SPI.transfer(167); //command for clock reg to set 2,4576Mhz
SPI.transfer(16); //command for comm reg to write setup register
SPI.transfer(68); //command for setup reg to self calibration,unipolar,unbuffered
char DataNotReady = 128;
while(DataNotReady) // wait for end of conversion
{
SPI.transfer(8);//command for comm reg to read (dec 8)
DataNotReady =SPI.transfer(0); // Read comm register
DataNotReady &= 0x80; //Hexadecimal of 128
}
SPI.transfer(33); //command for comm register to select ch2 and write to clock register
SPI.transfer(167); // command for clock register to set 2.4576 Mhz
SPI.transfer(17); //command for the comm register to write setup for channel 2
SPI.transfer(68); //command for set up register to self calibrate,unipolar,unbuffered
char DataNotReady1 = 128;
while(DataNotReady1) // wait for end of conversion
{
SPI.transfer(9);//command for comm reg to read (dec 8)
DataNotReady1 =SPI.transfer(0); // Read comm register
DataNotReady1 &= 0x80; //Hexadecimal of 128
}
while(1)
{ for(int ch=1; ch<=2;ch++)
{
char DataNotReady = 128;
while(DataNotReady) // wait for end of conversion
{ if(ch==1)
{
SPI.transfer(8);//command for comm reg to read (dec 8)
}
else if(ch==2)
{ SPI.transfer(9);
}
DataNotReady =SPI.transfer(0); // Read comm register
DataNotReady &= 0x80; //Hexadecimal of 128
}
//read 16bit of data ADC
highByte = 0;
lowByte = 0;
if(ch==1)
{
SPI.transfer(56); // inform the adc that you will be reading the data register in the next operation
}
else if(ch==2)
{ SPI.transfer(57);
}
highByte = SPI.transfer(0);
lowByte = SPI.transfer(0);
adcValue = highByte << 8;
adcValue = adcValue | lowByte;
Serial.println(adcValue,DEC);
/* adcValue1[k]=adcValue;
k++;
unsigned long currentMillis= millis();
if(currentMillis- previousMillis > interval)
{ Serial.println(k,DEC);
previousMillis=currentMillis;
for(int i=0; i<500;i++)
Serial.println(adcValue1[i],DEC);
}*/
// Serial.print("analog value =");
// Serial.println(adcValue, DEC);
// Serial.print('\n');
//delay(1000);
}
}
}
PaulS:
Also Does arduino duemilanove supports baudrate to be 14400 in serial.begin(14400)?
Yes, it does.
Does SerialMonitor support 14400 ?
I fear there's the problem: just use 57600 or 115200, if 9600 should be too slow for you.
Read its output more carefully, then 9600 is fast enough ![]()
actually 9600 is good but i want more datapoints per sec So i thought my reading of comm port may be slow. So i increased baud rate. 14400 just prints 11111111111111111.... and 19200 giver incorrect datapoints.
Some of the intermediate Baud rates you can choose in SerialMonitor, do not work.
just use 57600 or 115200
If you'd use another Serial program on the PC , which definitely supports 14400, it should work with an Arduino set to that Serial speed.
Does it happen with a pure test sketch?
void setup() {
Serial.begin(14400);
Serial.println ("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
Serial.println ("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
Serial.println ("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
Serial.println ("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
void loop() {
static unsigned long m;
if (millis() - m >= 60000UL) {
m = millis();
Serial.write('.');
}
}
should produce 4 identical correct lines. Then a dot every minute.
Perhaps there's something really wrong with the Arduino's speed: How long does it really take to wait until millis() is at 1800000L
Should be between 29 and 31 Minutes for 30 dots from the test sketch above.