From: Michael Leuchtenburg Date: 21:16 on 20 May 2006 Subject: Basic18, and interrupt service routines 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.
From: Stig Brautaset Date: 21:47 on 20 May 2006 Subject: Re: Basic18, and interrupt service routines On 20 May 2006, at 21:16, Michael Leuchtenburg wrote: > ... > 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! *boggle* Best hate yet! Stig
From: Martin Ebourne Date: 00:04 on 21 May 2006 Subject: Re: Basic18, and interrupt service routines On Sat, 2006-05-20 at 16:16 -0400, Michael Leuchtenburg wrote: > 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 could always try the PIC C compiler. It's been a while since I last had cause to hate it so maybe it's improved, but despite their insistence that it was a C compiler it was anything but. More an assembler with curly brackets. And of course, without the control of a real assembler. > 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? I just gave in and used the assembler. Not bad actually, a whole lot less hate in that one. Cheers, Martin.
From: Michael Leuchtenburg Date: 19:58 on 23 May 2006 Subject: Re: Basic18, and interrupt service routines Spake Martin Ebourne: > On Sat, 2006-05-20 at 16:16 -0400, Michael Leuchtenburg wrote: > > 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 could always try the PIC C compiler. It's been a while since I last > had cause to hate it so maybe it's improved, but despite their > insistence that it was a C compiler it was anything but. More an > assembler with curly brackets. And of course, without the control of a > real assembler. I used CC5X a while back, and it very much matched that description. I recall it couldn't do certain things - like add three numbers together at once. Just a little bit limiting. Thankfully, it was just for a class, and we only had to use it as a demonstration that compiling C to the PIC is possible. I came away thinking that compiling C to the PIC was not worth it. There are some decent C compilers for microcontrollers, but the ones for PIC seem to have mostly decided to do away with things like "actually implementing the language they purport to". The PIC18 compiler claims "ANSI C compliance". Somehow, I doubt it.
From: Kevin O'Rourke Date: 22:16 on 23 May 2006 Subject: Re: Basic18, and interrupt service routines Michael Leuchtenburg wrote: > The PIC18 compiler claims "ANSI C compliance". Somehow, I doubt it. If that's Microchip's own compiler for the PIC18s then it's very close. I used it for a real work project and it's not bad. I had to occasionally look at the assembly output to check up on what the compiler was doing and then rewrite the C to get the assembly I wanted. Some of the other compilers suffer from amusing quirks such as assuming there's only one source file, i.e. they couldn't be bothered writing a linker.
Generated at 10:26 on 16 Apr 2008 by mariachi