Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 289
61  Using Arduino / Programming Questions / Re: Timer 2 - Clear counter without adding delay to the count on: August 09, 2014, 08:15:20 pm
Given the formula, the prescaler has nothing to do with that. The counter value has to be multiplied by 256 when using Timer 2, and by 65536 when using Timer 1.

Yes.
62  Using Arduino / Programming Questions / Re: Timer 2 - Clear counter without adding delay to the count on: August 09, 2014, 07:51:07 pm
Sorry, just not seeing the big picture here.

Timer2 is 8 bits, yes? Wouldn't the overflow multiplier therefore be 256, instead of 65536?
63  Using Arduino / Programming Questions / Re: Timer 2 - Clear counter without adding delay to the count on: August 09, 2014, 07:24:21 pm
By definition the timer is synchronous with the system clock. What we have is a phase delay, caused by the processing needed to handle the interrupt. However, this should be perfectly determinate, so perhaps the problem is not one of synchronicity but rather the time lag is the issue?

It is indeed.

But Think about this:
An event is generated on an external pin, so an interrupt is called. By the time the interrupt saves TCNT2 and clears it a few clock cycles have passed and this time is lost as the timer restarts from 0.

Sure this could be avoid with input capture, but only timer one has this feature and it is already being used.

Indeed, but without some answers to the questions I asked as to the requirements, we're at a bit of a loss.
64  Using Arduino / Project Guidance / Re: reading 1000ths of a seconds from a pcf8583 rtc on: August 09, 2014, 07:22:29 pm
The problem is that the stock Arduino Uno uses a ceramic resonator instead of a crystal. The best resonator tolerance on Mouser is 0.1%, which is 1000 ppm. A good crystal, on the other hand, will have a few tens of ppm accuracy tolerance.

My recommendation would be to make a barebones Arduino on a breadboard with a crystal instead of a ceramic resonator if you really need accuracy. Then you can use millis() and it will be much more accurate.

All true but if an external RTC is used then its accuracy is the critical factor.  And most will be a few tens of ppm or the ones with TCXOs will be maybe an order of magnitude better.

OP also needs to define "accurate" ... 1000 ppm, 100 ppm, 50 ppm, 10 ppm, or something else?
65  Using Arduino / Programming Questions / Re: Timer 2 - Clear counter without adding delay to the count on: August 09, 2014, 07:15:03 pm
By definition the timer is synchronous with the system clock. What we have is a phase delay, caused by the processing needed to handle the interrupt. However, this should be perfectly determinate, so perhaps the problem is not one of synchronicity but rather the time lag is the issue?
66  Using Arduino / Programming Questions / Re: Timer 2 - Clear counter without adding delay to the count on: August 09, 2014, 07:12:15 pm
What is the nature of the pulse? What is its frequency or period? Does it vary? Within what range? How is "pulse not detected" defined, when a certain amount of time elapses? How much time?
67  Using Arduino / Project Guidance / Re: reading 1000ths of a seconds from a pcf8583 rtc on: August 09, 2014, 06:53:01 pm
The chip has a register for hundredths of a second (datasheet, p8), so it certainly ought to be possible.

If there isn't a library that addresses it, modify an existing library or write a new one. If you really meant thousandths of a second as in the subject line, I'd say you're out of luck.
68  Using Arduino / Programming Questions / Re: Timer 2 - Clear counter without on: August 09, 2014, 06:45:53 pm
Now the issue I am facing is that i need to keep the counter synchronous to the clock frequency and some clock cycles are lost while reseting TCNT2.

Which clock? The MCU system clock? The pulse that's being detected? I don't understand this requirement, the first two sentences seem a good solution to the problem.
69  Using Arduino / General Electronics / Re: Wiring Arduino Micro with Xbee Radio on: August 08, 2014, 10:16:44 pm
Thank you Jack.

I tried two Xbees connected to laptop using two Xbee Explorers + X-CTU. They worked well. That's why it was so confusing when they did not work when I added Arduino.

OK, good. Sounds like a code problem then.

Quote
BTW, please correct me if I am wrong. I though in a network, one Xbee should be Coordinator and the other should be End Device. Is it wrong?

