Show Posts
Pages: 1 [2]
16  Using Arduino / Programming Questions / Re: understanding timer interrupts on: March 31, 2013, 04:17:57 pm
I think he just wants to understand what the original is doing, so he can plug the correct values into the Due library.

That's correct. 

I'm understanding (please correct if wrong) that timer1 is simply setup to interrupt on overflow.  Is it correct to assume that the timer overflows every
Code:
(F_CPU / 4000000) * TIME_CHUNK; // goes twice as often as time chunk, but every other event turns off pins
?

So, using the Due timer/interrupt library I could simply do:
Code:
long freq = (F_CPU / 4000000) * TIME_CHUNK; // goes twice as often as time chunk, but every other event turns off pins
startTimer1(freq, interruptRoutine); // (Frequency, function)

where interruptRoutine is the function that is called upon timer overflow?
17  Using Arduino / Programming Questions / understanding timer interrupts on: March 30, 2013, 09:29:30 pm
hi everyone,

I'm trying to port over some code to the Due, and I'm having trouble understanding the section that deals with ISR and timer/counters - more specifically, I'm unsure exactly with which settings the timer is being initialized.  I'm looking at the following:

Code:
  TCCR1A = 0;
  TCCR1B = _BV(WGM13);

  ICR1 = (F_CPU / 4000000) * TIME_CHUNK; // goes twice as often as time chunk, but every other event turns off pins
  TCCR1B &= ~(_BV(CS10) | _BV(CS11) | _BV(CS12));
  TIMSK1 = _BV(TOIE1);
  TCCR1B |= _BV(CS10);

I plan on using the following timer library on the due in order to handle timer ISR, however I'm uncertain about how the original timer is setup.  Could someone please shed some light into this?  I'm afraid I still don't quite understand bit math so I can't tell to which value each of the register values is being set.  I was hoping someone could simply tell me to what frequency the timer is set as well as which mode.

Furthermore, I don't understand how ICR1 works in this case since from the rest of the code, I understand that once timer1 overflows an ISR is called because the code contains
Code:
ISR(TIMERx_OVF_vect)
there is no mention of the timer input capture interrupt service routine within the original code.

Thanks for the help and enlightenment everyone!



18  Products / Arduino Due / Re: Due support for Nokia 6100 display on: February 09, 2013, 05:08:48 pm
The two types of display are completely different.

One is Colour, one is B/W. One uses 9bit SPI, the other uses 8bit SPI. All of the command registers have different addresses. I you were to write your own driver code, then you could possibly reuse alot of the code from my library.

