Electronics Beef free

Discussion in 'Modding' started by cpemma, 23 Dec 2006.

  1. cpemma

    cpemma Ecky thump

    Joined:
    27 Nov 2001
    Posts:
    12,328
    Likes Received:
    55
    http://gcbasic.sourceforge.net/

    Might interest us simpler souls. ;)
     
  2. SteveyG

    SteveyG Electromodder

    Joined:
    23 Nov 2002
    Posts:
    3,049
    Likes Received:
    8
    bah! n00bs!! :lol:
     
  3. Hazer

    Hazer In time,you too will be relixalated

    Joined:
    14 Apr 2003
    Posts:
    957
    Likes Received:
    2
    Its funny. I have a harder time dealing with BASIC/C++ than I do with assembly. With assembly, I understand what the hardware is doing.

    Prefference I guess.
     
  4. Moriquendi

    Moriquendi Bit Tech Biker

    Joined:
    3 Nov 2005
    Posts:
    1,691
    Likes Received:
    58
    Im much happier with assembler than any higher language for exactly that reason, and i leaned basic as a kid.

    Moriquendi
     
  5. SteveyG

    SteveyG Electromodder

    Joined:
    23 Nov 2002
    Posts:
    3,049
    Likes Received:
    8
    BASIC a fairly restrictive language for the kind of things you want to do on a microcontroller. Assembler makes so much more sense to me, but for some reason people still use those god awful Picaxes and BASICStamps.

    I guess it's useful for those who wish do only do simple stuff with their devices, or those who are a bit daunted by learning a new language.
     
  6. Macaba

    Macaba What's a Dremel?

    Joined:
    4 Mar 2006
    Posts:
    107
    Likes Received:
    1
    I program in Assembly.

    However, there was a time when I wanted a PIC to do an ADC reading and send it via a SOFTWARE UART. I thought... 'Assembly... nahh' and loaded mikrobasic, and had the pic programmed within 3 minutes and working perfectly.
     
  7. Hazer

    Hazer In time,you too will be relixalated

    Joined:
    14 Apr 2003
    Posts:
    957
    Likes Received:
    2
    I agree that using higher languages to get a PIC to read the ADC and send it on the USART is a little easier.

    It takes about 10 minutes to do it in assembly. 15 minutes if your thorough enough to simulate the code before burning.

    Now take that mikrobasic and get a 16F to do this:

    Load a graphic page from I2C memory. Run 320x240 LCD with touchscreen input. Switch between 8 analog inputs, 8 high-speed counter inputs, and 8 parallel data outputs corresponding to a dynamic feedback system. Have the ability to run manually or do dynamic automatic control on 8 channels. Keep all custom settings and current output levels in non-volatile memory. RS-232 interface to log all data real-time. Implement all of this using hardware peripherals and interupts, thus having no main program loops that cause lock-up. And finally implement the watchdog.

    If you plan to do that kind of a project, you WILL have to go back to assembly just to figure out how the high-level screwed it up.
     
  8. FuzzyOne

    FuzzyOne

    Joined:
    19 Sep 2002
    Posts:
    1,823
    Likes Received:
    32
    How strange, today I went out and bought two pics (18F4550 & 16LF84A), and I am just about to build a programmer, this looks like a pretty good way of doing "stuff"
     
  9. agent420

    agent420 What's a Dremel?

    Joined:
    18 Apr 2006
    Posts:
    227
    Likes Received:
    0
    I use a quality Basic compiler for my AVR projects. One observation I would make is that it seems many microcontroller versions of the Basic language could really be viewed as a library of macros... I have functions for I2C, SPI, LCD, PWM, interrupts and even X10 periphials.. There are also asm like commands for bit logic rotate and shift, and functions similar to pointers in C for locating or specifying the address of variables. Topping it off are compiler directives similar to what most asm compilers would offer.

    Given that level of hardware interaction, it is very seldom I have to go the the asm level for anything. I will conceed that well written asm is still produces the fastest code, but with the power of today's chips I would guess that most people do not need (or would use) the full power available. Even then, you could always use inline asm.

    When I can produce code with a lot of trig functions in just a few minutes that still runs plenty fast enough to draw vector graphics on an oscope, or bit bang various hardware, I see no need to struggle with struggle with asm. Actually, I think C is the language to learn because as a 'mid level' language it is very close to asm, but is easier to read, has lots of functions (math, io, etc) and is much more cross compatible over different chipsets. With asm, you would need to re-learn all the instructions if you wanted to move to a different chip.

    All that said, people should use whatever makes them happy.
     
    Last edited: 26 Dec 2006
  10. agent420

    agent420 What's a Dremel?

    Joined:
    18 Apr 2006
    Posts:
    227
    Likes Received:
    0
    I still think it depends. I've done some very complex projects with Bascom AVR Basic. But I think a lot of what you suggest also is determined by how much power you have available. If you are doing volume production and need to keep price to a miniumum, you need the cheapest chips and asm to squeeze what you can. If you are a hobbiest building a one-off or small run, you can afford the extra $5 for a more powerful chip that allows some slop in programming; you'll probably still make out $wise given the savings in programming time.

    And unless you spend the extra time to comment the heck out of your asm source, it's much more difficult to debug in my opinion, especially 6 months down the road when the project's no longer fresh in your mind any more.

    btw, I'd like to see a 16F do all that :) No need for a main loop when it's all one big interrupt anyway :hehe: That's almost a Palm-like app, and all those systems are written in C.

    And in a sense, the use of a PIC is itself a type of 'high level' language. You could instead use discrete logic gates and uart chips to operate the above example with even greater efficiency, and really know what a square foot of 74xx ic's is doing at the hardware level :eeek:
     
    Last edited: 26 Dec 2006

Share This Page