Bascom Basic Vs C?

Go To Last Post
32 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, as the subject tells, which one is better? I'm a newbie and will be doing a project using Atmel AVRs and i'm kinda divided on this issue. :)

While AVR Vs PIC has always been a major discussion among micro-freaks, what about the programming language?? Is it easier/convenient to use Bascom Basic or just the more conventional C?? :?

Develop the mind of equilibrium.
You will always be getting praise and blame,
but do not let either affect the poise of the mind:
follow the calmness, the absence of pride.
--Sutta Nipata--

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

kay_z83 wrote:
Well, as the subject tells, which one is better? I'm a newbie and will be doing a project using Atmel AVRs and i'm kinda divided on this issue. :)

While AVR Vs PIC has always been a major discussion among micro-freaks, what about the programming language?? Is it easier/convenient to use Bascom Basic or just the more conventional C?? :?

Sheesh! why not just ask us to divide on religious lines? (lots of laughing!)

This debate has been raging for how long? Twenty or more years? The simple reality is that no one thing is any better than any other. BASIC is a simpler environment, generally easier to learn, but resulting in larger object code and slower operation. Development of custom libraries is not so easy.

'C' on the other hand allows you to do anythign BASIC will do. You have more choices of compiler, including totally free ones like GCC-AVR found in the WinAVR suite. A wide range of libnraries is avialble and it is vastly easier to write support for specialised interfaces and hardware.

You want advice? Okay! Learn assembler!!

No really, add it to your arsenal. If you want to do 'quiickie' jobs in a way that gets things running quickly, use BASIC, 'C' gives you the whole thing with a steeper learning curve and the ability to blend in assembler for when even 'C' can't deliver the power. I run a company that does embedded development, I personally am a hardware designer with far too much software experience. I write in C because I can prove a concept and validate hardware designs without having to call on the serious talent. Then I hand it over, and it is amazing how often we get a blended C and assembler realisation that allows us to use a smaller part, or to reduce clock speeds to save power.

My real advice? Don't join the religious wars, just start coding. Try them all! One day you will find something you cant do with one environment that you can with another.

John

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dont forget fastavr.. ..

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sheesh! why not just ask us to divide on religious lines? (lots of laughing!)

This debate has been raging for how long? Twenty or more years? The simple reality is that no one thing is any better than any other. BASIC is a simpler environment, generally easier to learn, but resulting in larger object code and slower operation. Development of custom libraries is not so easy.

'C' on the other hand allows you to do anythign BASIC will do. You have more choices of compiler, including totally free ones like GCC-AVR found in the WinAVR suite. A wide range of libnraries is avialble and it is vastly easier to write support for specialised interfaces and hardware.

You want advice? Okay! Learn assembler!!

No really, add it to your arsenal. If you want to do 'quiickie' jobs in a way that gets things running quickly, use BASIC, 'C' gives you the whole thing with a steeper learning curve and the ability to blend in assembler for when even 'C' can't deliver the power. I run a company that does embedded development, I personally am a hardware designer with far too much software experience. I write in C because I can prove a concept and validate hardware designs without having to call on the serious talent. Then I hand it over, and it is amazing how often we get a blended C and assembler realisation that allows us to use a smaller part, or to reduce clock speeds to save power.

My real advice? Don't join the religious wars, just start coding. Try them all! One day you will find something you cant do with one environment that you can with another.

John

Thanks for your advice John!

Develop the mind of equilibrium.
You will always be getting praise and blame,
but do not let either affect the poise of the mind:
follow the calmness, the absence of pride.
--Sutta Nipata--

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for your advice John! :D

To be frank, i've learnt C before and i just wondering if it's worthwhile to learn Basic, which is rather 'new' to me. Anyway, cheers!

Develop the mind of equilibrium.
You will always be getting praise and blame,
but do not let either affect the poise of the mind:
follow the calmness, the absence of pride.
--Sutta Nipata--

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

8 bit AVRs are optimized for C.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

kay_z83 wrote:
Thanks for your advice John! :D

To be frank, i've learnt C before and i just wondering if it's worthwhile to learn Basic, which is rather 'new' to me. Anyway, cheers!

Then, to be honest, stick with 'C' and learn some assembler to go with it. The assembler will also help you finding optimisations that you DONT want the compiler to make. BASIC would be a step backwards

For clients I believe we have CodeVision, Keil and ImageCraft compilers as well as our favourite - GCC. I only use GCC in the WinAVR package. The support from folk in the GCC forum here is wonderful and there is some really good library code out there ( check out Procyon avr-lib ).

John

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
BASIC is a simpler environment, generally easier to learn, but resulting in larger object code and slower operation. Development of custom libraries is not so easy.

Quick note - compiled BASIC like BASCOM-AVR can actually compete with C in terms of size and speed. As well it has a MUCH wider array of built-in librarys (graphical LCDs, CRCs, TCP/IP, etc) to make life easier.

However - in the long run C will be the better choice. It is much more modular and lends itself to bigger projects a lot better. If you start with BASCOM-AVR you will probably end up learning C eventually since you'll need it (thats what I did).

Regards,

-Colin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks to everyone who has helped. I'm now all commited in learning Bascom Basic.. 8)

Before i venture further, i need a good start! :D I've searched around the 'Academy' and is not able to find much info on the Bascom Basic. Most, if not all, are concentrated on the C language thingie.

Can anyone kind enough to provide me some links/websites/info on Bascom Basic?

Thanks heaps!

Develop the mind of equilibrium.
You will always be getting praise and blame,
but do not let either affect the poise of the mind:
follow the calmness, the absence of pride.
--Sutta Nipata--

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

BASCOM is fine for hobby use.
It's a one of a kind language - a large percentage of it was defined on the fly by the author.

