Washington
Offline
God Member
Karma: 20
Posts: 717
Firefox & Arduino rocks
|
 |
« Reply #75 on: August 14, 2012, 12:42:37 pm » |
#elif F_CPU == 1200000 /* 9.6MHz internal oscillator with sys clock divided by 8 (default) */ x = ovrf / 4.687; /* 1,200,000/256/1000 = 4.6875 overflows per millisecond */
If you need to divide by 4.687 without using floating point, you can use any of the "best rational approximations" of the number, to the precision required: 4.687 = 5 ± 6.7% 4.687 = 14/3 ± 0.4% 4.687 = 75/16 ± 0.01% 4.687 = 539/115 ± 0.001% . . . For example, choosing the ±0.01% value: x = ovrf * 16 / 75; Just remember to do the multiplication before the division, because the division truncates, and not to use too large a multiplication as to cause overflow. (If times 16 is too much in this case, you could use 14/3 ± 0.4% and only multiply by 3.) I have attached a Python program to compute these fractions for a given floating number, based on this example. smeezekitty: maybe you could use this trick to increase the precision of millis()? Note you do have to watch flash use very carefully to maximize the space available for the main program. 6.7% is not really an unreasonable for an attiny chip and obviously not the biggest error. Nonetheless I will probably try your method while watching flash usage.
|
|
|
|
|
Logged
|
Avoid throwing electronics out as you or someone else might need them for parts or use. Solid state rectifiers are the only REAL rectifiers. Resistors for LEDS!
|
|
|
|
lost in cyber space
Offline
Newbie
Karma: 1
Posts: 25
|
 |
