a hobby class on microcontrollers - Page 4

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Re: a hobby class on microcontrollers

Quoted text here. Click to load it

FWIW, Texas Instruments just came out with a simple MSP430 eval board
that costs $4.30:

http://eetimes.eu/en/ti-offers-low-cost-development-kit-for-msp430-value -
line-mcus.html?cmp_id=7&news_id22%2902526&vID44%

I like MSP430 because is low power, pretty well supported and low cost,
but still has non-vendor-specific toolchains (GCC, Rowley, etc).

This board looks good on features, but I haven't checked it out
personally.

Re: a hobby class on microcontrollers
Quoted text here. Click to load it

It says value line chips. I.e. 1K or 2K program space.  I don't think
you can do much with GCC in 2K.

Re: a hobby class on microcontrollers
Quoted text here. Click to load it

What makes you think that?  If the people who did the backend port did a
good job, gcc produces assembler that's as good as (sometimes better
than) what you could do manually.

Re: a hobby class on microcontrollers
On Sun, 04 Jul 2010 22:16:37 -0400, DJ Delorie

Quoted text here. Click to load it

There are a number of reasons why that is both true and
untrue.  A lot depends on the application space, of course.

There are some advantages to assembly coding that c compilers
cannot reach, as yet.  For example, most c compilers I've
experienced are not nearly as flexible as assembly in
adapting caller/callee protocols -- there are some immutable
aspects that a c compiler _must_ depend upon.  Also, there
are many semantics available in assembly that simply are not,
in c.  And besides, a human can perform unique on-the-fly
topology transformations of algorithms that are well beyond c
compiler technology I'm aware of and which themselves cannot
be re-expressed back into some new c syntax.  I think there
has been a thread or two on that topic here, as well.

On the the other hand, a c compiler is a lot better than a
human at some things, too.  And these can make up a lot of
ground.  So don't get me wrong.

It just seems a little careless to write that a good backend
is sufficient to produce something as good as (or better
than) hand coding.  That may be necessary, but it isn't
always sufficient.

Jon

Re: a hobby class on microcontrollers
Quoted text here. Click to load it

The msp430 port of gcc is not updated as fast as other ports (it is not
part of the mainline gcc), and in particular the click-to-install
windows build is a bit old.  But as long as it supports the device you
are using, it is a solid compiler that produces reliable and efficient code.

The key to working with C with such small memories is the same
regardless of the compiler - be careful of how you code, and avoid
anything that brings in large pieces of library.

I used avr-gcc for a project on a Tiny 12 device with 1K flash and /no/
ram (only the 32 registers).

Re: a hobby class on microcontrollers
On Sun, 4 Jul 2010 14:31:09 -0700 (PDT), linnix

Quoted text here. Click to load it

I can't speak much about gcc on the msp430.  Never tried it.
I don't expect the libraries to be very good, unless for some
reason this is a very well-worn rut like the ARM7TDMI is. And
I doubt it has had that much "stone soup" work on it, as yet.

But that misses the point I believe I'm moving towards.  I
don't think this isn't going to be about teaching c/c++ as
much as being a fun environment for all.  For new people, I
doubt they will be able to, or want to, engage in c/c++
programming.  Maybe later.  Maybe a few who are advanced.
Maybe.

I am faced with making this fun and easy to try out and, I
hope, I will get some laughs and maybe even some questions
that allow me to expand on a few points of interest for a
short time.  Some may even come back.

I am having a hard time imagining starting this out on a gcc
footing.

That said, 1-2k is small.  512 to 1024 words -- and many
instructions require more than one word, as the destination
mode is woefully short on options to name one problem.  I was
(am) hoping that TI will come out with compatible DIP
versions of others in its MSP430 line (not in the value line,
but in more expensive parts) that will also fit the socket
that comes on that cheap board system.