So it's not a viable choice for a money-at-stake professional application. And believe, me, no employer is going to care about BASCOM or any other one-of BASIC compilers on your resume.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

'Bascom AVR  2.0.7.3

$regfile = "m32def.dat"
$crystal = 16000000
$hwstack = 32       ' default use 32 for the hardware stack
$swstack = 10       ' default use 10 for the SW stack
$framesize = 40       ' default use 40 for the frame space
Dim A As Word , B As Word , C As Word
Dim E As Byte, F As Byte, G As Byte
Do
A = B / 100       '255 Cycles !
A = B / 1000       '255 Cycles!
A = B / C       '31 Cycles
A = A / C       '31 Cycles
A = A / A       '31 Cycles

E = E / 100       '112 Cycles!!!!!!
E = F / G       '111 Cycles !!!!!
E = E / F       '111 Cycles !!!!1
E = E / E       '111 Cycles !!!!1
Loop

End

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Goorman is there a point to your 2 posts? I have deleted your other identical post in the other OLD thread.

 

Notice that this thread is 13 years old.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@Goorman.

 

Have you considered posting in the Bascom forum?

 

https://www.mcselec.com/index2.p...

 

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi
It was a good offer  And I asked them.
This is related to the AVR structure.
http://www.atmel.com/Images/doc0936.pdf
Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So what is the point you are trying to make? Too slow, too fast, too bloated, not bloated enough? Maybe you prefer ASM or C?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Remember that a compiler optimize , and do thing better than you write them.

If this is all the code in the program a C compiler would not make any code! because the results are not used for anything!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello js
I think it is better to mix high level and ASM  when we  don’t want to wait for polling commands.

 

Hello ُsparrow

I must emigrate to the land of C, at least.

Last Edited: Tue. Jul 18, 2017 - 12:29 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Goorman wrote:

I think it is better to mix high level and ASM  when we  don’t want to wait for polling commands.

 

What difference does the choice of language make when polling? You can just as easily write a program in ASM which polls as you can in C. There is nothing in C which mandates polling.

 

 

Goorman wrote:

I must emigrate to the land of C, at least.

 

What makes you think that C will make you code run faster?

pragmatic - dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What makes you think that C will make you code run faster?

It makes ME run faster....to the loo...

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

LoL

I’m not looking for speed  to using C, but  a lot of samples codes  on internet are deceiving me to press shift_key  and write { } ++ @ & || % 0x & $ ()…….

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, sometimes , on the lazy web, one can just cut and paste or -incl- download -the latter is safer- ...

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Goorman wrote:

I’m not looking for speed  to using C,...

 

But in your first post you specifically quoted the number of cycles for various maths operations!?

pragmatic - dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Brian

My first post was lack of my knowledge about the AVR's structure.
As you know, no language is faster than assembly. Please refer to below link and compare the Cycles. It's not very critical.

http://www.atmel.com/Images/doc0...

 

Hi dbrion0606

I accept, but, if a company offers code for their product, it's better to copy it. And many of those are in  { } ++ @ & || % 0x & $ ()  language.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As you know, no language is faster than assembly.

Well, if it were true, once translated intio assembly, language becomes faster.... (IMO this kind of senetnce is as absurd as saying "no tree is smarter than a coconut-tree ", perhaps even more absurd).

 

It is not better to copy (manually? software; better thing is to download it (via git clone or wget, among many other safe ways),

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@dbrion

When we write Basic or C command, we actually have copied the ASM code that someone else wrote it. So everything depends on the skills and limitations of the other person.

 If you write your own ASM code, everything is under your control and you can choose the most optimal method.

Sorry, I forgot to say I like coconut too.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

everything is under your control and you can choose the most optimal method.

Its been quite a while since there was a good language war...

 

I use Bascom, ZBasic, and a touch of Asm now and then.

 

I can easily intermix Asm with Basic, and if I'm not sure exactly how the high level language is setting up a module, and I want it done a specific way, I just insert a few Asm commands or Register  R/W commands and set it up the way I wish it to be.  Easy.

 

Which language is "best" always seems like a silly battle, as Best can mean so many different things to different people, and different projects.

Best can refer to execution speed, program length, usage of pre-fab'd libraries, limitations based upon licenses attached to libraries, etc.

 

For 99% of my work I'm fine using Basic, I'd rather write one or two lines of code for a ring buffered, interrupt driven, USART receive routine, and know that its been debugged and will just plain work, and move on with the project, rather than spend time debugging the details of ring buffer pointers.  Easier for me to focus on the high level concepts, and let the language handle the nitty gritty details.

The nice thing, however, is that if a high level interface command doesn't' exist for some sensor, one can manipulate the hardware any way one pleases, and write their own driver.  Easy.

 

To each their own.

 

JC   

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Often a good structure of the program is more important,  than the language. (as said before know your math, algebra and logic is far more important than the language).   

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello DocJc

Hello Sparrow

I totally agree with you. Your strategy is great.

 Thanks

Last Edited: Fri. Jul 21, 2017 - 02:24 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi jc
Would it be possible give me some information about push pop when I use “nosave “.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Perhaps we all should take an icecream to cool down. So much trouble in the world....

https://www.mcselec.com/index2.p...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Would it be possible give me some information about push pop when I use “nosave “.

In Bascom, under the Help Tab along the top, then Bascom Language Reference, scroll down for "On Interrupt".

 

This discusses Nosave, Save, Saveall, etc.

 

It describes it far better than I could.

 

JC   

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Goorman wrote:
no language is faster than assembly

Well, the language itself imposes no overheads.

 

Whether an individual programmer is sufficiently skilled to be able to outperform a compiler - especially a modern, optimising compiler - is an entirely different matter!!

 

But far more to the point is the speed at which you can write that code!