Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Microcontrollers / Re: Attiny85 Tiny Core - Override Timer1 Overflow Interrupt ISR with another one? on: March 11, 2014, 08:07:13 pm
Confirmed. I switched it over to Timer0 and I2C /USI is working ok.

Thanks!!

2  Using Arduino / Microcontrollers / Re: Attiny85 Tiny Core - Override Timer1 Overflow Interrupt ISR with another one? on: March 11, 2014, 07:25:29 pm

Thanks! I'm aware of this option, but maybe you can quickly answer this for me...will this affect the USI clock stuff if I move millis to Timer0?? I'm using USI for for I2C communication.
3  Using Arduino / Programming Questions / Re: Problem With Division, Types, and Casting on: March 11, 2014, 07:04:49 pm
This seems to work:

Code:
#define FCPU 8000000L

timerPeriodMicros = ((float)PrescalerVal/(float)FCPU)*(float)1000000L;//.125*PrescalerVal;
period = timerPeriodMicros * periodTicks;//period in microseconds//implicitly cast
return period;

But is there a cleaner or better solution? What's the best way to approach this?
4  Using Arduino / Programming Questions / Re: Problem With Division, Types, and Casting on: March 11, 2014, 06:43:11 pm
Prescaler Holds an integer value between 1 and 16384

Yes, I understand about Integer Division, but I have defined TimerPeriodMicros as a float. That allows decimals, to my understanding... Does implicit casting not work that way? Do I need to cast as float on the right hand side of the equation?

I guess I'm just thrown off. Also, I'd like to accomplish my math in one line versus two lines like above.
5  Using Arduino / Programming Questions / Re: Problem With Division, Types, and Casting on: March 11, 2014, 06:18:52 pm
Why? And what's the remedy?
6  Using Arduino / Microcontrollers / Attiny85 Tiny Core - Override Timer1 Overflow Interrupt ISR with another one? on: March 11, 2014, 06:11:11 pm
I'm implementing some code and I am not using millis() and micros() which take advantage of the existing Timer1 Overflow ISR in Wiring.C file.

I need to implement a different routine. Is there a smart way via code to override or reroute to my new ISR? Meaning without deleting or commenting things out in the Wiring.C file. I don't want to fuss with the core files, I just want my own routine on top.

For reference:
 Here' the compile error I'm getting when I use my ISR:
Quote
core.a(wiring.c.o): In function `__vector_4':
C:\Users\Me\Documents\Arduino\hardware\tiny\cores\tiny/wiring.c:78: multiple definition of `__vector_4'

Digging that up leads to : ISR(MILLISTIMER_OVF_vect)

Thanks!
7  Using Arduino / Programming Questions / Re: Converting and Integer Array into One Single Number!!? on: March 11, 2014, 05:59:01 pm
Hi,

would something like this work for you:

Code:
number=0;
exponent=5;
for (int i=1;i<=5;i++)
{
number = number+num[i]*(10^exponent);
exponent--;
}
8  Using Arduino / Programming Questions / Problem With Division, Types, and Casting on: March 11, 2014, 05:17:32 pm
Hi I'm writing some lower level code for an Attiny85 and have a CPP file that does the heavy lifting for the arduino. I'm using the Tiny Cores found on google code.

Anyway, I have simplified down my expression to the following to showcase where the problem is:

Code:
static volatile float timerPeriodMicros;
static volatile uint32_t Period;
static volatile uint16_t PrescalerVal;
#define FCPU 8000000
...

function GetPeriod(void)
{
TimerPeriodMicros = (PrescalerValue/FCPU) * 1000000; //returns zero always. It should return something like 512 or Timer1 Tick period
//Re-arranging the math to PrescalerValue*(1000000/FCPU) also fails
//Re-arranging the math to PrescalerValue*.125 works!
Period = TimerPeriodMicros * PeriodTicks;
return Period;
}

Any suggestions would be helpful!

Thanks!
9  Using Arduino / Microcontrollers / Re: Tuning Internal Oscillator of ATTiny85 - Hardware Setup for Two Way Serial? on: March 04, 2014, 11:24:41 pm
It appears to be working  smiley-cool ...Thanks Codingbadly for the Poor Man's Tuner code...

You are welcome.  I'm glad you got it working.

Have you considered using Tiny Tuner 2?


I'll give it a shot!...Briefly, what are the differences/advantages of Version 2?

Also, before I start digging deeper...what is Tiny Debug Knock Bang? Lastly, will the hardware setup above work for this tuner?
10  Using Arduino / Networking, Protocols, and Devices / Re: Need Help Getting I2C TinyWireS Slave code working in ATtiny85.. on: February 25, 2014, 03:45:00 pm
Well, the results seem inconsistent, but now I'm getting clean transfers when it's working...
Here's a updated screenshot.[click to enlarge]

Would you like me to zoom in on a specific part?

I am using Micros to capture some time.