Either way, I plan on implementing a simple language where I
can take into account criticisms and suggestions and tailor
it to what I learn in the process.  If I am careful and
crafty, I may be able to make something usable that fits into
a small space.  For example, the entire non-swapped portion
of the HP 2000F timesharing system (supporting 32 users) fit
into 6k x 16 memory.  Admittedly, that didn't include the IO
support.  But it included floating point with transcendentals
and matrix math including inversion an determinants.

Assembly code and skill can do a lot with a little.

Whether that would mean 1024 words would be sufficient for a
very simple system remains to be learned.  In any case, this
still fails to take into account that I want the students
able to enter programs they write.  And that requires space,
as well.  It's possible that it doesn't have to be much and
it could be in the sram, too.  But yes, I may find the limit
of 1024 words too restrictive.  Which is why I hope larger
parts will be available that will fit that board (if I decide
to go that way.)

I need to put work out the scope and details more before I
have much more to add.

Jon

P.S.  Got a full mailbox message from an email I sent you.
And thanks very much for the quick and excellent service!

Re: a hobby class on microcontrollers



Quoted text here. Click to load it

This triggered a a idea you may want to consider. Many
years ago in a university setting I was teaching programming to
engineering students and we were using the M6808. Early in
the course I subsetted the instruction set to a fully functional
but subset of the instruction set. For example all of the instructions
dedicated to the first page of memory could be eliminated.
There are lots that can be eliminated. Most memory to memory
operations and in some cases addressing modes.

This resulted in a fully functional processor (less efficient code)
This approach made understanding the instruction set much easier
and reduced potential for instruction usage errors. I modified
the assembler we used to accept only the subset instruction set
and provided processor documentation for the subset instruction
set.

Regards


walter..
--
Walter Banks
Byte Craft Limited
We've slightly trimmed the long signature. Click to see the full one.
Re: a hobby class on microcontrollers
On Mon, 05 Jul 2010 07:14:29 -0400, Walter Banks

Quoted text here. Click to load it

Yes, that could be done (and is done still) in first year
college CS classes (last I checked, which was perhaps 3 years
ago.)  I'm not exactly trying to reach that crowd, but it
does remind me -- a mix of low level with high level
'instructions', such as IN <reg> which might activate the
keyboard and accept a line of input and convert the
decimal-ASCII entry into a binary register value.  Nothing
like that _really_ exists, of course.  But it focuses the
teaching on ALU logic and arithmetic basics and sweeps away
complicating I/O and peripheral type issues.  Maybe that is
part of what you meant, too.

Still, I'm mostly focused upon "action, lights, fire, smoke,
explosions, and sparkly things" part of this to get attention
and interest flowing.  I want logic and maybe the need for
arithmetic to sneak up on them and become an interest because
it helps them blow something up or make fire or generate
sparks or ...  well, I want them to laugh and enjoy the time.
If they actually _do_ become more interested in going
further, _then_ I'll be there to help on that score.  When
they ask, not before, seems better to me.

Jon

Re: a hobby class on microcontrollers
Quoted text here. Click to load it

The local instructor I am working with is building a simple monitor on
the demo board.
So far, we have it toggling the leds between red and green and
printing the port states
to the virtual com port.

  PB7 PB6 PB4 PC7 PC6 PC4 PC2 PD5 PD4 PD2 PD1
 OFF OFF OFF OFF OFF OFF OFF OFF  ON OFF OFF

We are working on commands such as "IN PB7" and "OUT PB7 ON".  That
should give students a simple way to check out their hardware designs
without programming.  More advanced students would want to implements
their own custom commands for the serial port and spi port.

The basic virtual com port firmware on the AVR takes around 8K, and
you can't build any USB device with less than 6K.  Since the boot
loader itself takes 4K, minimum workable chip is 16K.  32K chip is
less than $1 more, so why bother with smaller chips.

Of course, if you are not dealing with USB target, we have some 8K
boards (4K user) available for $4.30 (price matching with TI).

See http://linnix.com/udip


Re: a hobby class on microcontrollers
Quoted text here. Click to load it

But the industry demands higher level skill set.

