Show Posts
Pages: 1 ... 33 34 [35] 36 37 ... 71
511  Using Arduino / Microcontrollers / Re: SoftwareSerial with ATTiny84 using ATtiny library on: February 26, 2013, 02:48:09 pm
Hmm, you are using the MOSI and MISO lines (0 and 1) as you sense pins.

Code:
CapacitiveSensor cs_4_2 = CapacitiveSensor(1,0);   

Try this instead, works for me (I think, atleast I don't get knock bang errors)

Code:
CapacitiveSensor cs_4_2 = CapacitiveSensor(1,0);   


512  Using Arduino / Microcontrollers / Re: SoftwareSerial with ATTiny84 using ATtiny library on: February 26, 2013, 06:34:07 am
hilukasz
One thing to try:
Ensure that the MISO connection wire is as short (and fat) as possible:

http://arduino.cc/forum/index.php/topic,123388.msg1029246.html#msg1029246
(reply #74)

Quote
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85

This is jusr a warning, just ignore it.

513  Using Arduino / Project Guidance / Re: Analog Comparator Interrupt on: February 25, 2013, 02:06:55 pm
In the datasheet for 1280 it is page 271 and a couple of pages more

page 272 for example:

Quote
• Bits 1, 0 – ACIS1, ACIS0: Analog Comparator Interrupt Mode Select
These bits determine which comparator events that trigger the Analog Comparator interrupt.
The different settings are shown in Table 121.
When changing the ACIS1/ACIS0 bits, the Analog Comparator Interrupt must be disabled
by clearing its Interrupt Enable bit in the ACSR Register. Otherwise an interrupt
can occur when the bits are changed.
Table 121. ACIS1/ACIS0 Settings
514  Using Arduino / Project Guidance / Re: Analog Comparator Interrupt on: February 25, 2013, 10:47:38 am
Ok, I was just looking in the 328 datasheet, I think the only difference will be the name of the Interrupt vector name:

ANALOG_COMP_vect
515  Using Arduino / Project Guidance / Re: Analog Comparator Interrupt on: February 25, 2013, 09:25:26 am
There is no reason to use  assembler.
In my test code below, I set the relevant bits according to the datasheet

Although this is for Attiny2313, I think you could adopt it for the 1280

It is more or less the code I posted earlier http://kalshagar.wikispaces.com/attiny2313

Code:

#include <avr/interrupt.h>
#include <TinyDebugKnockBang.h>
  int a=0;
  static volatile uint8_t capture;
  static volatile uint8_t flag;
  const uint8_t led = 13;
 
//Interrupt code of the comparator
// NB : you need to stabilize the power rail with a capacitor (otherwise you'll have ripples and misreading). With AIN1=Comp-=0v a 200uF is fine.
ISR(ANA_COMP_vect) {
 
    //with this test, ensure that indeed the interrupt result is 1 = V(AIN0) > V(AIN1)
    //(double check ?)
    if ( (ACSR & (1 << ACO))== 0 ) {
        flag=true;
        }
      else
      {
      flag=false;
      }
}
 

void setup() {
    //factory settings is to divide internal clock 8MHz by 8.
    //don't, and just run at 8 MHz (set the clock divider to 1 so no effect)
     Debug.begin(250000);
     pinMode(led,OUTPUT);   
    CLKPR = (1<<CLKPCE);
    CLKPR = 0; // Divide by 1
 
    PORTB &= ~(1<<PB0);    // no Pull-up on PB0
 
    ACSR  |=  (1<<ACI);    // clear Analog Comparator interrupt
    ACSR  |=
        (0<<ACD)   |         // Comparator ON
        (0<<ACBG)  |         // Disconnect 1.23V reference from AIN0 (use AIN0 and AIN1 pins)
        (1<<ACIE)  |         // Comparator Interrupt enabled
        (0<<ACIC)  |         // input capture disabled
        (0<<ACIS1) |         // set interrupt bit on rising edge
        (0<<ACIS0);          //    (ACIS1 and ACIS0 == 11)
   // Enable the interrupt
  ACSR = ACSR | (1 << ACIE);
 
    sei();                 // enable global interrupts
 
 
}
 
   void loop() {/*all the job is done in the interrupt */
     
    //    Debug.println(flag);
       if (flag==true){
       digitalWrite(led,HIGH);
       
       }
      if (flag==false){
       digitalWrite(led,LOW);
       }

    }
516  Using Arduino / Project Guidance / Re: Analog Comparator Interrupt on: February 25, 2013, 06:04:17 am
As an inspiration, here how you coul set up the comparator on a Attiny2313:

http://kalshagar.wikispaces.com/attiny2313
517  Using Arduino / Microcontrollers / Re: no serial output on "Arduino MICRO". on: February 24, 2013, 03:25:51 pm
This one?

http://arduino.cc/en/Guide/ArduinoLeonardoMicro
518  Using Arduino / Microcontrollers / Re: SoftwareSerial on ATtiny: works on Uno, but not on the ATtiny85 on: February 23, 2013, 01:24:17 pm
You could try this fix for sketches > 4.000 bytes:

https://github.com/TCWORLD/ATTinyCore/tree/master/PCREL%20Patch%20for%20GCC
519  Using Arduino / Microcontrollers / Re: SoftwareSerial on ATtiny: works on Uno, but not on the ATtiny85 on: February 23, 2013, 12:20:50 pm
Is your sketch size > 4.000 bytes

Code:
char commandbuffer[100];

Could it be you were out of RAM
520  Using Arduino / Microcontrollers / Re: Arduino 1.0.3 - Arduino Uno and ATTiny85 problems (video included) on: February 23, 2013, 12:17:25 pm
Quote
1) Just connecting arduino uno and pressing Upload sketch button

Try File->Upload using programmer

http://www.ernstc.dk/arduino/attiny85.html
521  Using Arduino / Microcontrollers / Re: Arduino 1.0.3 - Arduino Uno and ATTiny85 problems (video included) on: February 23, 2013, 11:23:56 am
As far as I could see, you miss a connection from Arduino pin 10 to Attiny reset
522  Using Arduino / Microcontrollers / Re: Program Gertboard's ATMega328P directly on: February 23, 2013, 06:58:52 am
That trick only works if your Atmega328 has a bootloader
523  Using Arduino / Microcontrollers / Re: How to use the ATtiny85 reset as an analog input? on: February 23, 2013, 06:46:52 am
Just did a small experiment:

I connected a potmeter to reset pin, and slowly lowered the voltage.
Below is the result.

Readings from 1023 to 455, which means that below 5V * 455/1023 = 2.22V the Tiny will reset.

Code:
Test A0 1023
Test A0 1023
Test A0 1010
Test A0 973
Test A0 955
Test A0 948
Test A0 924
Test A0 907
Test A0 896
Test A0 878
Test A0 870
Test A0 832
Test A0 800
Test A0 768
Test A0 750
Test A0 720
Test A0 669
Test A0 650
Test A0 635
Test A0 609
Test A0 568
Test A0 520
Test A0 488
Test A0 455 -<---resetting
Test A0 455
Test A0 458
Test A0 469
Test A0 464
Test A0 466
Test A0 467
524  Using Arduino / Project Guidance / Re: Attiny 85 projects on: February 22, 2013, 10:44:59 am
I'm not sure I quite understand the question

You can use a serial / USB converter with TinyDebugSerial, or SoftwareSerial.

Or you can use the ISP connection with TinyISP

See more here:

http://www.ernstc.dk/arduino/tinycom.html
525  Using Arduino / Microcontrollers / Re: ATtiny85-20su bootloader/write to issues on: February 22, 2013, 10:36:22 am
Quote
Can I remove arduino pin 10, 11, 12 and 13 once it has finished and the blink sketch is working?

You can remove everything, you now have a standalone Tiny blinker.

As for the Reset Pin, I have heard that you can use it as an analog input pin as long as you don't go under the reset value
Pages: 1 ... 33 34 [35] 36 37 ... 71