« Reply #76 on: August 15, 2012, 10:09:50 am » |
I have read this and several other posts on programing an ATtiny13 (13A in my case). I have owned an Arduino Uno R3 for about a week so be prepared for nube questions. I have been searching the web and have seen several tutorials that refer to using the arduino as an ISP but then go on to use something else to actually program the ATtiny so I am a bit lost. If there is aArduino ISP ATtiny programing for dummies pleas provide a link  I have the latest version of core 13_014 installed as follows C:\arduino\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\arduino\core13. I have seen at least three different boards.txt modifications in this thread, which one should I use??? I see use a bootloader then statements that the ATtiny can't ??? I understand the pin assignments have to be changed to match the ATtiny but at the moment I need to figure out how to get the ISP to communicate with the MCU without generating numerous error messages. this is what I get when attempting upload arduinoISP from the examples C:\arduino\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\arduino\core13\main.cpp: In function 'int main()': C:\arduino\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\arduino\core13\main.cpp:11: error: 'init' was not declared in this scope C:\arduino\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\arduino\core13\main.cpp:12: error: 'setup' was not declared in this scope C:\arduino\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\arduino\core13\main.cpp:13: error: 'loop' was not declared in this scope Attempting to run tools/burn bootloader produces avrdude: stk500_getsync(): not in sync: resp=0x00 .1uf capacitor between reset and ground does not have any effect. Here is the code I have hacked and would like to have my ATtiny execute, strobes and anti collision lights for an RC aircraft. /* Blink Turns on an LED on for three 250 ms blinks, then off for one second, repeatedly. This example code is in the public domain. */
// give it a name: int led = 13; int ledpin = 10; int fadePin = 9; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(led, OUTPUT); pinMode(ledpin, OUTPUT); }
// the loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for a second digitalWrite(led, LOW); digitalWrite(ledpin, HIGH); // turn the LED off by making the voltage LOW delay(100); digitalWrite(ledpin, LOW); digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for 14 second digitalWrite(led, LOW); digitalWrite(ledpin, HIGH); // turn the LED off by making the voltage LOW delay(100); digitalWrite(ledpin, LOW); digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for 1/4 second digitalWrite(led, LOW); digitalWrite(ledpin, HIGH); delay(100); digitalWrite(ledpin, LOW); // turn the LED off by making the voltage LOW // turn the LED off by making the voltage LOW delay(100); // wait for a second
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=10) { // sets the value (range from 0 to 255): analogWrite(fadePin, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(40); }
// fade out from max to min in increments of 5 points: for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { // sets the value (range from 0 to 255): analogWrite(fadePin, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(20); } }
|
|
|
|
|
Logged
|
|
|
|
|
lost in cyber space
Offline
Newbie
Karma: 1
Posts: 25
|
 |
« Reply #77 on: August 15, 2012, 12:16:15 pm » |
After hours spent getting errors I have discovered that using the files in core 13_014 and core 13_015 do not work with my UNO R3. Something in the instruction set points to invalid functions causing the Uno to not accept any new instructions. I have modified #include "WProgram.h" per the instructions in Read this before posting a programming question ... still no luck. I have verified this issue by deleting the core13 folder and uploading the blink example and my altered version posted above which would not upload previously. Now both sketches are working just fine on the Uno and bread board with resistors & LEDs installed. Can anyone verify that the file set provided actually works with an Uno R3 with an ATMEGA328P-PU and software ver arduino-1.0.1 or provide instructions on how to modify the code to work properly? I am running Win Vista home basic with SP2
|
|
|
|
« Last Edit: August 15, 2012, 03:16:56 pm by gizmoDave »
|
Logged
|
|
|
|
|
Washington
Offline
God Member
Karma: 20
Posts: 717
Firefox & Arduino rocks
|
 |
« Reply #78 on: August 15, 2012, 03:33:07 pm » |
Let me first suggest going here: http://elabz.com/arduino-shrunk-how-to-use-attiny13-with-arduino-ide/I have read this and several other posts on programing an ATtiny13 (13A in my case). I have owned an Arduino Uno R3 for about a week so be prepared for nube questions. I have been searching the web and have seen several tutorials that refer to using the arduino as an ISP but then go on to use something else to actually program the ATtiny so I am a bit lost. If there is aArduino ISP ATtiny programing for dummies pleas provide a link  I haven't had any problems using my Duemillanove to program an Attiny13A and I have head that the Uno R3 works fine as an ISP but I do not have one to try it. I have the latest version of core 13_014 installed as follows C:\arduino\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\arduino\core13. I have seen at least three different boards.txt modifications in this thread, which one should I use???
The boards.txt file is a confusing creature. This works for me: attiny13.name=Attiny 13A standalone attiny13.upload.using=arduino:arduinoisp attiny13.upload.maximum_size=1024 attiny13.upload.speed=19200 attiny13.bootloader.low_fuses=0x6A attiny13.bootloader.high_fuses=0xFF attiny13.bootloader.path=empty attiny13.bootloader.file=empty attiny13.bootloader.unlock_bits=0xFF attiny13.bootloader.lock_bits=0xFF attiny13.build.mcu=attiny13 attiny13.build.f_cpu=9600000L attiny13.build.core=core13
I see use a bootloader then statements that the ATtiny can't ???
The attiny13 is too small to support a bootloader so the upload bootloader command only burns the fuses. It should not be strictly necessary but it may run the wrong clock speed if you do not. I understand the pin assignments have to be changed to match the ATtiny but at the moment I need to figure out how to get the ISP to communicate with the MCU without generating numerous error messages. Changing pin assignments is trivial once it is working. this is what I get when attempting upload arduinoISP from the example
C:\arduino\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\arduino\core13\main.cpp: In function 'int main()': C:\arduino\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\arduino\core13\main.cpp:11: error: 'init' was not declared in this scope C:\arduino\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\arduino\core13\main.cpp:12: error: 'setup' was not declared in this scope C:\arduino\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\arduino\core13\main.cpp:13: error: 'loop' was not declared in this scope
The files on your system should be located in C:\arduino\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\core13. You have them one directory too deep. Attempting to run tools/burn bootloader produces
avrdude: stk500_getsync(): not in sync: resp=0x00
Ensure the ArduinoISP sketch is installed properly and recheck your wiring. In any case, we will deal with these errors once we get rid of the compiler errors. .1uf capacitor between reset and ground does not have any effect.
Ensure the capacitor is disconnected when uploading to the Arduino and connected when uploading to the attiny. Here is the code I have hacked and would like to have my ATtiny execute, strobes and anti collision lights for an RC aircraft. /* Blink Turns on an LED on for three 250 ms blinks, then off for one second, repeatedly. This example code is in the public domain. */
// give it a name: int led = 13; int ledpin = 10; int fadePin = 9; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(led, OUTPUT); pinMode(ledpin, OUTPUT); }
// the loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for a second digitalWrite(led, LOW); digitalWrite(ledpin, HIGH); // turn the LED off by making the voltage LOW delay(100); digitalWrite(ledpin, LOW); digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for 14 second digitalWrite(led, LOW); digitalWrite(ledpin, HIGH); // turn the LED off by making the voltage LOW delay(100); digitalWrite(ledpin, LOW); digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for 1/4 second digitalWrite(led, LOW); digitalWrite(ledpin, HIGH); delay(100); digitalWrite(ledpin, LOW); // turn the LED off by making the voltage LOW // turn the LED off by making the voltage LOW delay(100); // wait for a second
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=10) { // sets the value (range from 0 to 255): analogWrite(fadePin, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(40); }
// fade out from max to min in increments of 5 points: for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { // sets the value (range from 0 to 255): analogWrite(fadePin, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(20); } }
That uses the wrong pins so the attiny will not do anything but this should be addressed after the other errors are addressed. After hours wasted I have discovered that using the files in core 13_014 do not work with my UNO R3. Something in the instruction set points to invalid functions causing the Uno to not accept any new instructions.
This is most likely because of the wrong directory structure. Can anyone verify that the file set provided actually works with an Uno R3 with an ATMEGA328P-PU and software ver arduino-1.0.1 or provide instructions on how to modify the code to work properly? I need the ATtiny13 programmed to run this sketch as size and weight are an issue for my project.
I can verify that the file set works on Arduino-1.0.1 but cannot verify it works on the Uno since I do not have one. I do not see any reason why it would not work though. I am running Win Vista home basic with SP2
Windows Vista SP1 here but it should not matter much. Also: It is very important that the correct board be selected
|
|
|
|
« Last Edit: August 15, 2012, 03:37:09 pm by smeezekitty »
|
Logged
|
Avoid throwing electronics out as you or someone else might need them for parts or use. Solid state rectifiers are the only REAL rectifiers. Resistors for LEDS!
|
|
|
|
lost in cyber space
Offline
Newbie
Karma: 1
Posts: 25
|
 |
« Reply #79 on: August 15, 2012, 09:06:34 pm » |
Let me first suggest going here: http://elabz.com/arduino-shrunk-how-to-use-attiny13-with-arduino-ide/I have read this and several other posts on programing an ATtiny13 (13A in my case). I have owned an Arduino Uno R3 for about a week so be prepared for nube questions. I have been searching the web and have seen several tutorials that refer to using the arduino as an ISP but then go on to use something else to actually program the ATtiny so I am a bit lost. If there is aArduino ISP ATtiny programing for dummies pleas provide a link  I managed to get to step 8 in the EZlab link before I got error "avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny13 I searched and found this error can be ignored? I haven't had any problems using my Duemillanove to program an Attiny13A and I have head that the Uno R3 works fine as an ISP but I do not have one to try it. I have the latest version of core 13_014 installed as follows C:\arduino\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\arduino\core13. I have seen at least three different boards.txt modifications in this thread, which one should I use???
The boards.txt file is a confusing creature. This works for me: attiny13.name=Attiny 13A standalone attiny13.upload.using=arduino:arduinoisp attiny13.upload.maximum_size=1024 attiny13.upload.speed=19200 attiny13.bootloader.low_fuses=0x6A attiny13.bootloader.high_fuses=0xFF attiny13.bootloader.path=empty attiny13.bootloader.file=empty attiny13.bootloader.unlock_bits=0xFF attiny13.bootloader.lock_bits=0xFF attiny13.build.mcu=attiny13 attiny13.build.f_cpu=9600000L attiny13.build.core=core13
I got more errors using your example ended up using the one from EZlab,it produced less errors I see use a bootloader then statements that the ATtiny can't ???
The attiny13 is too small to support a bootloader so the upload bootloader command only burns the fuses. It should not be strictly necessary but it may run the wrong clock speed if you do not. I understand the pin assignments have to be changed to match the ATtiny but at the moment I need to figure out how to get the ISP to communicate with the MCU without generating numerous error messages. Changing pin assignments is trivial once it is working. this is what I get when attempting upload arduinoISP from the example
C:\arduino\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\arduino\core13\main.cpp: In function 'int main()': C:\arduino\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\arduino\core13\main.cpp:11: error: 'init' was not declared in this scope C:\arduino\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\arduino\core13\main.cpp:12: error: 'setup' was not declared in this scope C:\arduino\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\arduino\core13\main.cpp:13: error: 'loop' was not declared in this scope
The files on your system should be located in C:\arduino\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\core13. You have them one directory too deep. Thanks I missed that one completely, reloaded with the correct directory structure and things seem to be working much better. Attempting to run tools/burn bootloader produces
avrdude: stk500_getsync(): not in sync: resp=0x00
Ensure the ArduinoISP sketch is installed properly and recheck your wiring. In any case, we will deal with these errors once we get rid of the compiler errors. .1uf capacitor between reset and ground does not have any effect.
Ensure the capacitor is disconnected when uploading to the Arduino and connected when uploading to the attiny. Here is the code I have hacked and would like to have my ATtiny execute, strobes and anti collision lights for an RC aircraft. /* Blink Turns on an LED on for three 250 ms blinks, then off for one second, repeatedly. This example code is in the public domain. */ int led = PB3; int ledpin = PB4; int fadePin = PB1; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(PB3, OUTPUT); pinMode(PB4, OUTPUT); }
// the loop routine runs over and over again forever: void loop() { digitalWrite(PB3, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for a second digitalWrite(PB3, LOW); digitalWrite(PB4, HIGH); // turn the LED off by making the voltage LOW delay(100); digitalWrite(PB4, LOW); digitalWrite(PB3, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for 14 second digitalWrite(PB3, LOW); digitalWrite(PB4, HIGH); // turn the LED off by making the voltage LOW delay(100); digitalWrite(PB4, LOW); digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for 1/4 second digitalWrite(PB3, LOW); digitalWrite(PB4, HIGH); delay(100); digitalWrite(PB4, LOW); // turn the LED off by making the voltage LOW // turn the LED off by making the voltage LOW delay(100); // wait for a second
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=10) { // sets the value (range from 0 to 255): analogWrite(fadePin, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(40); }
// fade out from max to min in increments of 5 points: for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { // sets the value (range from 0 to 255): analogWrite(fadePin, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(20); } } }
That uses the wrong pins so the attiny will not do anything but this should be addressed after the other errors are addressed. Changed pin assignments to PB3,PB4,&PB1 After hours wasted I have discovered that using the files in core 13_014 do not work with my UNO R3. Something in the instruction set points to invalid functions causing the Uno to not accept any new instructions.
This is most likely because of the wrong directory structure. Fixed structure and most of the errors went away Can anyone verify that the file set provided actually works with an Uno R3 with an ATMEGA328P-PU and software ver arduino-1.0.1 or provide instructions on how to modify the code to work properly? I need the ATtiny13 programmed to run this sketch as size and weight are an issue for my project.
I can verify that the file set works on Arduino-1.0.1 but cannot verify it works on the Uno since I do not have one. I do not see any reason why it would not work though. I am running Win Vista home basic with SP2
Windows Vista SP1 here but it should not matter much. Also: It is very important that the correct board be selected [/quote] I changed the code above to something I think the ATtiny will be able to use opened the new sketch and hit the verify icon and get the following error C:\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\core13\main.cpp:8: error: expected constructor, destructor, or type conversion before '.' token I don't even have a clue to search for an explanation for this error  I looked for a misplaced . but don't see one.
|
|
|
|
|
Logged
|
|
|
|
|
Washington
Offline
God Member
Karma: 20
Posts: 717
Firefox & Arduino rocks
|
 |
« Reply #80 on: August 15, 2012, 10:48:02 pm » |
I managed to get to step 8 in the EZlab link before I got error "avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny13 I searched and found this error can be ignored?
This "error" is totally irrelevant and must be ignored. For some odd reason AVRDUDE complains when you haven't defined the PAGEL and BS2 signals even though the attiny series processors do not support this. It will upload without issues regardless though. Thanks I missed that one completely, reloaded with the correct directory structure and things seem to be working much better.
That it a good sign. I changed the code above to something I think the ATtiny will be able to use opened the new sketch and hit the verify icon and get the following error C:\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\core13\main.cpp:8: error: expected constructor, destructor, or type conversion before '.' token I don't even have a clue to search for an explanation for this error  I looked for a misplaced . but don't see one. That is a weird error. Can you post the file? (It shouldn't be very long) Also ensure the notice block at the top is commented out.
|
|
|
|
|
Logged
|
Avoid throwing electronics out as you or someone else might need them for parts or use. Solid state rectifiers are the only REAL rectifiers. Resistors for LEDS!
|
|
|
|
lost in cyber space
Offline
Newbie
Karma: 1
Posts: 25
|
 |
« Reply #81 on: August 16, 2012, 07:03:20 am » |
/* Blink Turns on an LED on for three 250 ms blinks, then off for one second, repeatedly. This example code is in the public domain. */
// give it a name: int led = PB3; int ledpin = PB4; int fadePin = PB1; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(PB3, OUTPUT); pinMode(PB4, OUTPUT); }
// the loop routine runs over and over again forever: void loop() { digitalWrite(PB3, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for a second digitalWrite(PB3, LOW); digitalWrite(PB4, HIGH); // turn the LED off by making the voltage LOW delay(100); digitalWrite(PB4, LOW); digitalWrite(PB3, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for 14 second digitalWrite(PB3, LOW); digitalWrite(PB4, HIGH); // turn the LED off by making the voltage LOW delay(100); digitalWrite(PB4, LOW); digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for 1/4 second digitalWrite(PB3, LOW); digitalWrite(PB4, HIGH); delay(100); digitalWrite(PB4, LOW); // turn the LED off by making the voltage LOW // turn the LED off by making the voltage LOW delay(100); // wait for a second
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=10) { // sets the value (range from 0 to 255): analogWrite(fadePin, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(40); }
// fade out from max to min in increments of 5 points: for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { // sets the value (range from 0 to 255): analogWrite(fadePin, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(20); } }
Here is the file specifically called out in the error message: C:\arduino-1.0.1-windows\arduino-1.0.1\hardware\arduino\cores\core13\main.cpp:8: error: expected constructor, destructor, or type conversion before '.' token /* *** Core13 *** Arduino core designed for Attiny13 and similar devices NO WARRANTEE OR GUARANTEES! Written by John "smeezekitty" You are free to use, redistribute and modify at will EXCEPT IF MARKED OTHERWISE IN A PARTICULAR SOURCE FILE! Version 0.14 */Arduino.h int main(){ init(); //Call init routine setup(); //Call user provided setup() while(1){loop();} //Continuiously call user provided loop() } Is ti possible that I have bricked the ATtiny and that is now causing strange errors?
|
|
|
|
|
Logged
|
|
|
|
|
Leeds, UK
Offline
God Member
Karma: 35
Posts: 983
Once the magic blue smoke is released, it won't go back in!
|
 |
« Reply #82 on: August 16, 2012, 07:10:00 am » |
/* *** Core13 *** Arduino core designed for Attiny13 and similar devices NO WARRANTEE OR GUARANTEES! Written by John "smeezekitty" You are free to use, redistribute and modify at will EXCEPT IF MARKED OTHERWISE IN A PARTICULAR SOURCE FILE! Version 0.14 */Arduino.h int main(){ init(); //Call init routine setup(); //Call user provided setup() while(1){loop();} //Continuiously call user provided loop() } should be: /* *** Core13 *** Arduino core designed for Attiny13 and similar devices NO WARRANTEE OR GUARANTEES! Written by John "smeezekitty" You are free to use, redistribute and modify at will EXCEPT IF MARKED OTHERWISE IN A PARTICULAR SOURCE FILE! Version 0.14 */ #include "Arduino.h" int main(){ init(); //Call init routine setup(); //Call user provided setup() while(1){loop();} //Continuiously call user provided loop() } The error is essentially saying that it can't find a class named 'Arduino' with member 'h'. It is there because the line "*/Arduino.h" is not put inside the #include statement like it should be.
|
|
|
|
« Last Edit: August 16, 2012, 07:13:12 am by Tom Carpenter »
|
Logged
|
~Tom~
|
|
|
|
lost in cyber space
Offline
Newbie
Karma: 1
Posts: 25
|
 |
« Reply #83 on: August 16, 2012, 11:05:57 am » |
Thanks Tom, Iwill make the required adjustment the code and program some chips when I get home  Thanks to John "smeezekitty" for all the assistance and work on the code to allow us to program these chips.
|
|
|
|
|
Logged
|
|
|
|
|
lost in cyber space
Offline
Newbie
Karma: 1
Posts: 25
|
 |
« Reply #84 on: August 16, 2012, 07:47:23 pm » |
Thanks again guys, I have my first ATtiny13 programmed and blinking away 
|
|
|
|
|
Logged
|
|
|
|
|
Washington
Offline
God Member
Karma: 20
Posts: 717
Firefox & Arduino rocks
|
 |
« Reply #85 on: August 21, 2012, 08:18:58 pm » |
***Version 0.16 released***
|
|
|
|
|
Logged
|
Avoid throwing electronics out as you or someone else might need them for parts or use. Solid state rectifiers are the only REAL rectifiers. Resistors for LEDS!
|
|
|
|
lost in cyber space
Offline
Newbie
Karma: 1
Posts: 25
|
 |
« Reply #86 on: August 23, 2012, 07:37:32 am » |
Ver 16 downloaded, hopefully will have spare time soon to experiment with new code.
I noticed the clock seems to have changed on the last chip I programmed, fuses were burned, and it looked good on the bread board. Once all the resistors/LEDs were soldered on the clock seems to be running faster by about 30%.
|
|
|
|
|
Logged
|
|
|
|
|
Washington
Offline
God Member
Karma: 20
Posts: 717
Firefox & Arduino rocks
|
 |
« Reply #87 on: August 23, 2012, 12:39:58 pm » |
Ver 16 downloaded, hopefully will have spare time soon to experiment with new code.
I noticed the clock seems to have changed on the last chip I programmed, fuses were burned, and it looked good on the bread board. Once all the resistors/LEDs were soldered on the clock seems to be running faster by about 30%.
Different power source? Which oscillator?
|
|
|
|
|
Logged
|
Avoid throwing electronics out as you or someone else might need them for parts or use. Solid state rectifiers are the only REAL rectifiers. Resistors for LEDS!
|
|
|
|
San Diego
Offline
Newbie
Karma: 0
Posts: 4
Arduino newbie - mechanical engineer / electronics hacker
|
 |
« Reply #88 on: August 24, 2012, 02:00:56 am » |
John, I'm back. A lot Arduino smarter and experienced but still short on both. I downloaded your latest cores (V16) and was able to get it installed fairly easily. I didn't see a boards.txt included with the cores so I created a new one using the text you posted in Reply #78 on: August 15, 2012, 12:33:07 PM.
Also, your page 1 post now says you "Support 128KHz, 600KHz, 1MHz, 1.2MHz, 4MHz, 4.8MHz, 8MHz, 9.6MHz, 10MHz, 12MHz and 16MHz clock speeds". Is there a place I can download a more complete boards.txt to get those different configs?
I have successfully uploaded a simple program that initializes three digital outputs and then reads an analog input and uses that analog value to select and then flash one of LEDS on the three digital outputs.
void setup() { // verify all digital outputs are wired properly pinMode (0, OUTPUT); pinMode (1, OUTPUT); pinMode (2, OUTPUT); digitalWrite(0, HIGH); delay(1000) ; digitalWrite(0,LOW); digitalWrite(1, HIGH); delay(1000) ; digitalWrite(1,LOW); digitalWrite(2, HIGH); delay(1000) ; digitalWrite(2,LOW); }
void loop() { // read the value from the sensor: int potValue = analogRead(3) ; // select ledPin based upon analogRead value int ledPin = 0; if (potValue > 350) ledPin=1; if (potValue > 700) ledPin=2; // turn the selected ledPin on digitalWrite(ledPin, HIGH); delay(500); digitalWrite(ledPin, LOW); delay(500); }
The program runs as expected on the Uno and a Tiny85 (@8Mhz) but on the Tiny13 with the boards.txt contents referenced above it had two oddities: First, it runs about 50x slower than the Uno or Tiny85. Second, the analogRead produces its full range (0 - 1023) in the first 1/4 turn of the POT. That is, potValue goes from 0 to 1023 with a very short amount of turn. It was very smooth and gradual on the Uno and took the complete turn to produce values from 0-1023. Any ideas what would be causing the analogRead to behave so weird?
|
|
|
|
|
Logged
|
All electronics run on smoke - when the smoke escapes they always quit working!
|
|
|
|
Washington
Offline
God Member
Karma: 20
Posts: 717
Firefox & Arduino rocks
|
 |
« Reply #89 on: August 24, 2012, 12:38:38 pm » |
I didn't see a boards.txt included with the cores so I created a new one using the text you posted in Reply #78 on: August 15, 2012, 12:33:07 PM.
This is true, currently the core does not ship with a boards.txt. Also, your page 1 post now says you "Support 128KHz, 600KHz, 1MHz, 1.2MHz, 4MHz, 4.8MHz, 8MHz, 9.6MHz, 10MHz, 12MHz and 16MHz clock speeds". Is there a place I can download a more complete boards.txt to get those different configs?
It is not quite that simple. 128KHz is set from the internal watchdog oscillator and is easily selected. 600KHz is the 4.8MHz clock with the /8 fuse set. 1 MHz must be created with an external clock on the '13 1.2MHz is the 9.6MHz clock with the /8 fuse set 4 MHz must be created with an external clock on the '13 4.8MHz is the 4.8MHz internal RC oscillator 8MHz must be created with an external clock on the '13 9.6 MHz is the 9.6MHz internal RC oscillatr 10,12,16 MHz all need to be created with external clocks. I have successfully uploaded a simple program that initializes three digital outputs and then reads an analog input and uses that analog value to select and then flash one of LEDS on the three digital outputs.
void setup() { // verify all digital outputs are wired properly pinMode (0, OUTPUT); pinMode (1, OUTPUT); pinMode (2, OUTPUT); digitalWrite(0, HIGH); delay(1000) ; digitalWrite(0,LOW); digitalWrite(1, HIGH); delay(1000) ; digitalWrite(1,LOW); digitalWrite(2, HIGH); delay(1000) ; digitalWrite(2,LOW); }
void loop() { // read the value from the sensor: int potValue = analogRead(3) ; // select ledPin based upon analogRead value int ledPin = 0; if (potValue > 350) ledPin=1; if (potValue > 700) ledPin=2; // turn the selected ledPin on digitalWrite(ledPin, HIGH); delay(500); digitalWrite(ledPin, LOW); delay(500); }
The fuse on the section was wrong with the /8 fuse accidentally set Change attiny13.bootloader.low_fuses=0x6A
to attiny13.bootloader.low_fuses=0x7A
The program runs as expected on the Uno and a Tiny85 (@8Mhz) but on the Tiny13 with the boards.txt contents referenced above it had two oddities: First, it runs about 50x slower than the Uno or Tiny85. It should be 8x too slow, I am not sure where 50x would come from? Second, the analogRead produces its full range (0 - 1023) in the first 1/4 turn of the POT. That is, potValue goes from 0 to 1023 with a very short amount of turn. It was very smooth and gradual on the Uno and took the complete turn to produce values from 0-1023. Any ideas what would be causing the analogRead to behave so weird?
The ADC might be under-clocked from the bad fuse settings. Correct those and try again. If it persists, I will test later.
|
|
|
|
|
Logged
|
Avoid throwing electronics out as you or someone else might need them for parts or use. Solid state rectifiers are the only REAL rectifiers. Resistors for LEDS!
|
|
|
|
|