Quoted text here. Click to load it

Are you students capable of VB and VC?  Our instructor expects them to
drive the demo board with either one using virtual com port on the
PC.  I will post the firmware (almost done),  VC (almost starting) and
VB (left for the students to do).


Re: a hobby class on microcontrollers
On Mon, 5 Jul 2010 14:54:22 -0700 (PDT), linnix

Quoted text here. Click to load it

Yes, but this is about introducing people who otherwise might
not have any way to even find out if they want to pursue this
as a hobby and I'm not even restricting this to people who
may make a hobby out of it.  All I want to do is open a door
and see who walks in and work with them at whatever level
they are interested in.  If it never becomes more than one of
those rare moments where someone has a little bit of fun and
never comes back, I'd be happy.

If I never teach a single person who goes into the business
ever, I will still be happy.  If only one of them decides to
make a hobby out of it where they spend more time, I'd still
be happy.  If no one ever comes back, but at least enjoys the
moment and gets a kick out of it and laughs a little... I'd
still be happy.

Quoted text here. Click to load it

I have no idea who will come in the door.  Some might.  But
it isn't a pre-requisite... that's for sure.  I want people
with zero VB and zero VC experience finding themselves
enjoying the time and wanting to be there.

Quoted text here. Click to load it

All help is good.

Thanks,
Jon

Re: a hobby class on microcontrollers

Quoted text here. Click to load it

Students who don't want to program can still test out hardware with a
simple virtual terminal (hyperterminal).  Perhaps someone can wrote a
real virtual terminal that can execute basic scripts.

Re: a hobby class on microcontrollers
On Mon, 5 Jul 2010 16:29:19 -0700 (PDT), linnix

Quoted text here. Click to load it

Hmm.  I don't know if you read everything in this thread, but
I want the students to take something home and keep it.  It
is theirs.  I want them to have something tangible and to
show others, should the mood arise.  It needs to be physical
and real and __do__ something.  Or maybe I'm not following?

Jon

Re: a hobby class on microcontrollers
Quoted text here. Click to load it

So, they are not allowed to hook it up to a desktop or laptop for
demo?  Without any real input/output device, it would be difficult to
show the application.

Re: a hobby class on microcontrollers
On Mon, 5 Jul 2010 18:21:27 -0700 (PDT), linnix

Quoted text here. Click to load it

Oh.  I see.  I probably wasn't following, then.  Yes, I need
to solve this.

One possibility is to use USART peripheral on the micro side
tied to a USB/RS-232 adapter that ties into a PC and then
using any terminal program I choose to talk.  I just use dumb
terminal code and the HID driver in Windows.  Another might
be to use a micro chip that includes the USB interface and
necessary software to appear as a slave serial port device
and avoid entirely the extra adapter.  Again using that dumb
terminal program under Windows or Linux or whatever.  Still
another might be to adapt something like the ZipIt2, which
has a 312MHz XScale PXA270, a color, backlit TFT LCD with
320x240 TFT LCD and more color range than I care about,
802.11b/g, 8Mb flash, 32 Mb sdram, stereo DAC audio, a qwerty
keyboard, status LEDs, clam shell case, joystick rocker,
micro sd card slot, etc.  I've read these can be had in 1's
for about $35.  Runs Linux.  This may work out, as well.

Nearing optimal would be something quite similar to the $4.30
TI board but supporting a DIP packaged micro with somewhat
more memory than the value line carries, so far, _if_ that
board which plugs into a USB slot _also_ had the ability to
act as a HID serial port device to the DIP's USART pins AND a
JTAG debugger, both as appropriate.

Something very close to this already exists in the USB
programming stub found in the TI Chronos watch kit (for which
I paid $24, shipped.)  This device includes the USB slave
device and a separate CPU dedicated to supporting JTAG and
serial port via a tiny 6-pin header.  4 pins are for JTAG and
the outside 2 are for Rx and Tx.  When the device is plugged
into the USB port of a PC, it sets up as BOTH a JTAG
downloader/debugger AND a COM port on the PC at the same
time.  Anything that works with the JTAG and the Rx/Tx pins
can then be plugged into the 6-pin header, programmed,
debugged, and communicated with via full duplex serial port
communications programs.  That could simply be a specially
wired ZIF socket, I suppose.

