PicBasic Fundamentals


Closed Thread
Results 1 to 10 of 10
  1. #1
    Billyc's Avatar
    Billyc Guest

    Wink PicBasic Fundamentals

    Being a new guy on the block , I thought I would give some insight into the PicBasic compiler .Probably from a make money point PicBasic Pro and PicBasic commands and syntax are different. As a consequence users who are less affluent have to buy the less expensive PicBasic compiler. There are not many tutorials books on the subject and the manual that comes with the PicBasic Compiler is so disorganized and leaves the reader more confused than when he first opened the booklet. However all is not lost there are several books now popping up and I will give you the titles and subject matter.The first book I purchased was Pic Basic An Introduction by Eric Edwards & Neil Roberts. Very well written and explains in detail the make up of the 16F84. It writes and explains for 65 % of the book how to switch on leds in different sequences.. The rest of the book covers amplifiers, programmers , timers etc. However what was sadly missing was programs using servos. The conversion from decimal to binary,hex was a little clumsy and could help with 'Double Dabber' and weighting the terms.The other book I studied was Pic Microcontroller Project Book. by John Iovine. This book is a good buy and is based upon the 16F84. Projects cover flashing lights and then goes deeper into motor control including servo's, steppers, A to D's, DC motor control and controlling AC appliances.I am at the stage of converting PicBasic Pro programs to PicBasic , it's a boondoggle but the light is at the end of the tunnel.It would be appreciated if someone could suggest other sources . Bill Cridland WA1HMW Bolton MA

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    I've had this conversation a lot over the years about folks complaining about the documentation (or supposed lack of it). The PB manual is identical in format to the PBP manual and yes, there's that flashing LED program there to get you started. Each command is explained in the manuals, and more often than not there is also an example of usage shown. The MeLabs site has lots of sample programs so that there is also familiarity of the structure of a PIC program.

    What people purchase is a COMPILER (which does it's job very well) and not a complete educational course in Basic. Where should a software author stop documenting? One has to make an assumption somewhere down the line that the user knows how to program in Basic.

    If you buy an accounts package, you don't get an accounting course thrown in for free. If you buy a CAD package, it doesn't come with an integral course in archetectural design. If you buy a book, the author has assumed (and it is generally accepted) that you have learnt to read. Likewise with a Compiler.

    Unfortunately, I've discovered that lots of people with PB (and PBP) are totally clueless. They rely on Cut and Paste from other peoples code without having the vaugest idea of what they're doing. If there was a book showing you how to build and program a Weather Station, somebody would complain that the example had SEROUT for comms instead of HSEROUT, and that it was written for a 16F628 and not a 16F628A. You just can't win.

    The best book IS the MeLabs manual supplimented by the PIC's Datasheet. There's also no substitute for experience - and you don't get that from books... you get that from sitting and doing and learning from your mistakes... you get that from writing code, and analysing line by line, instruction by instruction what's happening.

  3. #3
    Billyc's Avatar
    Billyc Guest


    Did you find this post helpful? Yes | No

    Default

    Melanie down to the nitties. Out here in Rio Linda we are engineers and most are computer programmers for instance I teach C++ . The thrust Melanie is not in the compilers PB or PBP they are great, they always work ,however what we are saying is why not have the same code for both compilers. Obviously the more expensive compiler will have more flexibilty more commands et al. It's akin to GM making a product line with totally different accessories for each version. Does not make sense.About the PicBasic code , PB & PBP are totally different syntax some commands are the same however this again is contributing to a lot of confusion. Books that are on the market Melanie have half the book for PB and the other half for PBP, what utter nonsense.The only writer who has homed in on just PB and the 16F84 is John Iovine and an elementary book published in the UK by Eric Edwards and Neil Roberts. Suggest Melanie you show this reply to management. My thinking let's get it right first time. Consider revisions , you have to make corrections to both versions whereas if it were same code only one update version is required. The only PB manual I received was from MicroEngineering Labs, Inc perhaps there is another one out there , Melanie the intent of the memo is not to criticize the product but to try and make it better and saleable to the public.Finally consider the course I am teaching C++ if the founders had two or three code versions we would really be in a mess.

  4. #4
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Billyc,

    Billy>>The only PB manual I received was from MicroEngineering Labs, Inc perhaps there is another one out there , Melanie the intent of the memo is not to criticize the product but to try and make it better and saleable to the public.Finally consider the course I am teaching C++ if the founders had two or three code versions we would really be in a mess.<<

    Billy, I used to teach C/C++ at both WSU and BCCC before my hearing loss. I program for a 100+ million dollar company in C/C++. I use Borland compilers, and own probably 10 of them... From Turbo C/C++ Version 1.01 to Borland Builder 6.0. And there are *many* differences between each and every one of them. What I have found, is that sometimes it is better to write my program in the earliest version (to debug) then update it to the newest version. And when i do such things, I find that it will have to be changed to some degree (because of different ANSI requirements of C/C++ that are changing throughout the years).
    Thus, what i am saying, there are a extreme number of Versions in C/C++....not near as many in PBP.

    Since it is difficult to "teach" a full course in electronics, how do you expect for 1 book to cover all?

    Lets put it this way... in a language you and I understand... Lets go back to the 1970's ok??? Remember the Novice 2 years non-renewable? CW only? You either bought a book that had information in it, or found a Elmer. (And GOD BLESS that Elmer!). He had so much knowledge, kindness, love, and patience as we blew up the 2n2222's and 12AX7's <g>... And if you (I say *IF* you were lucky to find a 6L6, you would make yourself a lunchbox transciever with a rock of 7.120 mhz, and a regen. receiver that had a bandwidth of 500khz <g>...but it was music to the ears! And if you got brave and upgraded to gen...that EICO 7Drifty3 <g> or the Eico 720 Rock bound (for the novice).

    Anyhow, to pass that test, we learned the very basics of dipping the plate, and peaking the grid. We learned of simple amplifiers and tuned circuits. We learned that if our "Eyes" felt a tingling, that RF was fairly high <g>. (Gosh, I LOVE reminessing<sp> about the good old days... sorry about this)

    But in actuallity, it took a lot more than 1 book to get through to Extra Class Licenese.

    Granted the book lacks a lot of things, I agree. But how to do you go through a few years of good electronics in such a short book? Especially when the PBP has such a tremendous range of power in *all* areas of electronics? Most people are clueless how PWM works, or how to use it. Putting together a electronic motor and PWM maybe out of their league. Its like trying to tell someone nowadays about a grounded grid amplifier. Heck...most would say "What is THAT?"

    Anyhow... I am also fairly new to the PIC chips, but am experienced in the philips chips. I had a LARGE learning curve, and still have a large learning curve with these PICS. But I am able to get my projects done. I find myself reverting back to the very basics, and not using the total Value of PBP. I find myself writing my own LCD routines, instead of using LCDin and LCDout.

    I am thankful for the people here, that are my so-called Elmers, and are patient with me and my stupid questions. But I do agree with you that it would be nice to have a book of somekind that goes more into detail of the majority of things PBP has...And I also realize that PBP cannot teach two years of electronics <g>.

    Dwayne

  5. #5
    Billyc's Avatar
    Billyc Guest


    Did you find this post helpful? Yes | No

    Default

    Dwayne thanks for your inputs here my call is WA1HMW extra . About the changes in C++ well it was going thru bits and piece changes in ealier versuions but com in the late 90's ISO meetings et al all have to conform the ISO agreements.Like you I write all my code in earlier versions of Turbo C++ and change syntax( small header changes) to conform to ISO.About PB & PBP all I am saying Dwayne is if they were developing a new product ( Compiler) basically using the Basic Language geared to Microcontrollers then why they did not make a common language for both versions. From a money making aspect make the PBP more versality extra features commands et al.That is the thrust Dwayne get it right first time around. Regards Bill Cridland WA1HMW Bolton MA

  6. #6
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Billy,


    Billy >>Dwayne thanks for your inputs here my call is WA1HMW extra .<<

    I am also a Extra. Though I wish the tests were like they used to be....( I guess I am a old die hard....but oh well...)

    Billy>> About the changes in C++ well it was going thru bits and piece changes in ealier versuions but com in the late 90's ISO meetings et al all have to conform the ISO agreements.Like you I write all my code in earlier versions of Turbo C++ and change syntax( small header changes) to conform to ISO.<<

    <chuckle> Its because we know the advantages of keeping things backward compatible <g>

    Billy>>About PB & PBP all I am saying Dwayne is if they were developing a new product ( Compiler) basically using the Basic Language geared to Microcontrollers then why they did not make a common language for both versions. <<


    To my understanding, they are very much common between them. The main differences are how they access the ports, how they access memory (especially above the 2k limit), and other things.

    Since I did not write PBP, I am going guessing on this ok? But my guess is, they used "Classes" as in C++. and when PBP was formed they may have used different names and passing variables, but used the same functions such as peek and poke. That way, the code did not change, but the methodology of calling the routine did. (if they wanted to change it). Like a Class within a Class doing a "Inheretance". Then it would make somewhat sense to me on how they "progressed" to PBP. I have to admit, I would hate to "backward Pedal" to PB from PBP!.

    LIke I say, I am very new to these PICS. I have heard about them for probably15 years, and I chose the PHilips chips over them. But with the Price of these babies, and the Flash memory... Wow! Love it. I can make mistakes a heck of a lot faster! <g>.

    I just got through buying PBP. Mainly because I liked the memory management, and kept my learning curve much lower. I started out using ASM, but there were so many minute details, I decided maybe saving time and going to PBP. So I went to compilespot.com. I tried out the PBP (but it was limited to 900 bytes of code). I was able to try out many different things.. enough to where I bought the package.

    I still find myself writing my code in the "Basics", because I can trust myself more than the compiler <g>. I also have more control of what I want to accomplish....(though I probably waste more time troubleshooting things <g>).

    You ever run Sats? I used to run AO10 when it was up. Did a little EME. Did a little SSTV, packet, But my favorite was CW. When I was in prime, I ran 45 WPM...I can probably run 20 now. Who knows... I may have chatted with you at some point in the past 30 years <g>. I would have to check my logbook.

    Dwayne (PS Great Pleasure chatting with you)

  7. #7
    Billyc's Avatar
    Billyc Guest


    Did you find this post helpful? Yes | No

    Default

    Dwayne points well taken however when I compared the two codes you dont have to go further than declaring the variables at the beginning. In PB one uses Symbol and the PBP another boondogle . About ham radio , still active here and most on Navy nets I belong . Mostly CW Dwayne 21.052 and 14.052 Navy Ham channels. Regards

  8. #8
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Billy!

    Billy>>About ham radio , still active here and most on Navy nets I belong . Mostly CW Dwayne 21.052 and 14.052 Navy Ham channels. Regards<<

    Wonderful!....I may just attempt to say hello to you on 20 meters. That has a better chance than 15 for our distance.

    Dwayne

  9. #9
    Join Date
    Jul 2003
    Location
    USA - Arizona
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    Billyc,

    No arguments about the manual, it could resemble more the likes of other compilers. However, for the intended market PBP does its work.

    For a somewhat more advanced, and a little better supported ( IMHO), compiler look at Proton+.

    Back to your original question on help, when in doubt go back to the SOURCE. That would be Parallax, look at the STAMP manual (now, there are some people that know a little about documentation). Understand that PBC attempts to port BS1 and PBP attempts to port BS2.

    Quote:
    "The main benefits of PicBasic Pro over the PicBasic Compiler are access to more RAM, ..., BS2 library commands, ... The standard PicBasic Compiler is still quite capable. If you need maximum BS1 compatibility, or you are using only the smaller PICmicros, the PicBasic Compiler could make a lot of sense."

    I will add that support for PBC is pretty dismal too. PBP is much better supported, and much better language. Updates to it are more frequent (some will argue not frequent enough, but who's keeping track?).

  10. #10
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    I don't think that PBC isn't particularly supported, it's just that most of the folks with expertise are using PBP. If you look at this forum, there's not exactly been many questions posted in the PBC pidgeon-hole... and the email based forum similarly used to have less than one posting in a hundred about PBC.

Similar Threads

  1. How to configure SPI in PICBASIC PRO?
    By moogle in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 15th April 2007, 18:31
  2. Need help deciding = BASCOM 0r PICBASIC
    By Chris DeHut in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 26th January 2006, 16:38
  3. Picbasic VS C Compiler
    By koossa in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 11th October 2005, 21:44
  4. Replies: 22
    Last Post: - 12th July 2005, 17:39
  5. PicBasic Pro & PicBasic syntax different
    By Billyc in forum General
    Replies: 5
    Last Post: - 16th April 2004, 21:19

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts