Show Posts
Pages: 1 ... 15 16 [17] 18 19 ... 176
241  Using Arduino / General Electronics / FYI: Marking up image, PDF data sheet or schematic on IPad on: July 02, 2014, 02:09:46 pm
I, as many of you, use an ipad to hold device data sheets, schematics, images etc. that are in PDF format.
I have been using PDF EXPERT for some time and highly recommend it. See examples.
You can search, bookmark, draw, highlight, underling, type text, etc...
Highly recommend it if you add documentation to images, or PDFs.
I have no connection with the company.
242  Using Arduino / General Electronics / Re: relay problem on: July 01, 2014, 06:03:12 pm
Do you have the USB ext power selector in the USB position?
243  Using Arduino / Audio / Re: DTMF 2 tones, no Library on: July 01, 2014, 05:46:29 pm
Maybe integrate them with op-amps.
244  Using Arduino / Project Guidance / Re: Single Board aTmega328 and SN75441. SN75441 keeps frying. on: July 01, 2014, 05:36:30 pm
Do you have pin 8 of the 441 going to Vin?
245  Using Arduino / Programming Questions / Re: Corrupted variables? on: June 30, 2014, 04:30:44 pm
Quote
  I've got misbehaving code. Here's the relevant excerpt:
Don't you just hate it when this happened. Bad code!

b2[4]=0; may be writing into the cmd location.
Are you sure you made b2[] large enough?
246  Using Arduino / Programming Questions / Re: T1 timer counter sketch on: June 30, 2014, 12:53:32 pm
Quote
Arduino Digital pin 8 is chip pin portB0, which is "ICP1 (Timer/Counter1 Input Capture Input)" according to the datasheet.
Yes, I see this now.
"ICP1/CLKO/PCINT0 – Port B, Bit 0 ICP1, Input Capture Pin: The PB0 pin can act as an Input Capture Pin for Timer/Counter1."
Page 84.
And
D8 on the UNO
"This bit selects which edge on the Input Capture pin (ICP1) that is used to trigger a capture event. When the ICES1 bit is written to zero, a falling (negative) edge is used as trigger, and when the ICES1 bit is written to one, a rising (positive) edge will trigger the capture."
On page 136 of the Atmega 328 data sheet
Thanks for the help!
247  Using Arduino / Programming Questions / Re: T1 timer counter sketch on: June 30, 2014, 01:31:41 am
When I run the sketch on my UNO D8 does indeed act as the frequency input pin.
That is to say, if I enter a frequency in on D8 the serial monitor does display the correct frequency.
I thought it might have something to do with the setting of TCCR1B but I don't see any reference in the data sheet for the 328 about D8 / pin 14  / (PB0) on the UNO.
TCCR1B =  bit (CS10) | bit (ICES1);  
I'm thinking the T1 counter is being clocked internally and somehow D8's state is monitored, but why D8 and how?


248  Using Arduino / Programming Questions / T1 timer counter sketch on: June 30, 2014, 12:27:27 am
I am trying to figure out why D8 is the input pin in the attached sketch from Nick Gammon.
However I am at a loss.
How is D8 defined in the code?

Code:
// Frequency timer using input capture unit
// Author: Nick Gammon
// Date: 31 August 2013

// Input: Pin D8

volatile boolean first;
volatile boolean triggered;
volatile unsigned long overflowCount;
volatile unsigned long startTime;
volatile unsigned long finishTime;

// timer overflows (every 65536 counts)
ISR (TIMER1_OVF_vect)
{
  overflowCount++;
}  // end of TIMER1_OVF_vect

ISR (TIMER1_CAPT_vect)
  {
  // grab counter value before it changes any more
  unsigned int timer1CounterValue;
  timer1CounterValue = ICR1;  // see datasheet, page 117 (accessing 16-bit registers)
  unsigned long overflowCopy = overflowCount;
 
  // if just missed an overflow
  if ((TIFR1 & bit (TOV1)) && timer1CounterValue < 0x7FFF)
    overflowCopy++;
 
  // wait until we noticed last one
  if (triggered)
    return;

  if (first)
    {
    startTime = (overflowCopy << 16) + timer1CounterValue;
    first = false;
    return; 
    }
   
  finishTime = (overflowCopy << 16) + timer1CounterValue;
  triggered = true;
  TIMSK1 = 0;    // no more interrupts for now
  }  // end of TIMER1_CAPT_vect
 
