> > Tim Kerby wrote: > > > We have been told the PIC will be used in schools in Scotland after > > much persuading on both my part and my teachers to the Scotish > > Examination Board. Unfortunaly, Andy Cooper .... feels that assembly > > should be left to university although schools manage happily with 16 > > year olds on 6502 assembly (and all the hex conversion and manual > > programming). We would like to drop this age to 13 or 14. Do you > > think assembly would be suitable if appropriate coursework and > > reference was provided and perhaps only learning the 15 or so core > > instructions. > > Tim: > > In my opinion, PIC assembly language would ABSOLUTELY be suitable > for 13-14 year old students. I'm not sure the language choice is so much dependant on the age level of the student as much as the type of application that you want to write. WHen I started in computers (at age 12) I started with BASIC on my TRS-80. Radio Shack had a most excellent BASIC tutorial. However I soon found that for some applications what I wanted (like video games) that BASIC was simply too slow to handle the load. So I began learning assembly for the Z-80. The 100x speedup was well worth the effort. BTW I really wrote Machine Language using BASIC poke and data statement. To this day I know that the instruction "LD HL,#xxxx" translates to 0x21,xx,xx And it's been almost 20 years. I ended up with hybrids where the setup/interface code was done in BASIC and the fast execution stuff in machine language. However if BASIC were fast enough to handle the load I probably would have put off machine language for a while. > > It's funny... I was just discussing this very subject with Steve > Wozniak. His young students (younger than yours) are already wriing > programs using the Macintosh's Hypercard "language", and we came to > the conclusion that most of them could easily handle assembly > language. > > Our conversation centered around teaching 6502 assembly language, > since he (obviously) is pretty familiar with it, but it applies > equally (if not more strongly) to teaching the PIC assembly language. PIC assembly is probably the easiest to learn because of its ultra-extreme compactness. However I think I need to talk about the flip side. As a college Computer Science Professor that teaches System Software and Programming Langauges, I must point out there are reasons that assembly isn't generally in wide use: 1) It's less symbolic than HLL's. 2) The extremely small instruction size (semantically) doesn't really wrap very well around the human mind's need/desire for abstraction. 3) Programming in assembly is typically more error prone than HLL's. 4) HLL's generally are more highly structured than assembly. While it's possible to generate structured assembly (especially with the use of macros) genreally you get some type of spagetti code. 5) Compilers are usually very very good at generating compact, high speed code that easily comes within an order of magnitude of hand generated code. Because of all of these issues, HLL code is generally written faster, cleaner, and with less bugs than the equivalent assembly. And the PIC brings along another piece of baggage that makes assembly rather annoying: its development cycle. Because it's strictly EPROM based (exclude the 16C8X's for now) the development cycle requires physical handling of the chip for erasure, programming, and execution. Frankly they take a beating. Of course Microchip and others supplement with the simulator (which is absolutely invaluable) and ICE (which generally is expensive) but in general it gets in the way. I learned from my first microcomputer project (a 6802 based project for a junior level computer science class) that simplifing the development cycle greatly improves development. Since then my requirements have included downloadable code via a tether that requires no physical handling of the target during development. Lately I've added the requirement that downloaded code should be immediately permanent so that the target can immediately function after being detached from the tether. HLLs are real nice but not absolutely necessary. Well the only PICs that can meet those requirements for PIC machine langauge are the 16C8X and the 17CXX series chips. The first is frankly too small and slow for real apps, the latter is a bit complicated and expensive, though quite fast and capable with 128K external memory access. Once you expand past running assembly though, it becomes a lot easier to handle those requirements. The Basic Stamp, FedBasic, CFlea, ARTI, and my own creation NPCI all do this in the same manner: Tokenize a HLL into tokens that can be run by a virtual machine. Put the virtual machine on the chip, put the program in a EEPROM internal/external to the chip, Let the virtual machine run the progam from the EEPROM. This way you can teach structured High Level programming, do embedded development, and not stress the hardware which can be reprogrammed up to a million times without ever having to be handled. In other words, ideal for an educational environment. And the boards are simple/inexpensive enought that you can let the kids wire and test their own boards, then tether them up and get to work making them do something interesting. > > The key thing, I think, is that the students must already be > proficient in at least the basics of algebra... Without that > knowledge, they'll find the concept of variables difficult to > understand. Also, they'll need to be fluent with the associative, > commutative, and distributive properties of addition and > multiplication. Yup. Math is essential to programming at any level. > > Additionally, a year of Algebra will have taught them how to > transform a stated problem into a mathematical or logical solution, > then to break it down into a progression of small steps in order to > solve it. A year? I have College juniors that still struggle with this concept. > > If your students already have programming experience (in BASIC or > whatever), they should be able to pick up assembly language VERY > quickly, but even if they don't, it shouldn't take very long. Once again it besg the question of what's the benefit of assembly other than the speed advantage? > > For example, I've taught PIC assembly language to motivated adult > students with no prior programming experience. It took about two > weeks for them to become fluent enough to translate simple algorithms > (for multiplication, division, etc.) into assembly... A month later, > one of them was making money writing PIC software as a part-time > freelance programmer. That sounds like fun! > > The more interactive you can make the programming process, the > better... An emulator and oscilloscope at each student's desk would > be the ideal, of course, but since that's impossible, you should at > least have simulators and some sort of prototyping boards with > pushbuttons, LEDs, etc. This of course is the right idea. > > You also need a VERY easy, VERY fast means of programming PICs... > Nothing slows the learning process more than being unable to quickly > and easily try new code. Bingo! That's my argument for the external EEPROM based PIC programming. Development cycle time is less than a minute after editing. This is a cool thread. I think I hyping the Virtual machine concept because I'm working on one right now. But I can honestly say that my code productivity has gone up immensely because I now write PIC code in an HLL and my cycle time is quite small. BAJ