GithubHelp home page GithubHelp logo

ralphbacon / 174-attiny13-brain-dead Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 2.0 1.28 MB

Too small to program? Watch the video and find out!

License: GNU General Public License v3.0

Assembly 43.12% C++ 27.30% C 29.59%

174-attiny13-brain-dead's People

Contributors

ralphbacon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

thinhx2 witawat

174-attiny13-brain-dead's Issues

Your code aren't any good!

I did watch your Youtube video about ATtiny13 + MicroCore, and I'm sorry to say I'm a bit disappointed with your conclusion. Even though MicroCore is very light-weight, the T13 is still very limited in terms of memory. However, it's a great little chip if one really wants to learn how to write efficient code!

OSCCAL:
Ralph Doncaster and I created a very nice OSCCAL sketch that uses a received x character from the serial monitor to tweak and tune the OSCCAL value. It's very reliable and works great!
You can find this sketch under Examples > Serial Examples > OscillatorCalibration in Arduino IDE if you get the latest MicroCore version.
Another thing to point out is that even though there are two internal oscillators you can still use the OSCCAL value for 9.6 MHz when running at 1.2 MHz (9.6MHz/8), and the 4.8 MHz value when running at 600 kHz (4.8MHz/8).

Serial printing:
The code you host here doesn't really use any of the built-in MicroCore UART functionality. The built-in Serial functionality is smaller and faster, especially the printNumber function. I'm pretty sure it will work like you'd expect if you use it like intended:

/*
PB0 > TX pin
PB1 > RX pin

115200 baud @ 9.6 MHz
57600 baud @ 4.8 MHz

Run the OscillatorCalibration sketch first!
*/

#include <EEPROM.h>

uint32_t counter = 0;
uint8_t small_count = 0;

void setup() 
{
  // Check if there exist any OSCCAL value in EEPROM addr. 0
  // If not, run the oscillator tuner sketch first
  uint8_t cal = EEPROM.read(0);
  if (cal < 0x80)
    OSCCAL = cal;
}

void loop() 
{
  Serial.print(F("Serial Test ")); // The F macro should be here!
  Serial.print(counter);
  Serial.println(); // Occupies only 8 bytes
  counter++;
  small_count++;
  delay(1000); // Uses _delay_ms(1) inside a while loop to prevent inlining
}

The problems Ralph Doncaster pointed out were fixed in the end. The problem was that we couldn't reduce the compiled size properly when HalfDuplexSerial inherited Print (Some Arduino builder issue I think). Instead, some of the Print functions were copied over to HalfDuplexSerial. The result is a reduced sketch size with some "backend code" that's not as elegant as I had initially hoped.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.