EmbeddedRelated.com
Forums

BASIC advice...

Started by clayforge September 4, 2003
I don't want this to become a mines better than yours argument but I
have to comment.

As an Ex PBpro user I know the strenghts and weekness of the
compiler. You will find a large number of ex PBpro users now using
Proton+ I have never heard of it the other way around!

Floating point maths in Pbpro is a joke!!!!!!!!!!

to perform this sum

Lcdout $fe, 1, "(A*B)-(C*D) = ", dec aint ' display the end result
in decimal

you have to write this:-

cdproductexp var byte '4 bytes required for storing numbers
cdproduct0 var byte 'in floating point format
cdproduct1 var byte
cdproduct2 var byte
ainput con 1005 '4 inputs - A,B,C,and D
binput con 1000
cinput con 1000
dinput con 1000
aint = cinput
Gosub itofa ' Convert int to float
bint = dinput
Gosub itofb ' Convert int to float
Gosub fpmul ' FP multiply
cdproductexp = aexp ' store the product of C*D in
cdproduct0 = aargb0 ' floating point format
cdproduct1 = aargb1
cdproduct2 = aargb2
' multiply A*B using float (1005 * 1000 = 1005000)
aint = ainput
Gosub itofa
bint = binput
Gosub itofb
gosub fpmul
bexp = cdproductexp ' restore the product of C*D
in
bargb0 = cdproduct0 ' floating point format (B
arg)
bargb1 = cdproduct1
bargb2 = cdproduct2
Gosub fpsub ' perform the subtraction A*B - C*D
(1005000 - 1000000 = 5000)
Gosub ftoia ' Convert float to int

And note that there is no decimal point used!

To do the same in Proton+ you write

Dim A as Float
Dim B as Float
Dim C as Float
Dim D as Float

A = 102.34
B = 29.6
C = 3900.43
D = 567

A = A*B
C = C*D

Print at 0,0,Dec A-C

Ask a Pbro writer if he can write a Graphical LCD Display? Answer No
P+ can and with the next release (Free) you can have font sizes up
to 24 Pixels high * 124 wide

Whats the largest Variable PbPro can handle Answer 16 bits
P+ its 32 bits

Code space is always an issue with Pics so effective data handling
is a must.

The internal code space of a pic's is a real boon you can use it to
store data. But can you retrive it?

Pbpro can just about if you know where it is but in real turms it's
impractical.

Ask a Pbpro writer to do this

Dim data_address as word
data_address = Label1
Label1: "My data"

Even the most basic action like loading the address of Label into
data_address is imposible in Pbpro.

There is only one thing that is good about Pbbro and that is the IDE
you can buy for the compiler (Pbpro does not supply one) and thats
Microcode Studio Plus. But as P+ comes with it's own free one........

Lastly ask a Pbro user when the last feature upgread was? 1 may be 2
years? Proton+ is constantly upgreaded. Les who writes the compiler
does every thing the code and the Parser so in a lot of cases a
request is made on the Friday and I have the Beta on Monday.
Unfortuatly with Pbpro it's not like that, which is why upgreads are
so few and far between.

