how to learn Basic......

Discussion in 'General Electronics Chat' started by dthx, May 22, 2013.

  1. dthx

    Thread Starter Member

    May 2, 2013
    194
    14
    Im a little familiar with Basic.
    ...But I need a refresher course.
    I'm afraid if I buy Microchip's PicBasic Pro software and a demo board...I wont be able to do anything cause I cant find a tutorial on their software....they dont offer one....
    Well, tht's not entirely correct...they do have a rudimentary book they will give you...but it's not enough for someone like me and for where I'm at in my learning curve.
    So...I need some help and advice on this....
    How does one go about learning how to program in Basic?
    I dont have a college near me.....but, or course, there is Amazon...and I'm sure there are a number of books on the subject....
    Can anyone recommend a few?
    Elec Mech had some good ideas and I've called them all today and talked to their sales people, etc.....
    I can get PB Pro from melab for 15 days for free but they dont have a really good tutorial either....
    I feel like I should learn basic first....but how do I practice .....how do I see if I can actually do anything....
    I need a computer lab....and lecture....
    What to buy if you were me?
    thanks
    D.
     
  2. Meixner

    Member

    Sep 26, 2011
    116
    21
    http://www.pictutorials.com/PIC_books.htm

    This link has some books, you can Google "picbasic" and find more.

    EDIT: Oops I tried some of the links and they dont seem to work, however if you Google picbasic there are scores of sites dedicated to it.
     
  3. #12

    Expert

    Nov 30, 2010
    16,247
    6,744
    It isn't that bad. I took a course of Basic in 1975. Didn't need it again until 1990, so I just got the GWBasic book out and looked up what I needed. A few months ago, somebody posted a bit of PIC basic on this site and I could read it! Fifteen years, twenty-five years, no problem if you ever learned the "Basics" and have a book to go to.

    Even my mother took a course in Basic (probably because she thought it was about basic computer skills), and she passed.
     
    dthx likes this.
  4. crutschow

    Expert

    Mar 14, 2008
    12,974
    3,220
    dthx likes this.
  5. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Microchip doesn't make PICBasicPro, it's a product of microEngineering Labs which is a different company (though an official partner).

    I once used it and was not overjoyed with it: a compiler is supposed to catch ALL my syntax mistakes, not generate code that doesn't work correctly. It should not generate any code, it should tell me I made an error so I can fix it. When I (or the company I worked for) bought it there were very few compiler choices, now there is an over abundance.

    Microchip lets you download their C compilers for free. You could get their programmer and demo board for $50 or $70. These come with a set of lesson. If you poke around the MC pages you'll find downloads for these lessons so you can test run for free.

    C isn't Basic but isn't much harder... well, for most things. C is so powerful it makes it easy to shoot yourself in the foot, where Basic doesn't let you own a gun. Both are good to develop solid programs.

    Just sayin :rolleyes:
     
    absf, JMW and dthx like this.
  6. dthx

    Thread Starter Member

    May 2, 2013
    194
    14
    Lets say a man knows C...
    Can he use a microchip development board?
    And if all a man know is Basic....can he then program a microchip dev. board....
    I mean.....how does it all fit together....
    Is Basic language required to use a text editor and a compiler, and a programmer that is only made for Basic....
    and C wont work with it....
    I'm confused...
    D.
     
  7. Rbeckett

    Member

    Sep 3, 2010
    205
    32
    Interesting thread, subscribed...

    WCB
     
  8. crutschow

    Expert

    Mar 14, 2008
    12,974
    3,220
    C and Basic both need their own separate compilers/interpreters to run. The only similarity between them is that they are both high level languages. You have to download those for whatever processor you are using.

    Personally I much prefer the syntax of Basic as it is relatively easy to understand when reading a Basic program, since it uses standard English words. C has a arcane syntax that makes little sense until you understand it, almost like learning a new language.
     
    elec_mech likes this.
  9. dthx

    Thread Starter Member

    May 2, 2013
    194
    14
    Ok...that makes a little more sense...thank you.
    One more Q...
    Other than learning the Basic programming language...which I can do...
    Where does a man buy or get a compiler and programmer for Basic...
    AND ...do I need some sort of text editor...
    Will the devolopment boards that Microchip and melab sells then accept my programs...
    As I write this..I think I'm understanding that ALL of the PIC chips will take ANY kind of language if you have the right kind of compiler and programmer, etc...
    Right?
    D.
     
  10. MrChips

    Moderator

    Oct 2, 2009
    12,414
    3,353
    Yes, you are correct. The chip has little to do with the language.

    The language is something that humans have to deal with. The compiler puts your words into instructions that the chip can understand. The chip simply executes the instructions.

    You can get almost any language for any chip - within some limitations and constraints.

    The text editor is the old way of writing a program.You can still do it this way.
    Most languages today are implemented in an integrated development environment (IDE) and will come with its own editor. The advantage of this is that the IDE can tell you almost instantly where you have made spelling mistakes, improper language syntax and also will allow you to step through your program while debugging.
     
  11. crutschow

    Expert

    Mar 14, 2008
    12,974
    3,220
    Right. I think Microchip sells compilers, interpreters and development boards for both Basic and C which includes all the editors and software you need to write programs on a PC and download them through a USB port to the development board.
     
  12. dthx

    Thread Starter Member

    May 2, 2013
    194
    14
    Yes....after about a week of sitting in my Bar -O-Lounger and looking at the Internet and ringing up Microchip, Melabs, Digikey (distributor), Mouser (distributor)......and some others...
    I have found that:....and to the Group.....please correct me if my assumptions are wrong....
    Microchip, Inc. has no sales people to talk to in order to find out which products would be right for my application and my experience.
    Their distributors Mouser and Digikey are not very well informed in the Microchip product either...
    There are development boards that will allow you to play with your code to see if it will make the chip do what you want it to do....those are on Microchipdirect.com
    But there is very little info (in laymans terms) as to what each board isintended. The sales guy at Digikey didnt know...and he was lookin at the Microchip website with me.
    There are about 25 different boards..
    Frustrating...
    And I believe each board is designed for playing around with a specific chip ....to see what it will do..
    The PICBasic Pro Tutorial from Melabs (downloaded) is, at his point, Greek to me....
    So....It looks like I'm gonna have to go back and relearn Basic somehow...
    If I bought a Dev. Board and already Knew Basic..I would need:
    A Board....$30 to $225 USD
    The PCB software.....upwards from $120 USD
    A programmer.....$80 USD
    A breadboard...if the Dev. Board didnt come with one attached.....$20 USD
    Jumpers and peripherals.......$40 USD
    Maybe a USB cable and Maybe a power supply.
    So here I sit....
    Still un sure as to what to do....

    How about this for a plan....Tell me if I am missing something...
    I obviously have a computer....with Vista....plenty of memory and space, etc.
    I could purchase the PCB Student Version from Melabs for $49.00 as this is a non commercial project for the 4H kids in my Parish....
    I could then get a breadboard , some components, some led's , a relay or two...and a Chip that you guys would recommend...
    Then I could try to make something work.....
    I could use the circuits that you, hopefully could work out for me...as long as they had values for the components....
    All the while using the set-up to brush up on my Basic....
    I'm basically building a pop up target system for our 4H Shooting Sports Program. The targets would pop up at various times and be down for various times....I've got 6 targets.....hence, the 6 solenoids ( 12vdc sols operating air valves)
    And I want to change their sequence around from time to time.
    Doesnt seem like a hard thing to do...but...
    Plus....the 4H is always strapped for money which always makes things like this a little challenging.
    What say all of you?
    D.
     
  13. DerStrom8

    Well-Known Member

    Feb 20, 2011
    2,428
    1,328
    Personally, I use PICs and write the code in C, compiled with the free Hi-Tech C compiler or free version of C18 (for the 18F series). Highly recommended.
     
  14. crutschow

    Expert

    Mar 14, 2008
    12,974
    3,220
    I have a Basic Stamp controller from Parallax which is very easy to use. It has a microprocessor on a development board with built-in Basic which connects directly to your PC for developing and downloading the program into the processor board. You might look into that for a start.
     
  15. MrChips

    Moderator

    Oct 2, 2009
    12,414
    3,353
    You could buy a PICkit2 or PICkit 3 for about $50.
    Microchip is not the only mcu manufacturer and BASIC is not the only language.

    The Arduino is a very popular platform. You can get started for about $25.

    I have created an educational blog using the TI MSP430 Launchpad that sells for $10.
     
  16. crutschow

    Expert

    Mar 14, 2008
    12,974
    3,220
    For me it is. ;)
     
  17. MrChips

    Moderator

    Oct 2, 2009
    12,414
    3,353
    BASIC was invented to make computer programming easy to learn. For that purpose it has been very successful but it does limit what you can do. If you want to get serious about programming microcontroller chips I would recommend moving on to learning C.
     
  18. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    I would change the last statement to "Then I would cry as nothing worked."

    Did you read my link to my other post? You really need something you know works when you start, or you chase your tail finding the error.

    So get a dev board to start. ANY dev board will probably do.

    A PICkit 2 or 3 to program. (The "yellow peril" did not earn that nickname for it's stellar performance.)

    I think PICBasic is too expensive for too little but it's one of the few Basic compilers out there. OshonSoft is another. I've used both of these compilers and prefer OshonSoft's by far, and it is 1/4 th the price.
     
  19. crutschow

    Expert

    Mar 14, 2008
    12,974
    3,220
    Depends upon how you define "serious". I think most beginning hobbyists in programming are interested in doing simple programs to perform simple tasks, and Basic is much easier to learn than C with its cryptic notation. I would be surprised if the programming limits of Basic would be a significant problem for most amateur programming projects. If you can give an example of that, I would be interested. ;)
     
    elec_mech likes this.
  20. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    Sorry, would've responded sooner, but was out all day on a business trip with no internet access.

    As you can see, we all have our opinions and reasons for using a specific language, chip, and platform.

    Regardless of the language you select, there are specific forums for nearly every language available with members similar to ourselves who are more than willing to help you out. So there is plenty of help available in getting started, selecting hardware, etc. - it's just knowing where to go. Manufacturers and suppliers are great, but as you've learned, most of them haven't used the hardware or really know how to help get you started. But that's what forums are for. :D

    Let's take a step back first. What do you see using uC's for now and in the future?

    If you're not planning to make a career of programming and your projects will be similar in scale to your solenoid project, then BASIC is fine and will be the easiest and quickest language to learn.

    That said, some chips are designed to only work with a specific language/compiler, some are not. PIC chips can be programmed in assembly, BASIC, or C (and perhaps others). You can use MPLAB which serves as your text editor and works with the compiler of your choice. Parallax Basic Stamps only work with Parallax software and likewise for PICAXE.

    You've mentioned the following: limited money, relatively simple project, some experience with BASIC, overwhelmed with options such as chip selection and dev boards. Based on this criteria, I would strongly recommend starting with PICAXE.




    Pros:
    • Software cost: $0
    • IC cost: nearly the same as a PIC but with less than 10 chips to choose from as opposed to nearly hundreds - while this may sound limiting, it really isn't - each chip is a different size so you can go as small or as big and full featured as you want.
    • Dev board not needed if you're okay using a breadboard, but they are available
    • Programming cable for under $30, under $10 if you add a simple circuit
    Cons:
    • Interpreted BASIC so there will be some limitations with speed, but there are workarounds usually in the form of extra hardware.
    I think using a PICAXE, at least for now, will let you quickly and inexpensively get into the world of uC's easily without a lot of extra hassle or headache. Because the start-up cost is so low, you can always move into PBP, C, PICs, etc. later if you decide you need more speed, functionality, etc. without breaking the bank right now.

    I know it's extrememly tempting to go all out and buy the best and biggest you can afford, but since programming is new to you, I suggest starting simple and cheap and getting a feel for it. Again, I don't think the PICAXE is going hinder you in any way, certainly not for the solenoid project.

    And since you like to research and do your best to understand what to do before spending money (a wise choice), you can read up on PICAXE chips here (intro), here (coding), and here (example projects).

    Now, if you decide to go this route, let me know and I might be able to hook you up with a programmer if I get Tracecom's blessing (originally his). If you're in the U.S., here's a great place to buy chips, dev boards, etc. for PICAXE. They also have good pricing on prototyping accessories. Be warned it can take a little over a week to get as they're based in Canada.

    Once you decide what uC family and language you want to use, we can move forward on your solenoid project.
     
    dthx likes this.
Loading...