void prepareForInterrupts ()
  {
  noInterrupts ();  // protected code
  first = true;
  triggered = false;  // re-arm for next time
  // reset Timer 1
  TCCR1A = 0;
  TCCR1B = 0;
 
  TIFR1 = bit (ICF1) | bit (TOV1);  // clear flags so we don't get a bogus interrupt
  TCNT1 = 0;          // Counter to zero
  overflowCount = 0;  // Therefore no overflows yet
 
  // Timer 1 - counts clock pulses
  TIMSK1 = bit (TOIE1) | bit (ICIE1);   // interrupt on Timer 1 overflow and input capture
  // start Timer 1, no prescaler
  TCCR1B =  bit (CS10) | bit (ICES1);  // plus Input Capture Edge Select (rising on D8)
  interrupts ();
  }  // end of prepareForInterrupts
 

void setup ()
  {
  Serial.begin(115200);       
  Serial.println("Frequency Counter");
  // set up for interrupts
  prepareForInterrupts ();   
  } // end of setup

void loop ()
  {
  // wait till we have a reading
  if (!triggered)
    return;
 
  // period is elapsed time
  unsigned long elapsedTime = finishTime - startTime;
  // frequency is inverse of period, adjusted for clock period
  float freq = F_CPU / float (elapsedTime);  // each tick is 62.5 nS at 16 MHz
 
  Serial.print ("Took: ");
  Serial.print (elapsedTime);
  Serial.print (" counts. ");

  Serial.print ("Frequency: ");
  Serial.print (freq);
  Serial.println (" Hz. ");

  // so we can read it 
  delay (500);

  prepareForInterrupts ();   
}   // end of loop
249  Using Arduino / Programming Questions / Re: Help please on: June 29, 2014, 01:07:27 pm
if(distance <= warningZone1);
Get rid of the ; at the end of this line.
250  Using Arduino / Microcontrollers / Re: How to change fuse settings on an ATmega328P-PU? on: June 29, 2014, 12:58:06 pm
Here is a starting point:
http://www.gammon.com.au/forum/?id=11653. Will show the fuse set.
Could be modified to set fuse as needed:
http://www.gammon.com.au/forum/?id=11637
Burning the bootloader sets the fuses:
http://www.gammon.com.au/forum/?id=11635
251  Using Arduino / Project Guidance / Re: IC pin 1 placement convention? on: June 29, 2014, 01:40:18 am
I keep all ICs facing the same direction with pin one on the bottom left.
I really haven't seen anyone reverse this in any of the images I have seen since 1974
252  Using Arduino / Project Guidance / Re: Do I really need that much RAM? on: June 29, 2014, 12:14:42 am
Quote
I just recently retired & I want to take up electronics as a hobby. I'm a newbie.
Congratulations.
You are going to have a lot of fun.
Quote
I'm leaning towards the Mega 2560
If you can afford it, I recommend you learn on an UNO, then move up to something bigger as you learn more.
Next get a Bobuino and maybe 2560 as you get more familiar with hardware.
It's nice to have the ability to replace the controller if you mess up as you can with the UNO and the Bobuino.
Take a look at Nick Gammon's web site for great information on programming and hardware.
http://www.gammon.com.au/scripts/forum.php?bbtopic_id=123


253  Using Arduino / General Electronics / Re: Question about tutorial on: June 28, 2014, 01:10:46 pm

http://electronics.stackexchange.com/questions/56210/what-is-ground-and-what-does-it-do
254  Using Arduino / General Electronics / Re: CONFUSING RELAY TO RELAY CONNECTION on: June 28, 2014, 02:30:03 am
Put it in a pdf/png/jpg etc.
255  Using Arduino / General Electronics / Re: Temperature sensor voltage divider on: June 28, 2014, 02:27:58 am
You could try a series silicon diode ( drops .6 to .7 volts).
4.2 - .6 = 3.6 volts or 3.5 volts if you use .7
Pages: 1 ... 15 16 [17] 18 19 ... 176