I'm still agog over thinking this through.  Lots to consider,
yet.

Jon

Re: a hobby class on microcontrollers

Quoted text here. Click to load it

I don't know if it was already mentioned in this thread:

http://www.arduino.cc/

People who don't have much computer experience sometimes have problems with
complicated toolchains and pure C, so the Arduino project might be easier
for them. Writing your own user friendly IDE would be much work.

I don't know Arduino myself, because I like full control and low-level
access to microcontrollers, even in assembler, but if your goal is
something like a pottery class for people who have never done something
pottery-like before, it might be better to concentrate on the projects
(blinking LEDs, simple robots with sensors) instead of the development
environment, because only strange people like programmers are interested in
the technical aspect of programming, IDEs, assembler etc. :-) most people
are just interested in the results and don't want to learn many low-level
things.

--
Frank Buss, fb@frank-buss.de
http://www.frank-buss.de , http://www.it4-systems.de

Re: a hobby class on microcontrollers
Quoted text here. Click to load it

The problem is creating something to capture their interests.

Quoted text here. Click to load it

We, programmers, are interested in blinking LEDs because it's the
easiest way to verify program logics.  Blinking LEDs might not be so
interesting for none programmers.

Quoted text here. Click to load it

Not easy to do with low cost.


Re: a hobby class on microcontrollers

Quoted text here. Click to load it

I was thinking of something like PWM output, RBG LED and a table tennis
ball, or mounting it on a fast rotating base :-)


http://www.youtube.com/watch?v53%xxUE7tDlE


http://www.youtube.com/watch?v=ML6ZrWKTWPo


Quoted text here. Click to load it

You need some fantasy. Something classical: Two motors and two LDRs is all
you need for some fun:


http://www.youtube.com/watch?v=w-jNRz1P9nQ


--
Frank Buss, fb@frank-buss.de
http://www.frank-buss.de , http://www.it4-systems.de

Re: a hobby class on microcontrollers

Quoted text here. Click to load it

Jon's first cost estimates seemed to push down toward the single-digit
dollars area, and Arduino costs more than that.  My guesstimate would be
around $20..30 per unit per person.  Once you pay that, you get a system
that can be programmed to run stand-alone, a USB programming interface, a
simple language and programming framework, and versions of the usual
peripherals -- ADC, PWM, digital I/O, UART serial.  Hooking up to lash-ups
of outside equipment is what they're for.

Quoted text here. Click to load it

You can use the Arduino hardware outside the framework, but at that point
it's cheaper to attach an ATmega_8 to a board and do precisely what you want
for yourself.

    Mel.



Re: a hobby class on microcontrollers
Quoted text here. Click to load it

I have been looking at the Arduino for a community ed class. I figure by
the time I get an Arduino, large breadboard, a handful of leds, pot (for
the adc), and some sensors it will total in the $50-$60 range - quite a
bit above Jon's hope. But with the hardware and the development system
it would be a simple and powerful system. For standalone projects they
could use the Arduino for development and then get a cheaper board to
plug the programmed chip into.

Quoted text here. Click to load it

The Arduino tool chain is actually has a preprocessor that targets the
AVR GCC tool chain. The sketch "language" is a subset of C,C++ that
includes a number of predefined functions to drive the on chip peripherals.

More advanced students can write C and C++ code that will be passed on
through to GCC/LD. In fact I have included my own C++ classes as part of
the sketch source and called them from the loop code.

If you look at the code for the predefined functions you will find that
much of it is C++ classes for the peripherals with simple interface
member functions so that the end user is completely shielded from the
details.

Quoted text here. Click to load it

Site Timeline