kodera2t / TinyBasicPlus_OLED_support

SSD1306 compatible OLED/LCD (128x64 dots) support is added, using Adafruit_GFX lib. Frame buffer for 21x8 characters is added for text display on graphic OLED/LCD.
20 stars 4 forks source link

Confusion with the trying to open the program in Arduino 1.5.2 and sd libraries #1

Closed Artistblock307 closed 9 years ago

kodera2t commented 9 years ago

At this moment, the uploaded codes are supporting 1.6.3 and 1.7.0. Some remainings are still work only for 1.0.6. I am personally skipping IDE 1.5.2 (I guess it was a developing beta version) but let me know what is your problem??

Artistblock307 commented 9 years ago

Sorry about taking so long to respond I just haven't be able to work on the problem since Saturday. Also I ended up accidentally upgrading to 1.6.1 instead, but everything seems to be working, I'll update if it becomes a issue. By the way can you tell me what SD library you used? Because, I've tried to find the sd files online but all I've found are some what vague libraries for specific hardware or certain projects. Please?

kodera2t commented 9 years ago

Hello Artistblock307,

Indeed SD card library selection (and finding good one) is a kind of headache. I myself indeed copy SD card library in IDE 1.0.6 to user library (in user's personal directory) directly and use them. IDE will show some "duplicate existence" warning but the one in user library has a higher priority and compiles by using them. ...

kodera2t commented 9 years ago

I just noticed one thing to be modified for SD card driving byATMega1284P:

/Applications/Arduino/Contents/Resources/Java/libraries/SD/utility/Sd2PinMap.h

original

elif defined(AVR_ATmega644P) || defined(AVR_ATmega644)||

// Sanguino

to be modified to

elif defined(AVR_ATmega644P) || defined(AVR_ATmega644)|| defined(AVR_ATmega1284)|| defined(AVR_ATmega1284P)

// Sanguino

Add these two lines is indispensable for SD card drive by ATMega1284P... If not modified, these should fix your SD card library problem, since basically SD card inside IDE is working well in TinyBasicPlus...

Artistblock307 commented 9 years ago

Thanks, I'll look into it.

On Apr 26, 2015, at 6:50 AM, kodera2t notifications@github.com wrote:

I just noticed one thing to be modified for SD card driving byATMega1284P:

/Applications/Arduino/Contents/Resources/Java/libraries/SD/utility/Sd2PinMap.h

original

elif defined(AVR_ATmega644P) || defined(AVR_ATmega644)||

// Sanguino

to be modified to

elif defined(AVR_ATmega644P) || defined(AVR_ATmega644)|| defined(AVR_ATmega1284)|| defined(AVR_ATmega1284P)

// Sanguino

Add these two lines is indispensable for SD card drive by ATMega1284P... If not modified, these should fix your SD card library problem, since basically SD card inside IDE is working well in TinyBasicPlus...

— Reply to this email directly or view it on GitHub.

Artistblock307 commented 9 years ago

Hi, nice talking to you again. Now, I haven't been able to make the tiny basic computer since before(NO TIME). but,I've looked into it and I ran across an error:

Arduino: 1.6.5 (Windows 8.1), Board: "Arduino Uno"

Ada_ATMega1284_LCD_SDcard_3:334: error: size of array 'program' is negative size of array 'program' is negative

This report would have more information with "Show verbose output during compilation" enabled in File > Preferences.

Help?!?

kodera2t commented 9 years ago

Hello! Actually it can be quickly fixed. This is because "kRamsize" is too much for Arduino UNO. You can try directly define kRamsize smaller, for example 500. Have fun!

kodera2t commented 9 years ago

Or, you can simply try this source: https://github.com/kodera2t/TinyBasicPlus_OLED_support/blob/master/ATMega328P%2BColorLCD/Ada_ATMega328_LCD.ino since it is already optimised for ATMega328P (Uno)!

Artistblock307 commented 9 years ago

Great progress has been made today! I finally managed to compile tinybasic and bitlash as it turns out the protocol for adding a board has changed a bit. Not only that but it's also turns out that after I set the IDE to use the Sleeping Beauty's bootloader (a atmega1284 arduino bootloader) the the previous error disappeared. But now I'm curious is there any way to connect them to a larger screen like the ili9341? I'm asking because a common factor between them seems to be this:

static void lcdChar(byte c) {

if (c == 8) {   //Backspace?

    if (cursorX > 0) {

        cursorX -= 1;   //Go back one
        screenMem[252 + cursorX] = 32;  //Erase it from memory
        doEraseFrame(252 + cursorX); //Redraw screen up to that amount
        doFrame(252 + cursorX); //Redraw screen up to that amount

    }

}

if (c != 13 and c != 10 and c != 8) {   //Not a backspace or return, just a normal character

    screenMem[252 + cursorX] = c;
    cursorX += 1;
    if (cursorX < 21) {
        tft.setCursor(cursorX*6+3,13*8+3);      
    tft.write(c);
    }

}

if (cursorX == 21 or c == 10) {         //Did we hit Enter or go type past the end of a visible line?
doEraseLine();

    doEraseFrame(252);  
    for (int xg = 0 ; xg < 21 ; xg++) {
        screenMem[0 + xg] = screenMem[21 + xg];//1
        screenMem[21 + xg] = screenMem[42 + xg];//2     
        screenMem[42 + xg] = screenMem[63 + xg];//3
        screenMem[63 + xg] = screenMem[84 + xg];//4
        screenMem[84 + xg] = screenMem[105 + xg];//5
        screenMem[105 + xg] = screenMem[126 + xg];//6       
        screenMem[126 + xg] = screenMem[147 + xg];//7
        screenMem[147 + xg] = screenMem[168 + xg];//8
        screenMem[168 + xg] = screenMem[189 + xg];//9
        screenMem[189 + xg] = screenMem[210 + xg];//10
        screenMem[210 + xg] = screenMem[231 + xg];//10
        screenMem[231 + xg] = screenMem[252 + xg];//11
        screenMem[252 + xg] = screenMem[273 + xg];//12
        screenMem[273 + xg] = 32;       
    }

    cursorX = 0;
    doFrame(252);   
}

} Could you you explain how you found these numbers? I would really like to add both (bitlash and tiny basic) to my project. I would really appreciate it. P.S. I enjoy your videos -artistblock

kodera2t commented 9 years ago

Hello! I hope your interesting project is getting close to complete!

The number of sereenMem[] can be calculated by screen_width/font_width(including one pixel spacing). The default font size of TFT library is 5x7,and including one pixel space, 6x8 pixel will be occupied by single character. My LCD has 128x160 so 21 character/line, and 20 lines/page can be assigned in screen. Currently frame buffer above implements only 21 characters * 13 lines but you can extend up to 20 lines. But it should be noted, larger frame buffer naturally imposes more work on MCU so you will find a balance point (between performance and visibility) for your LCD screen! Have fun!