thanks for the info tom, i now see that they aren't that similar.  do you know of an already existing library which has been ported to the Due and which could run this type of display?
19  Products / Arduino Due / Re: Due support for Nokia 6100 display on: February 08, 2013, 02:49:20 pm
fantastic!  although i wonder if you could tell me if this library could be used for the following [urlhttps://www.adafruit.com/products/438]graphic LCD[/url]?
20  Products / Arduino Due / Re: Arduino Due libraries (official and 3rd party) on: February 07, 2013, 09:54:34 pm
ported basic function over for the adafruit stepper shield

the library can be downloaded here
21  Products / Arduino Due / LCD library for Due? on: February 07, 2013, 09:51:39 pm
hi ya'll!

i just bought a nice little graphic LCD with RGB backlight from Adafruit (https://www.adafruit.com/products/438) and I've been trying to port over their library but haven't had any luck (http://forums.adafruit.com/viewtopic.php?f=47&t=36920).  does anyone know of a working LCD library for the Due that might also work for this guy?  i imagine most LCDs work about the same? and from a quick forum search it seems like some people are using LCDs with their Due but I can't figure out which library they are using.

thanks for the help everyone!  smiley-fat
22  Using Arduino / Displays / Porting OLED library to Arduino DUE troubleshooting on: January 26, 2013, 02:31:19 pm
Hey ya'll!

I'm trying to use the Adafruit OLED with my Arduino DUE and because no library exists for functionality with the DUE, I've been trying to port the already existing Adafruit library over.

I've got things compiling properly, however, I can't get anything on the display.  I've confirmed on my UNO that the display still works properly, but beyond that I'm not sure how to troubleshoot.  The biggest thing that needed porting over was the way the library would access certain ports.  I've taken some handy functions from the forums and am using those to take care of port access.  Beyond that I'm not sure what else it could be.  Could anyone give me some help please?

Adafruit_OLED.cpp is the library I ported over; it makes reference to Adafruit_GFX.cpp also which I've modified a bit (taken out the PROGMEM)
23  Using Arduino / Programming Questions / Re: [SOLVED] Adapting MenuBackend library to use strings in PROGMEM on: September 26, 2012, 12:34:52 pm
Does
Code:
void setup()
{
   Serial.begin(9600);
   Serial.println("This is some text");
}

void loop()
{
}
produce readable text?

yes
24  Using Arduino / Programming Questions / Re: [SOLVED] Adapting MenuBackend library to use strings in PROGMEM on: September 26, 2012, 11:48:42 am
Have you confirmed that the baud rate being used matches that of the Arduino?

I've only tried 9600 on my Uno, which is what the Serial window is also set at.  Is there another baud setup I should try?
25  Using Arduino / Programming Questions / Re: [SOLVED] Adapting MenuBackend library to use strings in PROGMEM on: September 26, 2012, 11:39:24 am
Be nice to know what the gibberish is. If nothing prints correctly, then it seems likely that you have not selected the correct baud rate. If some stuff prints correctly, but other does not, that's a different story.

It does print out some things, mostly square boxes, and unrecognizable symbols; not the character text I was expecting.
26  Using Arduino / Programming Questions / Re: [SOLVED] Adapting MenuBackend library to use strings in PROGMEM on: September 26, 2012, 10:51:55 am
I hate to open up a 'resolved' thread, however, it seems that this library isn't working correctly or that i'm missing something.  I've written up a simply menu system and all that is getting returned through serial is jibberish.  can anyone help?  the library i'm using is the current CMmenus one: http://crazymachine.nicolai-korff.de/downloads/crazymachine_version0.4beta.zip

i've been trying for weeks to get progmem to work with this library and can't seem to get it, i'm about to give up!  smiley-roll-sweat

Code:
#include "CMmenus.h"             
#include <avr/pgmspace.h>         


PROGMEM const char a[] = "a";
PROGMEM const char b[] = "b";
PROGMEM const char c[] = "c";
PROGMEM const char d[] = "d";


//this controls the menu backend and the event generation
MenuBackend menu = MenuBackend(menuUseEvent,menuChangeEvent);


MenuItem mi_a = MenuItem(a);
MenuItem mi_b = MenuItem(b);
MenuItem mi_c = MenuItem(c);
MenuItem mi_d = MenuItem(d);

//this function builds the menu and connects the correct items together
void menuSetup()
{
Serial.println("Setting up menu...");
menu.getRoot().add(mi_a);
mi_a.add(mi_b).add(mi_c).add(mi_d);
}


void menuUseEvent(MenuUseEvent used)
{

}

void menuChangeEvent(MenuChangeEvent changed)
{
    Serial.print("Menu change ");
    Serial.print(changed.from.getName());
    Serial.print(" ");
    Serial.println(changed.to.getName());
}

void setup()
{
    Serial.begin(9600);

    menuSetup();
    Serial.println("Starting navigation:\r\nUp: w   Down: s   Left: a   Right: d   Use: e");
}

void loop()
{
    if (Serial.available()) {
        byte read = Serial.read();
        switch (read) {
            case 'w': menu.moveUp(); break;
            case 's': menu.moveDown(); break;
            case 'd': menu.moveRight(); break;
            case 'a': menu.moveLeft(); break;
            case 'e': menu.use(); break;
        }
    }
}
Pages: 1 [2]