Show Posts
Pages: 1 ... 52 53 [54] 55 56 ... 116
796  Using Arduino / General Electronics / Re: Arduino MEGA on another PCB on: January 18, 2013, 07:22:47 am
Ok, yeah, thats one of the annoying things about eagle.

There is a way around it though. If you select the mega footprint with the move tool, then while it is following the mouse, there is a button on the toolbar at the top which looks like a grid of 4 squares, the two on the left are shaded and there is a line down the middle. If you click that it will mirror the footprint and you can then place it down within the board outline.
797  Using Arduino / General Electronics / Re: Arduino MEGA on another PCB on: January 17, 2013, 06:57:57 am
The outline has the pin headers on it aswell, correct?

If so, place it on the board, and then use the MIRROR command to flip it onto the bottom layer. This will simulate the mega board being upside down. As the pin headers are through hole, you can simply mount the header on the top of the board.
798  Using Arduino / General Electronics / Re: Arduino MEGA on another PCB on: January 17, 2013, 04:29:30 am
Google 'Sparkfun Eagle Library', its on github and the outline and pin positions of a mega are in that library.

Edit: https://github.com/sparkfun/SparkFun-Eagle-Libraries
799  Using Arduino / Programming Questions / Re: SOftware RESET for arduino Demilanove on: January 17, 2013, 04:25:49 am
That was just an example. You would call the systemReset() function at any point in the program you want. Wrap it in an if statement, for example:

Code:
#define someIO 2
void setup()
{
  // This code will only run once, after each powerup or reset of board
  pinMode(10,OUTPUT);
  digitalWrite(10,LOW);
  digitalWrite(someIO,HIGH); //enable pullup-resistor
  pinMode(someIO,OUTPUT); //THEN set to output, by doing so, pin is already high when switching to output meaning reset is not tripped.

  Serial.begin(115200);
}

void systemReset(void){
  digitalWrite(someIO,LOW);
  while(1);
}

void loop()
{
  static unsigned long nextMillis = millis() + 1000;
  // This code loops consecutively
  if (millis() > nextMillis){
    digitalWrite(10,!digitalRead(10));
    nextMillis += 1000;
  }
  if (Serial.available() && (Serial.read() == 'K')){
     systemReset(); //reset only when you send the uppercase letter 'K' (for kill?) through the serial port
  }
}
800  Using Arduino / Programming Questions / Re: SOftware RESET for arduino Demilanove on: January 16, 2013, 11:49:23 am
Hmm, its roughly half of the MAX reset period (1us). If you use a diode rather than a wire then the delay becomes 300x the reset period required (800us) - Cathode to digital pin, Anode to reset pin.
801  Using Arduino / Programming Questions / Re: SOftware RESET for arduino Demilanove on: January 16, 2013, 11:30:07 am
It works because there is more in the circuit that just an I/O pin connected from an output to the reset pin.

Consider that there is also the "Auto-Reset" 100nF capacitor connected between the pin and GND (or +5v depending on how the DTR pin of the USB-Serial chip is set).

When the I/O pin goes low, it discharges (or charges if DTR=5v) that capcitor rapidly down to around 0v with respect to the GND at the reset pin end. When the chip then puts the I/O pins into a High-Z state, the 10k pullup has to charge (or discharge) that capacitor back up to +5v at the reset pin end which takes some time - sufficient time to reset the chip. If it wasn't sufficient time, the autoreset function itself wouldn't work.
802  Using Arduino / Programming Questions / Re: SOftware RESET for arduino Demilanove on: January 16, 2013, 11:09:08 am
regarding point (2). I have used this method in several projects and it works fine from what I have seen.

Try this out:
Code:
#define someIO 2
void setup()
{
  // This code will only run once, after each powerup or reset of board
  pinMode(10,OUTPUT);
  digitalWrite(10,LOW);
  digitalWrite(someIO,HIGH); //enable pullup-resistor
  pinMode(someIO,OUTPUT); //THEN set to output, by doing so, pin is already high when switching to output meaning reset is not tripped.
}

void systemReset(void){
  digitalWrite(someIO,LOW);
  while(1);
}

void loop()
{
  // This code loops consecutively
  delay(1000);
  digitalWrite(10,HIGH);
  delay(1000);
  systemReset();
}

you will see an LED connected to pin10 blink on for a second then go off for a second (and the bootloader LED flashes in between). (This assumes pin 2 is connected to the reset pin).
803  Using Arduino / Programming Questions / Re: SOftware RESET for arduino Demilanove on: January 16, 2013, 10:14:43 am
Simplest way to do it:
Code:
void systemReset(void){
  WDTCR = _BV(WDCE) | _BV(WDE);
 
  WDTCR = _BV(WDE);
  while(1); //will reset in 16ms
}

More complex way (requires I/O pin):

Code:
void setup(void){
  digitalWrite(someIO,HIGH); //enable pullup-resistor
  pinMode(someIO,OUTPUT); //THEN set to output, by doing so, pin is already high when switching to output meaning reset is not tripped.
}