Well, that is one of two ways XBee 802.15.4 modules (f.k.a. Series 1) can be configured. There is also a peer-to-peer configuration and I believe that is the way they come from the factory. I also think most of the discussion I've seen here on the forum is for peer-to-peer. If you don't have the product manual, download a copy.

XBee ZB modules (f.k.a Series 2) OTOH require one coordinator in every network. The rest of the network can consist of routers and/or end devices.

I would assume that the XBee 802.15.4 modules configured as coordinator/end device operate somewhat differently than the XBee ZB modules. How much different they are I cannot say. My experience is primarily with the XBee ZB modules, so I can't comment much more on the XBee 802.15.4 modules and especially when they are configured as coordinator/end device.

So let's have a look at the the code. How about reposting it just so we know we are looking at the latest code. Put the code between code tags (#), not quote tags. See http://forum.arduino.cc/index.php/topic,148850.msg1118324.html#post_codetags
70  Using Arduino / General Electronics / Re: Wiring Arduino Micro with Xbee Radio on: August 08, 2014, 12:03:04 pm
I've never worked with S1 modules configured as coordinator/end device. Is there some reason for not using just the regular peer-to-peer configuration? Maybe you have already done this, but what I would do first would be to get the microcontroller out of the picture, connect both XBees to XCTU or some other terminal program, i.e. run two copies of the terminal program and verify that they can communicate. End devices can be a bit tricky, making sure they wake up appropriately to communicate.

Sorry but not sure I can be of much more help than that.
71  Using Arduino / General Electronics / Re: Wiring Arduino Micro with Xbee Radio on: August 07, 2014, 11:10:36 pm
- BUT: I cannot use X-CTU to send data from Xbee#2 to Xbee#1. The red LED (connected to pin 6 in your circuit) is not ON when data is sent from Xbee#2.

That sounds like a different problem and a different setup than described in Reply #11.

Pick one. Which shall we work on first?

Also, we need to know what kind of XBees you have.
72  Using Arduino / Programming Questions / Re: Using millis on: August 07, 2014, 07:49:42 pm
Please use code tags when posting code. Here's how:
http://forum.arduino.cc/index.php/topic,148850.msg1118324.html#post_codetags

As Paul said, millis() returns an unsigned long integer, therefore all variables that might contain a value returned from millis() should be unsigned long.

Back to the original post, I thought the goal was to eliminate calls to delay()?
73  Using Arduino / General Electronics / Re: Wiring Arduino Micro with Xbee Radio on: August 07, 2014, 08:13:00 am
Hi,

May I know whether anything would be added in the circuit given by Jack Christensen at pin DOUT of Xbee if I wanted to receive data at my Arduino Leonardo? (pin DOUT is connected to Rx pin of Arduino)

Using the circuit on breadboard#1, I could send data from Xbee#1 to Xbee#2. Xbee#2 was connected to my laptop by a Xbee Explorer. I moved Xbee#2 to breadboard#2 and connected Xbee#2 to an Arduino Leonardo (I reused the circuit given by Jack). I could not receive data at Xbee#2.

Does anyone have any suggestion? Tks a lot.

It should work the same. Surely XBee #2 must still be receiving the data, assuming it is powered and connected correctly. Else it must be a code issue. The Leonardo is reading the XBee on Serial1, correct?
74  Using Arduino / General Electronics / Re: Gauging Interest: Printed Circuits on Paper on: August 06, 2014, 09:11:21 pm
Jack, the traces that go nowhere are likely SMD pads. I don't know if that particular board is double-sided or not, I do know that people are making double-sided boards by inkjet, toner transfer, and photoresist.

The SMD pads are pretty obvious, I meant the other ends that just seem to go nowhere, like these:
75  Using Arduino / Programming Questions / Re: Why does digitalWrite disable global interrupts before changing a pin state? on: August 06, 2014, 08:25:14 pm
out is pointer to an IO register, which is volatile.  It can change other than by program action.  If you output to it twice, you want to output to it twice, and not just with the last value.  (hopefully the "volatile" is in the right place and means "this is a pointer to a volatile value", rather than "this is a volatile pointer to a value."  You have to be careful with that...)

Thanks, that makes sense. Found a decent explanation of the various permutations here, so it does appear to be coded correctly. Oy. smiley-eek-blue
Pages: 1 ... 3 4 [5] 6 7 ... 289