Author |
Message |
Thomas_Henry
Joined: Jul 24, 2009 Posts: 170 Location: N. Mankato, MN
Audio files: 3
|
Posted: Fri Nov 02, 2012 4:52 pm Post subject:
PICs Anyone? Subject description: Powerful Compiled Basic at Your Disposal |
|
|
Hi gang,
If you've ever wanted to program PIC microcontrollers easily and without breaking the bank, then be sure to see my new article in the November issue of Nuts & Volts. In it I show you how to set up a compiled Basic system which is not only inexpensive (free if you avoid the ethics) but extremely powerful.
This is a lead-in for a whole new series of PIC based projects for music, should you wish to get a head start now.
Thomas Henry |
|
Back to top
|
|
|
Dan Lavin
Joined: Nov 09, 2006 Posts: 649 Location: Spring Lake, Mi, USA
Audio files: 21
|
Posted: Fri Nov 02, 2012 4:59 pm Post subject:
|
|
|
Thomas, yeah I got my issue earlier this week. Fortunately my work pays for me to read it! Looking forward to more PIC projects! _________________ Synth DIY since 1977! |
|
Back to top
|
|
|
fonik
Joined: Jun 07, 2006 Posts: 3950 Location: Germany
Audio files: 23
|
Posted: Sat Nov 03, 2012 3:53 pm Post subject:
|
|
|
hey, i just subscribed for 20USD/year with full access to all backissues!? that's awsome. should have done it earlier...
now going to read your new article, thomas. _________________
cheers,
matthias
____________
Big Boss at fonitronik
Tech Buddy at Random*Source |
|
Back to top
|
|
|
DES
Joined: Feb 28, 2003 Posts: 794 Location: New Jersey
Audio files: 8
|
Posted: Sun Nov 04, 2012 11:26 am Post subject:
|
|
|
Me too! Good deal...looking forward to catching up. I haven't read NV in quite a while. _________________ Dave
www.davesneed.com |
|
Back to top
|
|
|
State Machine
Janitor
Joined: Apr 17, 2006 Posts: 2809 Location: New York
Audio files: 24
|
Posted: Tue Nov 06, 2012 5:42 am Post subject:
|
|
|
Just got my issue yesterday !! Looks great and very complete. Good alternative to paying lots of cash for Pic Basic OR Pic Basic Pro from ME Labs. Before I put my foot in my mouth, will have to read and decide.
Bill |
|
Back to top
|
|
|
fonik
Joined: Jun 07, 2006 Posts: 3950 Location: Germany
Audio files: 23
|
Posted: Wed Nov 07, 2012 3:26 am Post subject:
|
|
|
i am really looking forward to see what thomas makes out of it. i would have thought that Basic is not that effective for PIC, since it would create more code than Assembler or even C - and the memory of a PIC is limited!? _________________
cheers,
matthias
____________
Big Boss at fonitronik
Tech Buddy at Random*Source |
|
Back to top
|
|
|
Uncle Krunkus
Moderator
Joined: Jul 11, 2005 Posts: 4761 Location: Sydney, Australia
Audio files: 52
G2 patch files: 1
|
Posted: Wed Nov 07, 2012 3:59 am Post subject:
|
|
|
Yeah, but the PIC stuff I've done used compiled basic, which means you had to bounce it through two conversion programs, and then it was written as assembly to the PIC. Of course you could edit it as HEX just before it got sent down the serial port to be flashed, if you were into that sort of thing. Most HEX that I've edited, I didn't understand. Not that I couldn't, just that my attention span was never great.
I've only got an old 16F84, and some very specific programmer, but I'm sure there are heaps better everything now. (My PIC experience is way back in 2004! Almost a decade is an eternity with this stuff! )
Still, it would be nice to create a strange noise with anything these days. (does that sound a bit desperate?!? )
I'll be watching very closely, and getting itchy fingers no doubt.
Maybe I could pull out that old PIC and get it to do something! It's got two analogue In/Outs and about 8 digital. You can program the analogues to be digital if you want.
I can say right now that I've got a big job with the Nexus 1 on the slab at the moment, and Frankie is vying for attention too, so this is probably just a pipe dream. _________________ What makes a space ours, is what we put there, and what we do there. |
|
Back to top
|
|
|
fonik
Joined: Jun 07, 2006 Posts: 3950 Location: Germany
Audio files: 23
|
Posted: Wed Nov 07, 2012 4:22 am Post subject:
|
|
|
can someone help me getting the syntax files? the link in the article directs me to nuts&volts main page. there i am lost... _________________
cheers,
matthias
____________
Big Boss at fonitronik
Tech Buddy at Random*Source |
|
Back to top
|
|
|
elmegil
Joined: Mar 20, 2012 Posts: 2177 Location: Chicago
Audio files: 16
|
Posted: Wed Nov 07, 2012 7:16 am Post subject:
|
|
|
If you go to downloads for the current month (Magazine -> Downloads from the main menu) it has a link to a zip file there, and the syntax and other files are in it. |
|
Back to top
|
|
|
fonik
Joined: Jun 07, 2006 Posts: 3950 Location: Germany
Audio files: 23
|
Posted: Wed Nov 07, 2012 7:33 am Post subject:
|
|
|
thanks.
i thought i would have to log into the digital publication _________________
cheers,
matthias
____________
Big Boss at fonitronik
Tech Buddy at Random*Source |
|
Back to top
|
|
|
Thomas_Henry
Joined: Jul 24, 2009 Posts: 170 Location: N. Mankato, MN
Audio files: 3
|
Posted: Wed Nov 07, 2012 11:48 am Post subject:
|
|
|
Hi all,
I just got done with a huge project and had no trouble with memory. In fact, I was left with 300 words of program space and some 200 bytes of RAM unused.
The truth of the matter is that GC Basic does a very good job of compiling the code. I always take a look at the compiled code before assembling it and marvel at how efficiently the compiler has arranged things. It uses very sophisticated algorithms to rearrange the code in memory.
May I recommend the PIC16F88? There's hardly a thing that can't be done with it and I'd be very surprised if memory was ever an issue.
By the way, my big project included MIDI, and was a hybrid analog/digital design. The code was 900 lines of source and 3800 bytes compiled and assembled. There was more than enough room for some 20 LCD menus. The article describing it has just gone to Nuts & Volts; I'm waiting to hear if it was accepted.
So anyway, GC Basic is actually a very good language, I think.
Thomas Henry |
|
Back to top
|
|
|
mrmrshoes
Joined: Feb 19, 2011 Posts: 73 Location: Newcastle Upon Tyne
Audio files: 4
|
Posted: Wed Nov 07, 2012 1:57 pm Post subject:
|
|
|
This stuff sounds really promising and is defos something i want to get into.
Can't wait to see what projects you come up with in the further.
One thing that is holding me up is figuring out what programmer to buy.
Can anyone recommend or talk about a cheap and reliable USB (windows 7) type.
thanks alot
shoes |
|
Back to top
|
|
|
Thomas_Henry
Joined: Jul 24, 2009 Posts: 170 Location: N. Mankato, MN
Audio files: 3
|
Posted: Wed Nov 07, 2012 5:10 pm Post subject:
|
|
|
Hi Shoes,
My first programmer was very expensive (the school paid for it though) since it was actually a very complete trainer in addition. My next one was cheaper, but very slow.
But just last week I finally got the one I love:
http://www.sureelectronics.net/goods.php?id=1141
Here's the deal. This will program any PIC, and also comes with a universal ZIF socket. It really works great for me and is extremely fast. Note that this currently is on sale with free shipping from Hong Kong. It took about two weeks to arrive.
So, that's the one I'll be using from now on.
Thomas Henry |
|
Back to top
|
|
|
wmonk
Joined: Sep 15, 2008 Posts: 528 Location: Enschede, the Netherlands
Audio files: 15
|
Posted: Thu Nov 08, 2012 4:13 am Post subject:
|
|
|
That's a great deal. I've been using the original PicKit 2 for a while now, and while it works fine, I had some troubles setting it up with the newer PICs. And it works from Linux too, which can be an issue to some
I like the 16F88 too, not many PICs that cheap with those ADCs.
How's setting up a project with the BASIC? For Assembly and C it can be quite a PITA, getting all configuration words the way they need to be. _________________ Weblog! |
|
Back to top
|
|
|
Thomas_Henry
Joined: Jul 24, 2009 Posts: 170 Location: N. Mankato, MN
Audio files: 3
|
Posted: Thu Nov 08, 2012 4:55 pm Post subject:
|
|
|
Hi everyone,
Yeah, this unit is a hellacious bargain. There are several easy mods you can render to make it perfect.
First, the three layers of plexiglass are really beautiful, but too tight for larger fingers to navigate. I disassembled the layers and reassembled to two layers only with no protruding standoffs. This won't make sense until you actually get the unit, but only takes a minute to do. Attached is a photo showing the result.
Next, it's easy to forget the orientation of the PIC, so I put little white "ones" on the ZIFs showing where pin 1 is in all cases. You can see them in the photo if you look carefully.
The instructions don't mention it, but the unit has been wired to work with 8, 14, 18, 20, 28 and 40 pin PICs, not just the three sizes shown. You just have to know how to plug the chips in. I made a decal showing the placement, and attached it to the bottom of the unit. The second photo shows that. I've also included my artwork for the decal, below.
With regard to setting config bits, it's completely painless in Great Cow Basic. First, the compiler is very sophisticated in that it examines your code and tries to anticipate which bits should be set. It's almost always correct! But you do have the option of overriding this if needed, and don't have to learn any weird syntax. Trust me, you'll never give it a second thought. As an example, here's a program to flash all 8 LEDs on Port B. Notice how quick the setup is:
Code: | ;A program to blink eight LEDs on Port B once a second,
;this time with a 4 MHz clock.
#chip 16F88, 4 ;PIC16F88 running at 4 MHz
#config mclr=off ;reset handled internally
#config osc=int ;use internal clock
;************************ Constants ************************
#define LEDs PortB ;LEDs are on all 8 Port B pins
;************************ Program *************************
pgm:
dir LEDs 0b00000000 ;make all Port B outputs
main:
LEDs = 0b11111111 ;turn LEDs on for 1/2 second
wait 500 ms
LEDs = 0b00000000 ;then off for 1/2 second
wait 500 ms
goto main ;repeat in perpetuity
end |
I'm telling you, this compiler is great!
Oh, almost forgot, I also glued some rubber feet to the unit.
Thomas Henry
Description: |
|
Filesize: |
174.4 KB |
Viewed: |
11695 Time(s) |
|
Description: |
|
Filesize: |
319.74 KB |
Viewed: |
165 Time(s) |
This image has been reduced to fit the page. Click on it to enlarge. |
|
Description: |
|
Download |
Filename: |
Decal.pdf |
Filesize: |
37.42 KB |
Downloaded: |
146 Time(s) |
|
|
Back to top
|
|
|
bubzy
Joined: Oct 27, 2010 Posts: 594 Location: United Kingdom
Audio files: 64
|
Posted: Fri Nov 09, 2012 12:33 am Post subject:
|
|
|
a word of warning to anyone who clicks without reading....
make sure you click the preferred subsciber button if you want access to back issues. i neglected to do this and didnt have access, thankfully, the people at nuts and volts are very helpful and amended this for me, so its not 100% critical, but it might save some days of headscratching. (maybe i should just read before i click?)
but $19.99 a year?! ... awesome _________________ _Richard_ |
|
Back to top
|
|
|
mrmrshoes
Joined: Feb 19, 2011 Posts: 73 Location: Newcastle Upon Tyne
Audio files: 4
|
Posted: Fri Nov 09, 2012 4:36 am Post subject:
|
|
|
Thanks alot TH
That's a great find. Awesome deal to boot. I'll have to order one this weekend.
By the way, thank you for all your help, circuits, books and articles.
shoes |
|
Back to top
|
|
|
Thomas_Henry
Joined: Jul 24, 2009 Posts: 170 Location: N. Mankato, MN
Audio files: 3
|
Posted: Fri Nov 09, 2012 2:06 pm Post subject:
|
|
|
Hi all,
Would anyone do me a favor, please? If you successfully set up the IDE described in the article, would you leave a note here indicating so? Thanks. A reader contacted N & V saying that some files were missing and he couldn't accomplish the task. I checked again, and everything seems to be there. I'd simply like a different set of eyes to confirm the article and files are complete.
Thanks for your help,
Thomas Henry |
|
Back to top
|
|
|
Uncle Krunkus
Moderator
Joined: Jul 11, 2005 Posts: 4761 Location: Sydney, Australia
Audio files: 52
G2 patch files: 1
|
Posted: Fri Nov 09, 2012 5:15 pm Post subject:
|
|
|
Thomas_Henry wrote: |
May I recommend the PIC16F88? There's hardly a thing that can't be done with it and I'd be very surprised if memory was ever an issue.
Thomas Henry |
So far I've found out that the 16F88 is an enhanced version of the 16F84A. Still 8bit, still 18pin. (The 16F88 is actually 65cents cheaper) Depending on how it is enhanced, at the very least, if I got the old programmer up and running, I'm sure I could knock something up, and the coding would have to be very similar, no? So I could probably still try out the same sort of stuff. Maybe shift to the 16F88 once I've used this lonely old 84A.
Playing around with both could only add to the fun I s'pose! _________________ What makes a space ours, is what we put there, and what we do there. |
|
Back to top
|
|
|
Thomas_Henry
Joined: Jul 24, 2009 Posts: 170 Location: N. Mankato, MN
Audio files: 3
|
Posted: Sat Nov 10, 2012 2:51 am Post subject:
|
|
|
Hello Uncle Krunkus,
If memory serves me, the only difference between the 84 and the 88 is the lack of the built-in USART; everything else should be the same.
So, apart from MIDI, you ought to be able to do every thing else.
Great Cow should treat it the same, apart from the USART. So, start some experiments...It's fun...
Thomas Henry |
|
Back to top
|
|
|
fonik
Joined: Jun 07, 2006 Posts: 3950 Location: Germany
Audio files: 23
|
Posted: Sun Nov 11, 2012 7:10 am Post subject:
|
|
|
Thomas_Henry wrote: | Hi all,
Would anyone do me a favor, please? If you successfully set up the IDE described in the article, would you leave a note here indicating so? Thanks. A reader contacted N & V saying that some files were missing and he couldn't accomplish the task. I checked again, and everything seems to be there. I'd simply like a different set of eyes to confirm the article and files are complete.
Thanks for your help,
Thomas Henry |
today i tried to set up everything.
the first thing i recognizes was that the GCBASIC.bat and the MPASM.bat files have the .txt extension in the NV download. i bet the renaming is due to security issues!?
then, i cannot rename Gcbasic to GC Basic Compiler in the Configure/Preferences/Tools sub-menu. There is no renaming command (i.e. via right mouse button). I am running TextPad 6.3 on a 64bit system.
i cannot read the text in the screenshots 3 to 5 very well., it is very blurry:
/o:$BaseName.asm /k:a /np $file in screenshot 3?
otherwise it seems to work quite fine. i did not install the pickit, though. _________________
cheers,
matthias
____________
Big Boss at fonitronik
Tech Buddy at Random*Source |
|
Back to top
|
|
|
Thomas_Henry
Joined: Jul 24, 2009 Posts: 170 Location: N. Mankato, MN
Audio files: 3
|
Posted: Sun Nov 11, 2012 10:10 am Post subject:
|
|
|
Hi again,
To rename the tool in the menu you mentioned above, click once and then click again. (Don't do a fast-double click, though).
Here are the parameters:
/o:$BaseName.asm /k:a /np $File
The help file in TextPad is very good about explaining these.
Thomas Henry |
|
Back to top
|
|
|
fonik
Joined: Jun 07, 2006 Posts: 3950 Location: Germany
Audio files: 23
|
Posted: Sun Dec 02, 2012 12:33 pm Post subject:
|
|
|
i still get an error message from textpad when trying to start MPASM. i installed the current MPASM version X (mpasmx) on my 64bit system...
alas, i don't have much time these days, so i can try things only now and then...
anyways, thomas, i sent you PM _________________
cheers,
matthias
____________
Big Boss at fonitronik
Tech Buddy at Random*Source |
|
Back to top
|
|
|
Thomas_Henry
Joined: Jul 24, 2009 Posts: 170 Location: N. Mankato, MN
Audio files: 3
|
Posted: Mon Dec 03, 2012 9:01 pm Post subject:
|
|
|
Hello Fonik,
Unless you really need MPLab X for more advanced PICs, you probably ought to avoid it. Version 8 gets much more favorable reviews for speed, stability and ease of use. Anyway, I assure you, TextPad can easily use the assembler.
And, I haven't received any PM's.
Thomas Henry |
|
Back to top
|
|
|
blue hell
Site Admin
Joined: Apr 03, 2004 Posts: 24079 Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320
|
Posted: Tue Dec 04, 2012 4:22 am Post subject:
|
|
|
Thomas_Henry wrote: | Unless you really need MPLab X for more advanced PICs, you probably ought to avoid it. Version 8 gets much more favorable reviews for speed, stability and ease of use. |
Or more in general, once you have a working MPLab, do not "upgrade" unless absolutely needed, Microchip manages to break at least something with every new release. I've ended up making a lot of workarounds for that over the years (one of them was making my own macro pre-processor). _________________ Jan
also .. could someone please turn down the thermostat a bit.
|
|
Back to top
|
|
|
|