Tim
--- In , "Cliff" <cliff@g...> wrote:
> I have PicBasic Pro, and have been using it off and on for a few
> years, and have recently downloaded the trial version of CH Flash.
> Here are my 2 bits, in a nutshell: the CH Flash compiler doesn't
> match the professional useability or maturaty of the PicBAsic Pro
> compiler. You get what you pay for. CHF is good if you want to
learn
> PIC assembly. PBP is good if you want to develop useable PIC code.
>
> More details: The CHF compiler is not too user friendly, and the
> online help manual is (even) much worse than the PBP manual. An
> online search for CHF sample programs results in VERY few
resources,
> with only 17 basic examples on their own web site. PBP help is
> abundant--including probably over 100 programs just on the MELabs
> site. (By the way, I bought mine from www.rentron.com ...bruce has
> ALWAYS been very helpful with excellent tech support, and you
might
> find a slightly cheaper site, but I doubt you'll find better
> support.) There is also a PBP email list that is far more active
than
> this group.
>
> CHF has crashed on me at least three times in the first half hour
I
> used it. It also hangs regularly with XP. CHF is designed more for
> learning assembler, and isn't user friendly when it comes to
actually
> entering in the program--you have to click buttons instead of
typing
> in the command, and often the dialog boxes that pop up aren't
> explained well in the help. Some have complained that PBP requires
a
> third party editer. To that, I say--SO WHAT!!! Using the free
> MicroCode Studio, you can't tell they aren't just one program. The
MC
> Studio Plus is even better, with great debugging capabilities. MCS
> and MCS+ both have context sensitive highlighting and coloring of
> text. They also allow you to quick jump to a variable declaration
or
> a label, which is handy in large programs.
>
> While it's true that CHF has procedures and allows you to pass
> values...if you look at the code produced, you can do it manually
> with PBP. (i.e. instead of CHF's "Call Procedure_1 (x, y)", you
use
> three lines that amount to "Proc_1_A = X : Proc_1_B = Y : Gosub
> Procedure_1") The compiled code is nearly identical. Also, CHF has
> float capability. PBP does, too...but you have to port in some
> assembly code to do so...and the samples are on their web site.
>
> The bottom line: If you need to save money, and want to learn
> assembly for PIC's, and don't mind spending extra time, go with
the
> CHF. If you want to get programming quickly with compact and
robust
> code, regular (and useful) upgrades at reasonable prices ($10), go
> with PicBasic Pro.
>
> Cliff > --- In , "clayforge" <festave@t...> wrote:
> > I am looking for input on which BASIC compiler to get to program
> > PICs. I have it narrowed down to PicBASIC Pro, and Celestial
> > Horizons CH Flash Basic. While I know that PicBasic Pro will
work
> > with more types of chips, I will really only be using the 16's,
so
> > that is not a real issue. Is there ANYTHING that would justify
the
> > purchase of PicBasic Pro over the CH Flash Basic, considering
that
> > Pro costs more than double the CH Flash? Thanks for all input,
> > advice, and suggestions!
> >
> > Scott






----- Original Message -----
From: Cliff <>
To: <>
Sent: Saturday, September 06, 2003 5:35 PM
Subject: [piclist] Re: BASIC advice... > I have PicBasic Pro, and have been using it off and on for a few
> years, and have recently downloaded the trial version of CH Flash.
> Here are my 2 bits, in a nutshell: the CH Flash compiler doesn't
> match the professional useability or maturaty of the PicBAsic Pro
> compiler. You get what you pay for. CHF is good if you want to learn
> PIC assembly. PBP is good if you want to develop useable PIC code.
>
> More details: The CHF compiler is not too user friendly, and the
> online help manual is (even) much worse than the PBP manual. An
> online search for CHF sample programs results in VERY few resources,
> with only 17 basic examples on their own web site. PBP help is
> abundant--including probably over 100 programs just on the MELabs
> site. (By the way, I bought mine from www.rentron.com ...bruce has
> ALWAYS been very helpful with excellent tech support, and you might
> find a slightly cheaper site, but I doubt you'll find better
> support.) There is also a PBP email list that is far more active than
> this group.
>
> CHF has crashed on me at least three times in the first half hour I
> used it. It also hangs regularly with XP. CHF is designed more for
> learning assembler, and isn't user friendly when it comes to actually
> entering in the program--you have to click buttons instead of typing
> in the command, and often the dialog boxes that pop up aren't
> explained well in the help. Some have complained that PBP requires a
> third party editer. To that, I say--SO WHAT!!! Using the free
> MicroCode Studio, you can't tell they aren't just one program. The MC
> Studio Plus is even better, with great debugging capabilities. MCS
> and MCS+ both have context sensitive highlighting and coloring of
> text. They also allow you to quick jump to a variable declaration or
> a label, which is handy in large programs.
>
> While it's true that CHF has procedures and allows you to pass
> values...if you look at the code produced, you can do it manually
> with PBP. (i.e. instead of CHF's "Call Procedure_1 (x, y)", you use
> three lines that amount to "Proc_1_A = X : Proc_1_B = Y : Gosub
> Procedure_1") The compiled code is nearly identical. Also, CHF has
> float capability. PBP does, too...but you have to port in some
> assembly code to do so...and the samples are on their web site.

The point is not weather you can get past the limitations of a language
using a different language, it is not even about how clever or lazy the
programmer is. The point is that humans doing a repetitive task are prone to
error. The computer does not get tired or distracted, it does not take short
cuts of feel down. It does what it is told from start to finish no mater how
stupid or menial the task. A good language and compiler will offload the
work from the programmer to the computer letting the programmer get on with
his/her main objective: to understand the problem and describe it as a
program.

By defining a function calling protocol within the language you are allowing
the compiler to take more of the burden from the programmer, you are
allowing the compiler to better understand the interaction between
statements within your program and ultimately to produce faster more compact
error free code.

Consider the situation where you run out of RAM during program development
and you decide to share a variable between different sections of your
program. Would it not be better to have the compiler check that this is safe
after every change you make to your program. Better still, how about
letting the compiler check your program and let it decide which variables
are safe to re-use and where.

consider the following section of code

proc output_high(int bit_number)
PORTB = PORTB | (1 << bit_number)
endproc

proc output_low(int bit_number)
PORTB = PORTB & ~(1 << bit_number)
endproc

proc main()
output_high(0)
output_low(0)
output_high(0)
output_low(0)
endproc

This compiles to just 4 (four) machine code instructions using the XCSB
compiler, and the programmer did not have to worry about fancy optimisations
or obscuring the meaning by writing extra code or pre-processing the program
in his head to embed strange constants into the code. And the greatest
benefit of all is that you can turn sections of code (like this) into
libraries which you can use over and over in different projects and the
compiler will do all the work of checking it and optimising it each and
every time you compile it.

Yes you get what you pay for, but sometimes the payment takes the form of
learning.

Regards
Sergio Masci

http://www.xcprod.com/titan/XCSB - optimising structured PIC BASIC compiler


In a message dated 9/7/2003 7:29:40 AM Eastern Daylight Time, t...@tjbsystems.com writes:
Lastly ask a Pbro user when the last feature upgread was? 1 may be 2
years? Proton+ is constantly upgreaded. Les who writes the compiler
does every thing the code and the Parser so in a lot of cases a
request is made on the Friday and I have the Beta on Monday.
Unfortuatly with Pbpro it's not like that, which is why upgreads are
so few and far between.

Tim
Tim,
I  am just starting in PICS as an extention to my hobby (Model Railroading). I have been toying with the idea of getting Pic Basic. However from your description above Proton seems to be the better deal! Where can it be purchased? Is there a trial version any where that I might take a test drive before buying it? How much does it cost?
Thanks in advance! 
 
Ray Russell
NMRA-40609
General Contractor
Norfolk & Western Railroad
Pocahontas Division
Circa 1958
Visit The "NEW" Pocahontas Website at:
Click here: N & W Pocahontas Division
http://members.aol.com/rruss45826/public_html/index.html

OR
Click here: Pocahontas Home
for the old website!
http://milliron.home.sprynet.com/Pocahontas/Pocahontas1.htm



Does Protom+ have Xin or Xout commands, to use PICs with X10
devices? A few of my ideas involve that. I know PBPro does...

Thanks,

Scott

--- In , "xob_jt" <tim@t...> wrote:
>
> Have you Looked at Proton+ it knocks all picbasic's into a cocked
> hat.
>
> http://www.crownhill.co.uk/proton_comparison.php
>
> No other basic comes near it for funtionality and device support.
> Its a good price too 125.
>



On 7 Sep 03, at 20:35, clayforge wrote:

> Does Protom+ have Xin or Xout commands, to use PICs with X10
> devices? A few of my ideas involve that. I know PBPro does...
>
While on this topic, I know PBPro is now available in a crippled
version for appraisal/ hobby use. How seriously is it crippled and in
what way?.
Mike W




Russel

I'm pleased you have decided to enter the wonderful world of
embedded controllers. You will have no end of fun with the PIC.

Proton+ is available from http://www.crownhill.co.uk/. They are have
been working with Pics and compilers for years and will happly ship
world wide.

You can down load a limited 35 line working demo at
http://www.picbasic.org/filedb/pafiledb.php?action=file&id=5

The purchase price is 125, which includes free upgrades for life.

Don't forget if you have any questions about the product or require
support go to http://www.picbasic.org/forum/ We are a friendly bunch
who like to help.

Tim

--- In , rruss45826@a... wrote:
> In a message dated 9/7/2003 7:29:40 AM Eastern Daylight Time,
> tim@t... writes:
> Lastly ask a Pbro user when the last feature upgread was? 1 may be
2
> years? Proton+ is constantly upgreaded. Les who writes the
compiler
> does every thing the code and the Parser so in a lot of cases a
> request is made on the Friday and I have the Beta on Monday.
> Unfortuatly with Pbpro it's not like that, which is why upgreads
are
> so few and far between.
>
> Tim
> Tim,
> I am just starting in PICS as an extention to my hobby (Model
Railroading).
> I have been toying with the idea of getting Pic Basic. However
from your
> description above Proton seems to be the better deal! Where can it
be purchased? Is
> there a trial version any where that I might take a test drive
before buying
> it? How much does it cost?
> Thanks in advance!
>
> Ray Russell
> NMRA-40609
> General Contractor
> Norfolk & Western Railroad
> Pocahontas Division
> Circa 1958
> Visit The "NEW" Pocahontas Website at:
> Click here: N & W Pocahontas Division
> http://members.aol.com/rruss45826/public_html/index.html
>
> OR
> Click here: Pocahontas Home
> for the old website!
> http://milliron.home.sprynet.com/Pocahontas/Pocahontas1.htm






Hello Scott

Yes XIN and XOUT is supported a v small snippet from the manual XIN

Syntax
XIN DataPin , ZeroPin , {Timeout , Timeout Label} , [Variable{,...}]

Overview
Receive X-10 data and store the House Code and Key Code in a
variable.

Tim
--- In , "clayforge" <festave@t...> wrote:
> Does Protom+ have Xin or Xout commands, to use PICs with X10
> devices? A few of my ideas involve that. I know PBPro does...
>
> Thanks,
>
> Scott
>
> --- In , "xob_jt" <tim@t...> wrote:
> >
> > Have you Looked at Proton+ it knocks all picbasic's into a
cocked
> > hat.
> >
> > http://www.crownhill.co.uk/proton_comparison.php
> >
> > No other basic comes near it for funtionality and device
support.
> > Its a good price too 125.
> >





Mike

Pbpro is available (only recently) with a 31 line limit

Proton+ is available with a 35 line limit

Hope that helps

Tim

--- In , "Mike W" <mike@c...> wrote:
> On 7 Sep 03, at 20:35, clayforge wrote:
>
> > Does Protom+ have Xin or Xout commands, to use PICs with X10
> > devices? A few of my ideas involve that. I know PBPro does...
> >
> While on this topic, I know PBPro is now available in a crippled
> version for appraisal/ hobby use. How seriously is it crippled and
in
> what way?.
> Mike W




I haven't used Proton yet, just installed it, so I can't really
compare them functionally. I do know, however, that Les wrote an
excellent book for PBP, so I'm sure his compiler is equally
excellent. I think it's a shame that he basically just copied so much
of PBP, right down to the pita method of dealing with interrupts.

Regarding separate IDE's, well, the Proton+ demo I just installed had
a separate one. Sure, it was included, but so is the free MCS and
another one with PBP. (Yes, I actually received TWO free IDE's with
PBP.) I opted to upgrade to MCS Pro, because I wanted the debugging
options, but that's totally optional. Just because they have separate
names is no reason to bash PBP.

Regarding updates, PBP was updated this summer, and I see from the
melabs web site that it was done again just recently. PBP is a more
mature product, so undoubtedly doesn't need as many updates (bug
fixes) and Proton needs. The other thing is support...here in the
States, I can call Bruce at www.rentron.com or melabs during business
hours and get excellent support. I doubt that Proton has a good phone
support system here...much less the extensive online resources that
PBP has. (yet.)

Having said all that, I'll probably buy Proton+, and see how it
really compares. It looks so darn close to PBP that I bet I can
recompile a program with very little modification.

Cliff --- In , "xob_jt" <tim@t...> wrote:
> I don't want this to become a mines better than yours argument but
I
> have to comment.
>
> As an Ex PBpro user I know the strenghts and weekness of the
> compiler. You will find a large number of ex PBpro users now using
> Proton+ I have never heard of it the other way around!
>
> Code space is always an issue with Pics so effective data handling
> is a must.
>
> The internal code space of a pic's is a real boon you can use it to
> store data. But can you retrive it?
>
> Pbpro can just about if you know where it is but in real turms it's
> impractical.
>
> Ask a Pbpro writer to do this
>
> Dim data_address as word
> data_address = Label1
> Label1: "My data"
>
> Even the most basic action like loading the address of Label into
> data_address is imposible in Pbpro.
>
> There is only one thing that is good about Pbbro and that is the
IDE
> you can buy for the compiler (Pbpro does not supply one) and thats
> Microcode Studio Plus. But as P+ comes with it's own free
one........
>
> Lastly ask a Pbro user when the last feature upgread was? 1 may be
2
> years? Proton+ is constantly upgreaded. Les who writes the compiler
> does every thing the code and the Parser so in a lot of cases a
> request is made on the Friday and I have the Beta on Monday.
> Unfortuatly with Pbpro it's not like that, which is why upgreads
are
> so few and far between.
>
> Tim
>







Les is indead a very competent programmer but to say he just copied
PBPro is unfair how can you say just copied it when to conform to a
standard you have to implement a set of standard commands.

On the upgread front this was Pbpros last upgade

Adds support for PIC16F54, 57, PIC18F2439, 2539, 4439, 4539, 6520,
6525, 6585, 6621, 6680, 8520, 8525, 8585, 8621 and 8680.
Adds REPEAT..UNTIL.
Adds 9 bit parity to HSERIN, HSERIN2, HSEROUT and HSEROUT2.
Changes PIC18Fxxxx DATA and EEPROM to allow odd locations.
Fixes constant folding for large numbers.
Fixes unable to load COD file for MPLALB 6.
Fixes parity with timeout in serial instructions.
Fixes PIC18Fxxxx DEBUGIN modifier timeout.
Fixes PIC18Fxxxx SERIN2 DEC modifier timeout.
Fixes PIC18F1220 and 1320 configuration error.
Fixes PIC18F6620, 6720, 8620 and 8720 BANK12 RAM setting.

Apart from Pic upgreads which is a basic requirment you have 9 bit
parity and Repeat - until.

The rest is Bug fixes. You cannot write a complex compiler with out
bugs getting in so I would never complain about bug fixes unless I
had to pay for the fix P+ upgrades are free.

Most of the time Pbpro upgreads are just additional Pic's being added

Where is the 32 bit var support, floating point, Glcd's that people
have been asking for for years?

I do though concide this is more than I remembered, to say there has
been no upgrades is technicaly wrong.

One thing that I cannot deny is the good support that Melabs gives.
If you envisage you will require phone help all the time then Pbpro
is for you. The Pbpro list is full of knowlageable people and if you
can stand the insults for asking stupid questions is worth a go.

The P+ forum is as you rightly acknowlage getting stronger and
stronger and I for one (time permitting) always try to help
especialy if it is Basic related.

P+ does have compatability with Pbpro built in and commands like
DEBUG with all its defines are accepted and converted internaly.

Interrupts are a mute point with users as to implement them the
Basic method is a cop out which is why P+ trys so hard to make it
easier to do it properly by giving the user commands like CONTEXT
RESTORE to save you the trouble doing it your self.

I think people will now be getting board of this thread but I leave
you with this example of the power of P+. I wrote it on the P+ forum

Follow the link

http://www.picbasic.org/forum/showthread.php?
s=&threadid98&highlight=lady --- In , "Cliff" <cliff@g...> wrote:
> I haven't used Proton yet, just installed it, so I can't really
> compare them functionally. I do know, however, that Les wrote an
> excellent book for PBP, so I'm sure his compiler is equally
> excellent. I think it's a shame that he basically just copied so
much
> of PBP, right down to the pita method of dealing with interrupts.
>
> Regarding separate IDE's, well, the Proton+ demo I just installed
had
> a separate one. Sure, it was included, but so is the free MCS and
> another one with PBP. (Yes, I actually received TWO free IDE's
with
> PBP.) I opted to upgrade to MCS Pro, because I wanted the
debugging
> options, but that's totally optional. Just because they have
separate
> names is no reason to bash PBP.
>
> Regarding updates, PBP was updated this summer, and I see from the
> melabs web site that it was done again just recently. PBP is a
more
> mature product, so undoubtedly doesn't need as many updates (bug
> fixes) and Proton needs. The other thing is support...here in the
> States, I can call Bruce at www.rentron.com or melabs during
business
> hours and get excellent support. I doubt that Proton has a good
phone
> support system here...much less the extensive online resources
that
> PBP has. (yet.)
>
> Having said all that, I'll probably buy Proton+, and see how it
> really compares. It looks so darn close to PBP that I bet I can
> recompile a program with very little modification.
>
> Cliff > --- In , "xob_jt" <tim@t...> wrote:
> > I don't want this to become a mines better than yours argument
but
> I
> > have to comment.
> >
> > As an Ex PBpro user I know the strenghts and weekness of the
> > compiler. You will find a large number of ex PBpro users now
using
> > Proton+ I have never heard of it the other way around!
> >
> > Code space is always an issue with Pics so effective data
handling
> > is a must.
> >
> > The internal code space of a pic's is a real boon you can use it
to
> > store data. But can you retrive it?
> >
> > Pbpro can just about if you know where it is but in real turms
it's
> > impractical.
> >
> > Ask a Pbpro writer to do this
> >
> > Dim data_address as word
> > data_address = Label1
> > Label1: "My data"
> >
> > Even the most basic action like loading the address of Label
into
> > data_address is imposible in Pbpro.
> >
> > There is only one thing that is good about Pbbro and that is the
> IDE
> > you can buy for the compiler (Pbpro does not supply one) and
thats
> > Microcode Studio Plus. But as P+ comes with it's own free
> one........
> >
> > Lastly ask a Pbro user when the last feature upgread was? 1 may
be
> 2
> > years? Proton+ is constantly upgreaded. Les who writes the
compiler
> > does every thing the code and the Parser so in a lot of cases a
> > request is made on the Friday and I have the Beta on Monday.
> > Unfortuatly with Pbpro it's not like that, which is why upgreads
> are
> > so few and far between.
> >
> > Tim
> >