Show Posts
Pages: 1 2 [3] 4 5 ... 280
31  Using Arduino / Storage / Re: Unable to work with 1Mbit EEPROM on: July 20, 2014, 02:25:05 pm
I've just updated an EEPROM library that I wrote a while back, now it should work with EEPROMs from 2k bits to 2048k bits. I'm still testing it but all seems well so far.  If you'd like to give it a try, I'd appreciate the additional testing. Be sure to get the dev branch.

Haven't written the documentation yet smiley-red but there's just a constructor, begin(), read() and write() functions. Should be pretty obvious from the .h file, but if you have questions let me know.
32  Using Arduino / Networking, Protocols, and Devices / Re: Protocols and AVR clock speed on: July 19, 2014, 10:14:13 pm
Is the communication link independant from the devices clock?

Thanks to the core Arduino code, the answer is yes. However, under the covers, registers need to be set to determine the speeds and the system clock speed is indeed a factor in the calculations to determine the settings. A symbol F_CPU is defined that the compiler uses as the clock speed for the calculations. This can be seen by turning on verbose compilation in the IDE. Of course it is important that the actual hardware oscillator frequency agree with the F_CPU value. A common misconception is that the system clock frequency is somehow magically and automatically determined. This is not the case, it is just hard coded in the boards.txt file and nothing ensures that it agrees with the actual hardware other than programmer diligence.

Code:
C:\Users\Jack\Documents\arduino\arduino-1.0.5\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega1284p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105
33  Using Arduino / Programming Questions / Re: Significant difference between millis() and micros() on: July 19, 2014, 06:20:02 pm

Ugh, no, had I realized I'd have avoided such a bad one!  smiley-grin

So, it doesn't use an interrupt, but uses a timer that uses an interrupt.
I stand corrected.

Of course you are correct; I understood the original statement to question whether delay() sets up its own interrupt for each call and of course it does not. Perhaps it's six of one and half a dozen of the other but there is a distinction in my mind.

Quote
I will continue to use delayMicroseconds instead of delay if it's all right with you though.

Whatever floats your boat.

34  Using Arduino / Networking, Protocols, and Devices / Re: Xbee Error checking on: July 19, 2014, 05:29:14 pm
I use Andrew Rapp's library, it works great so I recommend it wholeheartedly:
https://code.google.com/p/xbee-arduino/

As for how long it will take to transfer the image, I have no experience to draw on. All my XBee applications have been small amounts of data at relatively long intervals.

I hope you can give it a go though, because I'd be interested to hear the results.

35  Using Arduino / Networking, Protocols, and Devices / Re: Xbee Error checking on: July 19, 2014, 02:01:27 pm
XBees are low-bandwidth devices. I assume you're using transparent mode? I would not expect to send a large amount of data like that all in one continuous blast. The XBee will break it into packets that contain no more than 84 bytes of data. In transparent mode, it will end up tripping all over itself trying to send packets as fast as possible and also verify the previous packet was sent successfully, retry when needed, etc.

I would use API mode, packetize it myself, send one packet at a time then wait for the ACK before sending another. Be patient because it won't be as fast a process as a person might expect. The baud rate of the serial interface to the XBee has absolutely nothing to do with the RF data link speed, which is a constant, but affected by transmission protocol overhead, other network traffic, etc.

Read the product manual on Digi.com and/or Google for XBee ZB (S2) API mode.
36  Using Arduino / Programming Questions / Re: does spi communication disable interrupt? on: July 19, 2014, 01:52:25 pm
as spi communication disables interrupts several times

What makes you say that? If you're using the SPI library, it doesn't disable interrupts, see SPI.h and SPI.cpp
37  Using Arduino / Programming Questions / Re: Significant difference between millis() and micros() on: July 19, 2014, 12:14:13 pm
but why the difference in time elapsed?

See expanded explanation in reply #8.
38  Using Arduino / Programming Questions / Re: Significant difference between millis() and micros() on: July 19, 2014, 12:09:23 pm
delay() does not use an interrupt, nor does it stop other interrupts, whether they are in quotes or not.

Edit: delay() does depend on the Timer0 interrupt running, so if something is interfering with that, like a very long running ISR or long periods of interrupt-inhibited code, then yes, it can get sketchy.

