Show Posts
Pages: 1 ... 74 75 [76] 77 78 ... 100
1126  Using Arduino / Storage / Re: EEPROM overwite previous data? fixed on: September 09, 2011, 08:05:31 am
I found the problem.....

I had  Wire.endTransmission();    after setting the pointer , removed it and it works
1127  Using Arduino / Storage / Re: EEPROM overwite previous data? on: September 09, 2011, 07:41:18 am

I am back on the RTC project again, and am having trouble writing to the DS1307s RAM,  I have tried a basic sketch just to store and retreive some data ( below )
Am I doing something stupid here?  It just gives me the old data back from the RAM

Code:

/*  just loading the ram for testing
 */
#include <Time.h> 
#include <Wire.h> 
#include <DS1307RTC.h>  // a basic DS1307 library that returns time as a time_t
byte prevday ;          //  prev days of month for display
byte prevmonth ;         //prev month for display
byte prevyear ;         //prev year  for display
byte prevbest ;   // highest longest interval up to 99
byte upperbyte;   //  of previous unix days
byte lowerbyte;   //  -"-
unsigned long old_unix_days;
unsigned long  unidays;
unsigned long  unisecs;
//*************************************************************************************
void setup()  {
  Serial.begin(9600);
  setSyncProvider(RTC.get);   // the function to get the time from the RTC
  if(timeStatus()!= timeSet)
     Serial.println("Unable to sync with the RTC");
  else
     Serial.println("RTC has set the system time");     
     Wire.begin(); // no address, we are master
  Serial.begin (9600);     
}
void loop()
{
 
 
    prevday = 12;
  prevmonth= 10;
  prevyear = 33;
  prevbest = 87;
  upperbyte = 22;
  lowerbyte = 44;
 
 Wire.beginTransmission(0x68); 
  Wire.send(0x08);  // to start of RAM
  Wire.endTransmission(); 

 
 
  Wire.send (prevday);
  Wire.send (prevmonth);
  Wire.send (prevyear);
  Wire.send (prevbest);
  Wire.send (upperbyte);
  Wire.send (lowerbyte);
  Wire.endTransmission();
 Serial.println("finished loading"); 

  Wire.beginTransmission(0x68); 
  Wire.send(0x08);  // to start of RAM
  Wire.endTransmission(); 
  Wire.requestFrom(0x68,6 );  // Read back first six RAM addresses
  prevday = Wire.receive();
  prevmonth = Wire.receive();
  prevyear= Wire.receive();
  prevbest = Wire.receive(); 
  upperbyte = Wire.receive(); 
  lowerbyte = Wire.receive();
  Serial.print ("prev day read " );
  Serial.println (prevday, HEX);
  Serial.print ("prev month read " );
  Serial.println (prevmonth, HEX);
  Serial.print ("prev year read " );
  Serial.println (prevyear, HEX);
  Serial.print ("prev best read " );
  Serial.println (prevbest, HEX);
  Serial.print ("upperbyte read " );  Serial.print (upperbyte, HEX); Serial.print (" ,  upperbyte read " );  Serial.println (upperbyte, HEX);
  Serial.print ("lowerbyte read " );  Serial.print (lowerbyte, HEX);  Serial.print (",   lowerbyte read " ); Serial.println (lowerbyte, BIN);
  long old_unix_days = word (upperbyte, lowerbyte);
  Serial.print(" old_unix_days = ");  Serial.print (old_unix_days); Serial.print(",   old_unix_days = "); Serial.println(old_unix_days, BIN);
}
1128  Community / Bar Sport / the brains OK, but the eyes are gone :-) on: September 04, 2011, 12:53:29 pm

Wasted a bit of precious time today trying to find why my arduino chip did nothing when plugged into a board I have made as an interface ( I have used the same pcb before with no problems )

What threw me was the 78L05 on the board was getting hot , which wasted a lot of my time looking for shorts.

It turned out that one of the two tiny  22Pf caps on the crystal was marked 22J and the other 221  ( 220pF ! )

They both came from my same draw, so I dont know when the rogue one got there.
I will now keep my magnifying glass nearby, and accept my age !
1129  Using Arduino / Programming Questions / Re: why no curly brackets in blink without delay ? on: August 23, 2011, 04:17:03 pm
that was my first thought, but its a bit obvious
1130  Using Arduino / Programming Questions / Re: why no curly brackets in blink without delay ? on: August 23, 2011, 10:54:41 am
My granchildren can do 15 divide by 3 or 5,   or 8 minus 3 or 5 very easily , and cheap   smiley-cool