void systemReset(void){
  digitalWrite(someIO,LOW);
  while(1);
}
Just connect one of the Arduino digital pins to the reset pin, and then replace 'someIO' with the number for the pin you chose.
804  Using Arduino / Microcontrollers / Re: Advantages of Arduino Uno over PIC18F4550 on: January 16, 2013, 09:47:31 am
C++ and AVR-GCC.

There is free a C compiler for PIC18 but it doesn't do any sort of optimisation and it is very strict in how it likes you to write code - if you want a compiler which optimises the code you have to pay Microchip many hundreds of pounds. The one thing I have found when working with PICs is that there software is so intermittent in whether or not it works.

The AVR also has better (well more useful) hardware timers (PWM, counters, interrupts etc).
805  Using Arduino / Displays / Re: SOLVED - unable to make it work 1.8 SPI TFT 128x160 on: January 16, 2013, 07:26:53 am
Don't forget that

MOSI > MISO
MISO > MOSI

One devices OUT is another devices IN.


No...

MOSI -> MOSI
MISO -> MISO

MOSI = "Master OUT, Slave IN"
MISO = "Master IN, Slave OUT"

The Slave devices IN pin, connects to the Master devices OUT pin, so the Slave MOSI and Master MOSI must be connected.

This is not UART, its SPI, where data moves around in a loop containing shift registers.
806  Using Arduino / Microcontrollers / Re: Reset pin on attiny85 on: January 14, 2013, 12:04:40 pm
Unless you use a bootloader.

I have had success with an Attiny84 using its internal oscillator with my customised version of optiboot installed on it, and then disabling its reset pin. I can then use UART to upload new programs.

The process should work for the Attiny85 also.

If you download this core:
https://github.com/TCWORLD/ATTinyCore/

Then in the IDE, select "Optiboot Attiny85 @8MHz", and then using ISP, burn the bootloader using the IDE.

Then connect the attiny to a serial port (you can use an arduino board with its processor removed). PB1 is the Tiny RX pin, PB0 is the Tiny TX pin.

If you open the serial monitor at 9600 board, then unplug power for the Attiny and reconnect it again (to reset it), it should print stuff to the serial monitor. If you can't read it dont worry, just keep sending the letter 'x' (lower case) with no line ending. Each time it will print something to the serial monitor. Eventually (maybe 10 to 15 times of sending 'x') it will stop printing stuff. At this point the bootloader is ready and the internal oscillator is calibrated.

You should then be able to upload sketches via the serial port. Once you have confirmed that you can do that, you will need to use avrdude to set the fuses to disable the reset pin making sure not to erase the chip.
807  Development / Other Software Development / Re: Library for Nokia LCD (128x128) on: January 13, 2013, 06:32:15 am
The latest version, V3.3 adds support for rotating the screen 90,180, and 270 degrees (anticlockwise) to allow your nokia display to be mounted in any direction and have the screen the correct way up.
There is also now support for character wrapping, whereby if a string is too long for the screen, it is automatically wrapped onto a new line.
https://github.com/TCWORLD/gLCD-Library
808  Using Arduino / Microcontrollers / Re: stk500_getsync() not in sync resp=0x00 error for arduino uno breadboard on: January 11, 2013, 06:41:26 am
No, the OP was correct in connecting TX->TX and RX->RX. The recieve pin on the Arduino board is labelled with reference to the Atmega chip (So arduino RX=USB-TX). In order to use the onboard USB-Serial chip, you need to make sure the same is the case for the breadboard chip.

OP: Did you remove the Atmega chip from the Arduino when you were using it as a USB-Serial converter?
809  Using Arduino / Displays / Re: Nokia LCD display shield question on: January 10, 2013, 01:17:17 pm
I have now added the ability to rotate the screen either 0, 90, 180 or 270 degrees clockwise. (as of Version 3.4).

It should be noted that doing so reduces the performance of the display in any mode other than 0degrees because the coordinates have to be remapped before being send to the screen.
The impact is mostly confined to text and drawing lines.
Filling areas such as with Clear() or Box() doesn't require remapping so is unaffected.

https://github.com/TCWORLD/gLCD-Library/tree/master/Downloads
810  Using Arduino / Programming Questions / Re: Array of functions (addressing multiple identical sensors) on: January 10, 2013, 06:27:59 am

I've come up with the following, which compiles. Not sure if this is the right way to go, or if it's garbage.
Code:

  Serial.begin(9600);
  for (int i=0; i<(maxDHT-1); i++) {
    Serial.print(i), Serial.print("\n");
    DHT aDHT(i, 11); //define a new DHT at pin i with type 11;
    myDHT[i]=&aDHT; // store pointer to aDHT in array myDHT at index i
  };


The problem with that code is that the aDHT instances go out of scope at the end of the for loop and so the array of pointers will become invalid.
Pages: 1 ... 52 53 [54] 55 56 ... 116