Code:
void delay(unsigned long ms)
{
uint16_t start = (uint16_t)micros();

while (ms > 0) {
if (((uint16_t)micros() - start) >= 1000) {
ms--;
start += 1000;
}
}
}
39  Using Arduino / Displays / Re: LCD current draw on: July 17, 2014, 08:49:19 am
Quote
Edit: Here is an alternate datasheet, it says backlight requires 120mA typ, 160mA max.

Why didn't I mention those values?  Oh - I did.

Don

A thousand apologies, my bad for reading too quickly smiley-grin
40  Community / Bar Sport / Re: Rescuing an ATmega1284P-AU on: July 17, 2014, 08:48:17 am
So you couldn't just reburn the fuses using a regular AVR SPI interface programmer?

Was it one of these that got you?

JTAGEN, 6,    Enable JTAG, default = 0 (programmed, JTAG enabled)
SPIEN,  5,    Enable Serial Program and Data Downloading, default = 0 (programmed, SPI prog.  enabled)

Tried that first and couldn't get a response with AVRISP MkII and Atmel Studio even at very low clock speeds. JTAGEN and SPIEN were OK. While all the fuse bytes were changed (!), the high and extended fuses were only slightly different. What got me was the oscillator config in the low fuse byte, it was set to low freq osc (i.e. 32kHz crystal)! The chip didn't have a valid clock, so no SPI programming.
41  Community / Bar Sport / Rescuing an ATmega1284P-AU on: July 17, 2014, 07:58:43 am
I guess I've been lucky, because I don't remember this sort of thing happening to me before, but I somehow managed to clobber the fuse bytes while programming an ATmega1284P in the TQFP package.

I was able to set it straight using Jeff Keyzer's MightyOhm HV Rescue Shield. The wiring was pretty sketchy but it worked! I did remove the 10K pullup and 1N4148 diode on the reset pin, and I had to solder a wire to the board to access the 1284P XTAL1 pin.
42  Using Arduino / Displays / Re: LCD current draw on: July 17, 2014, 07:46:29 am
Best to measure the backlight current, depending on the module, these vary all over the map. Lousy datasheet, doesn't give the backlight current spec.

For example, I use these LCD modules (nice sale price right now I see) and I really like that the backlight only needs 15mA @ 5V. This means I can drive them from a PWM pin and vary the brightness.

Edit: Here is an alternate datasheet, it says backlight requires 120mA typ, 160mA max. It says "LED" but it also says "EL", so I suspect the backlight is really electroluminescent.
43  Products / Arduino Yún / Re: Any open source / free alternative to Temboo? on: July 17, 2014, 07:35:14 am
I wrote this guide a long time ago, it's in italian and it's focused on the Arduino UNO + Eth/wifi shield.

That's an extensive guide, nice job (Google Translate did a fair job on it).

Do you run your own copy, or do you use theirs?
44  Using Arduino / Programming Questions / Re: pinMode or digitalWrite firrst.... on: July 16, 2014, 02:40:12 pm
Meant to add, there are no programming rules or conventions in this case, it's more a matter of choosing which gives the best transition for the attached circuitry. Karma always appreciated, thanks. Sometimes I use the attached diagram to visualize and determine the best transition from one state to the next. For any given state, one of the three other states can only be reached by transitioning through an intermediate state.
45  Using Arduino / Programming Questions / Re: pinMode or digitalWrite firrst.... on: July 16, 2014, 12:52:04 pm
Note that there are four possible states:

Output/High
Output/Low
Input/Pullup
Input/No Pullup -- this is the default state after reset

Since the input/output mode is set in the DDR (data direction register), and the output state (or input pullup resistor) is set in the PORT register, both cannot be changed simultaneously.

Therefore after a reset, it takes two steps to get to Output/High. It can be done with either code snippet as you showed. The first will briefly transition through the Input/Pullup state, and the second will briefly transition through the Output/Low state and will sink current at low impedance if a voltage is applied to the pin.

It may or may not make a difference to the connected circuitry. If it does, choose the most compatible path. In general, I would choose going through the Input/Pullup state (the first code snippet) unless I had a specific reason not to. Sounds like this is what you should do if a relay is involved, although the transition may be so fast that the relay is unable to respond for the brief transition through Output/Low.
Pages: 1 2 [3] 4 5 ... 280