General questions about Teensy 3.6 from a newbie

Status
Not open for further replies.

Gadgetman!

Active member
Hi!

I was in on the KS for the 3.6 way back when because it looked like an EPOC item...
And now I'm about to embark on my first little project(no not a blinking LED... )
I'm hoping to read a uSD card, open a file and read some text from it, then display that text on a text-LCD (a 4004 panel, that is: 4 lines of 40 characters. Yes, it's a 3.3V model)....

This will of course be expanded on later...

I picked the 3.6 because of its massive amounts of RAM. I hope all that is accessible using Sketches...

Since my C++ skills are non-existent(tried it in the 90s, hated it even more than regular C), I'm going the way of the Duino for this...

Is the RTC accessible using stock Duino Sketch commands?

Can it be setup to trigger a HW interrupt?
(To use the Interrupt functions in Sketches)



As for my programming experience...
I was 'reasonably OK' on my brother's Speccy in the 80s, went to school and learned the 'pro' way using ADA on DEC in the early 90s. (Before ADA95)
I've programmed assembly on 8051 (classic timer project with up to 8 relays, several independent and overlapping programs, countdown timer, correct calendar from 1980 to 2080. Yeah, it was a big mess... )

I've perpetrated some Pascal, I like REXX(under OS/2),
did some HW hacking on the Psion Organiser II, wrote OPL programs on the Series 3 and 5,
played around with Parallax BASIC Stamps, and even tried a bit of Spin on their Propellers(Never really did anything with them, though. They're still incredible... )

Anyway, my Teensy is plugged into a Cakeboard, the spare is in it's plastic baggie in the box of parts, I have a large cup of tea...
It's Coding Time!
 
Is the RTC accessible using stock Duino Sketch commands?
Yes. You will need to attach a 3v coin battery to keep the RTC powered when the board is not powered. Unlike the Teensy 3.2, you do not have to solder in a 32.768 kHz crystal to get the RTC to work:

Can it be setup to trigger a HW interrupt?
(To use the Interrupt functions in Sketches)

See the following among others:

Note what Paul said about using attachInterrupt for switches and buttons. A lot of times in the Arduino/Teensy world, the common idiom is not to use attachInterrupt, but instead checking for the condition happening in the loop function.

Note, in connecting the 4x40 LCD display, if it is an i2c device (most are), you may need to connect two separate pull-up resistors, one resistor between pin 18/A4 and 3.3v, and the other resistor between pin 19/A5 and 3.3v. Typically for a Teensy, you would want a 2.2K omn resistor, but you could use a higher value (if you use a higher value, you might not be able to adjust the i2c speed faster than the default speed). Note, some devices have pull-up resistors, and if yours does, then you don't need to add the pull-up resistors on the Teensy.
 
The panel is supposed to be based on the Hitachi HD44780 which should be suppored by at least 2 libraries...
I don't think that is I2C?
(16pins plus backlight)

I'm not happy about doing too much in the loop function. I may attach a keyboard or other inputs later, and doing all kinds of testing on those 'in loop' can cause horribly laggy behaviour.
(Hobbytronic have a USB-host that would offload most of the keyboard work. I may go that route)
The perfect Loop function for me is a IF ELSE with possibly a SWITCH CASE or two mixed in. (Since it doesn't seem to have a ELSEIF ) and all trues just calling functions.

I buy 2032 cells in bulk, and have holders for them, so that's no problem, at least.
(Just have to find where I stored those holders. I could use 1610 cells also, because I KNOW where those holders are. Mixed in between my painting kit as I use them whenputting LEDs in miniatures.)
 
The panel is supposed to be based on the Hitachi HD44780 which should be suppored by at least 2 libraries...
I don't think that is I2C?
(16pins plus backlight)

I don't know. The usual LCDs I've seen have a microprocessor controling the display and you use i2c or spi to talk to it.

I'm not happy about doing too much in the loop function. I may attach a keyboard or other inputs later, and doing all kinds of testing on those 'in loop' can cause horribly laggy behaviour.
(Hobbytronic have a USB-host that would offload most of the keyboard work. I may go that route)
The perfect Loop function for me is a IF ELSE with possibly a SWITCH CASE or two mixed in. (Since it doesn't seem to have a ELSEIF ) and all trues just calling functions.
C/C++ uses else if:

Code:
    if (test1) {
        // ...
    } else if (test2) {
       // ..
    }

Also before you get complicated with interrupts and such, actually try it the simple way first. It might be fast enough as is. Using interrupts can complicate things, but note there are libraries that turn off interrupts for a relatively long time (notably the standard Adafruit_Neopixel library for controlling WS2812B leds needs to disable interrupts when it is doing the show function. There are ways to do WS2812B/neopixel LEDs without turning off interrupts for the entire sequence, but that in turn has other complications (the WS2812B/neopixel LEDs have one wire for data, and a fixed timing window for sending out the next byte).

Besides the libraries that turn off interrupts, it is a good habit to get into to not using the delay function.

I buy 2032 cells in bulk, and have holders for them, so that's no problem, at least.
(Just have to find where I stored those holders. I could use 1610 cells also, because I KNOW where those holders are. Mixed in between my painting kit as I use them whenputting LEDs in miniatures.)

It just needs 3v to keep the RTC powered.
 
The simple way?

Then I'd be bit-banging on an old Psion Organiser II...

And if I wanted to stay away from interrupts, I'd use a Propeller. No interrupts there... only 8 x 32bit cores.
(But programming parallell execution in a high-level interpreted OO language is making my head spin... )

I found that I forgot to pack the 10K pot for the backlight, though, so may not be able to get things working until late tuesday when I get home.
 
I've been reading up on the 44780, and since it can only support up to 80chars, there will be 2x 44780 chips on a 40x4 LCD.
Well, that explains the TWO Enable pins...

It also basically means the LCD driver package is elfed up. 'Supports any size'...
To make it more fun, I have a very sneaking suspicion that the two are 'interleaved', and that IC1 controls lines 1&3 and IC2 controls lines 2&4.
(My first test got lines 1 & 3 'cleared')

I could still have used the standard packages, and treated it as two LCDs, but since there's only support for ONE LCD panel...
Maybe if I hack it up a bit, and make the Enable pin a parameter for every function?
(That should allow for multiple LCDs of the same size at least)

The things you learn while idly messing about...
 
Dug a bit and found a LCDFast package that actually does the work.

Going to putter around with the LCD for a little while, get to really understand how to work it, then take a look at the uSD card reader.

Now, if I only had something else than a tiny multiturn trimpot to adjust the backlight...
(Time to hit the online stores... )
 
Hi,

Am a code beginner like you and have used many 44780 lcds before on none C++ projects, but for just £$8 you can get one of these 2.8" colour touch screens which add a new dimension to your projects.
I moved to Teensy partly because they are 3v3 boards so interface directly with the 3v3 tft screens.

Adafruit and Rinky Dink libraries work well and PJRC has this tutorial.

https://www.pjrc.com/store/display_ili9341_touch.html

Below is my first tft project with 4 touch control box.

IMG_0977.jpg

IMG_0987.jpg
 
Status
Not open for further replies.
Back
Top