Basic18, and interrupt service routines

[prev] [thread] [next] [lurker] [Date index for 2006/05/20]

From: Michael Leuchtenburg
Subject: Basic18, and interrupt service routines
Date: 21:16 on 20 May 2006
I would be more specific in my subject header, but I really hate
everything about Basic18. Basic18 is a compiler for Basic for the PIC18.
You can find it here:
http://www.midwest-software.com/Basic18/basic18.htm

If you want to.

There's a lot of hate here, but I'll try to focus on just one part.

Basic18 has explicit support for interrupt handlers. This is good,
because doing it by just putting fuction calls in the right locations in
the mapped program would be oh-so-low-level - and Basic is trying to be
a high level language, here.

Unfortunately, it also thinks it knows better than you what can be
called from where. Got a function you want to call from both inside
and outside an interrupt? Too bad, you can't! Basic18 won't let you.
Period. You think you can keep it from being called while it's running?
I'm sure you can, but Basic18 doesn't believe you. It, after all, knows
better than any human possibly could.

But this, ah, this can be worked around. You can just duplicate your
code. Hateful, yes, but at least it can be forced into some semblance of
working. Of course, if you have a couple hundred lines of code then
that's a lot of wasted space on the flash of the microcontroller, but
hey, you do what you can.

Of course, Basic18 has more in store. It also supports multiplication.
It doesn't just use the PIC's hardware multiplier, though, oh no. It has
a library for it. That means functions. So now you can't do
multiplication both inside and outside of interrupt handlers.

What's that you say? You can live without multiplication? You'll just do
it by hand using bitshifts and adds? Wonderful! You can go on using
Basic18.

Unless, of course, you want to index into arrays. For an array of bytes,
it's fine - no problem. But if you want to index into an array of
two-byte data, ah, now there is a problem. Because, you see, in order to
find the pointer to the correct cell, Basic18 will need to multiply the
index. So now you can't index into arrays both inside and outside of
interrupt service routines. Got a buffer that you want to store into as
data comes in and then handle outside the interrupt service routine? Too
bad! You can't!

None of this, of course, is documented.

What the hell is the point to a high level language if it's just going
to make my life more difficult than writing in assembly? If, in fact,
it's going to force me to use assembly to work around its lack of such
operators as, oh, bitshifts? And don't get me started on the
documentation. Or the header files. Or the debugging support. Or the
type checking. 

SO. MUCH. HATE.

-- 
<>                       :#,_@                          v
<^ " Michael Leuchtenburg  |  http://slashhome.org/ " +73
^  " cell: 413.433.0739                             " +7<

Generated at 14:00 on 27 May 2006 by mariachi 0.52