Here's my ISR:
Code:
//PCINT Interrupt
ISR(PCINT_VECTOR)
{
  microsTemp = micros(); //get time first!
  if (ReadPinState()>0)//pin is high/rising edge
  {
   
    InterruptCount++;
    switch(InterruptCount)
    {
      case 1: t1=microsTemp;//start time
              counting=true;
              break;
      case 2: t2=microsTemp;//end time
              counting=false;
              InterruptCount=0;//reset count
              break;
      default:
              //InterruptCount=0;
              break;
    }

  }
}
11  Using Arduino / Microcontrollers / Re: ATtiny85 Counter/Timer0 Input for Frequency Capture on: February 25, 2014, 03:19:40 pm
I got it calibrated with the Poor Man's Tuner. Though I know each chip's results will be different mine is :
OSCCAL = 0x45;
Calibration steps are linked in my previous post/thread above.

Anyway, I added that line into my code and it's MUCH more accurate...Something I can live with. I'd like better, but this will do for now.

The problem I'm having now is some delays in getting the correct value that I'm getting with my I2C communication with another device. I'm sending the measured period to the master device...


12  Using Arduino / Microcontrollers / Re: Tuning Internal Oscillator of ATTiny85 - Hardware Setup for Two Way Serial? on: February 25, 2014, 02:12:18 pm
Update:

It appears to be working  smiley-cool ...Thanks Codingbadly for the Poor Man's Tuner code... Here are my steps to implement.:

a)Assumptions: Attiny85 with Tiny Core running @ 8mhz.
b)You have an Duemilanove laying around. Other boards may work, but I only tested with my Duemilenova

1. Download TinyTuner v0003 here: https://code.google.com/p/arduino-tiny/downloads/detail?name=TinyTuner-0003.zip
2. Load  Interactive_to_Serial_with_Details.pde onto your ATtiny85.
3. Take your Duemilanova and load the BareMinimum sketch onto it. http://arduino.cc/en/Tutorial/BareMinimum
4. Unplug Duemilanova from USB/power
5. The wiring: 10uF cap between Reset and Ground(do this after you load the sketch! otherwise it won't load)

(I'm betting it's probably good to have a 330 ohm resistor with the RX pin as well, but I didn't have any, and I just gave it a shot. it worked.
6.Plug in USB and load serial monitor at 9600 baud rate.)
7. Follow on-screen instructions...(pressing 'x')

I hope this helps some guys out there and saves a few hours of googling.
13  Using Arduino / Microcontrollers / Re: ATtiny85 Counter/Timer0 Input for Frequency Capture on: February 25, 2014, 11:40:20 am
@Erni, awesome!

I'm trying to find out how to tune my Attiny. I can't find a complete guide and having some issues. I'm trying to use my Deumilanova for facilitate the serial communication to tune it.  Any ideas?

I just made another thread here: http://forum.arduino.cc/index.php?topic=221296.msg1608068#msg1608068
14  Using Arduino / Microcontrollers / Tuning Internal Oscillator of ATTiny85 - Hardware Setup for Two Way Serial? on: February 25, 2014, 11:37:56 am
Hi Everyone,

I've been researching quite a bit, and haven't found what I'm looking for. I found the poor man's tiny tuner by coding badly and I'm looking for the right two-way serial communiction to accomplish this with regards to the right hardware to connect to the ATtiny to get two-way serial communication. In particular, can I use a Duemilnove to do it? As a "Serial Converter"

I got one-way communication working: http://www.ernstc.dk/arduino/tinycom.html

I grabbed the featured download -  TinyTuner_0003.

Which sketch from the example should I be using?
My findings:
 Interactive_to_Serial_with_Details.pde is the only one that compile without errors. and I can use the TX on my deumilanova to receive. But cannot send the 'x' yet....

Interactive_to_Serial.pde compiles with multiple errors mainly 'TinyTuner was no declared in this scope'
Interactive_with_NewSoftSerial.pde - Not sure this is updated for latest arduino with softserial. I even added NewSoftSerial library from here: http://arduiniana.org/libraries/newsoftserial/ and installed it. Then I get Tiny84Tuner not delcared in this scope. I replaced it with TinyTuner and get TinyTuner has no member "getState"..I stopped there.

Anyway, just looking for clarification and the best way to accomplish this so I can tune my ATTinys.

Thanks.

ref: http://forum.arduino.cc/index.php/topic,8553.0.html
&
http://forum.arduino.cc/index.php/topic,5621.0.html <- it's not precisely clear what to do here with regards to ATTiny.
15  Using Arduino / Microcontrollers / Re: Newbie question about Arduino with ATtiny85 on: February 24, 2014, 05:53:02 pm
Hey Lee,

In Arduino....Change your board to the Attiny85 @ 8Mhz (or something of that like) and then goto Tools -> Burn Bootloader. That will change the fuses so you're running at 8Mhz.

goodluck!
Pages: [1] 2 3 4