1131  Using Arduino / Programming Questions / Re: why no curly brackets in blink without delay ? on: August 23, 2011, 08:50:58 am
var = 8 - var;     looks the easy
1132  Using Arduino / Programming Questions / Re: why no curly brackets in blink without delay ? on: August 23, 2011, 05:43:52 am
OK so how does that work, and are Mr Gammon's expensive less than my dividing ?
1133  Using Arduino / Programming Questions / Re: why no curly brackets in blink without delay ? on: August 23, 2011, 04:50:33 am
I'll think about it when I have finished my rush job, it sounds like a " take away the number you first thought of" question  smiley-razz
1134  Using Arduino / Programming Questions / Re: why no curly brackets in blink without delay ? on: August 23, 2011, 04:44:23 am
I am a newbie remember, bu t is it something like  x = 15/ x   ???
1135  Using Arduino / Programming Questions / Re: why no curly brackets in blink without delay ? on: August 23, 2011, 04:14:01 am
thank guys,  that makes sense, and the     ledState = !ledState;    is so self explanatory I will stick to that in future.
1136  Using Arduino / Programming Questions / why no curly brackets in blink without delay ? on: August 23, 2011, 03:11:31 am
I have always used curley brackets around both if and else instructions, as per reference,  but I have just noticed that there are none in the if/else part of the blink without delay example.

  // if the LED is off turn it on and vice-versa:
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;

Whats the difference / advantage?
1137  Using Arduino / Networking, Protocols, and Devices / Re: VirtualWire without PTT ? on: August 22, 2011, 01:23:35 am
I usually use the ptt output to power the Tx, it comes up in plenty of time not to miss any data, and the TX only draws about 10mA.
This way there is no quiescent current drawn by the Tx, even the cheapy ones, between transmissions.

In my current project, I needed 18 pins as input/outputs, so I generated my own ptt from one of my scanning line outputs charging a cap via a diode to keep the TX on, which works fine. ( the ptt of the Tx is 1Mohm impedance )

Even if you dont use the PTT, it seems the VirtualWire setup sets it as an output, ( and the Rx pin 11 as an input,) but I have found you can simply change them back after the VWsetup instruction.

re the serial pins DIO0 and DIO1, I have always been wary of touching them, in case I couldn't reprogram the chip later, but it seems it is OK to use the  DIO0  RXD pin as an input for something else, but I have gone back to using pin 11 again,just in case,  after resetting it to an output.

Meanwhile I wasted half the weekend again due to my confusion with where to use INT, BIN, HEX ,CHAR,BYTE ,    :-)

I got it right in the end, but when I get some spare time I will study it properly again..
1138  Using Arduino / Networking, Protocols, and Devices / Re: VirtualWire without PTT ? Hi Z output pin11 solved on: August 21, 2011, 09:47:36 am

The VirtualWire seems OK with my using pin 10 for one of my switch scanning outputs, but meanwhile pin 10 seems to have a high impedance output ..

I have four 22k pulldown resistors on pins 10, 11 , 12 and 13.

Three of them give 4v output ( on 4v5 batteries ) but pin 11 only gives 1v !  If I switch the switch off ( no load ) it goes to 4v.

Its wasnt the chip socket, or the chip, or the wiring.

If I ran Blink with pin 11 as output it goes to 4v regardless of the 22k being switched to ground or not !

If I took out the VirtualWire from the ketch, the voltage came right.

I then realised that VW setup resets pin 10 to an input, ( I had previously set it as output ) so I declared it an output again after the VW setup and all is well.

Th 22 k pull down resistors were dropping the voltage across the internal pull-ups.

There are 2 other ways I found to get round it,  one is swapping pin 11 with one of my input pins, and the other that I took a gamble on was setting the ( unused) Rx pin as pin 00 ( the rxd pin used in programming it )  but it still works OK with the serial link.  I think setting it as an output will stop you getting back into the chip ?



1139  Using Arduino / Networking, Protocols, and Devices / VirtualWire without PTT ? on: August 20, 2011, 07:47:37 am
I have had a look at the VirtualWire pdf sheet, and it tells me that ptt is default to pin 10, and you can change it to what you want.
But I have a project that I need all the pins to avoid changing harware, so can I just not set ptt in setup, and use pin 10 for something else?

Or must I try looking in the library and see if I can see whats happening, perhaps just delete this from the library ?

   // Set the digital IO pin to enable the transmitter (press to talk)
    // Defaults to 10
    extern void vw_set_ptt_pin(uint8_t pin);

    // By default the PTT pin goes high when the transmitter is enabled.
    // This flag forces it low when the transmitter is enabled.
    extern void vw_set_ptt_inverted(uint8_t inverted);


I can generate ptt from one of the other signals to switch on the Tx module.

1140  Using Arduino / Storage / Re: EEPROM overwite previous data? on: August 16, 2011, 03:08:14 am
Thanks Bob,, that's been superseded by Time.h  which I tried, but it didnt like hours and minutes, so I think I must just rename them in the sample you gave me, and I should be rolling.....
Pages: 1 ... 74 75 [76] 77 78 ... 100