Author Topic: software  (Read 2259 times)

0 Members and 1 Guest are viewing this topic.

Offline RoboMoonTopic starter

  • Jr. Member
  • **
  • Posts: 19
  • Helpful? 0
software
« on: July 19, 2010, 05:28:35 AM »
I learn c#
My question is if I can used this language to program robots
What I can do with c#

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,944
  • Helpful? 99
Re: software
« Reply #1 on: July 19, 2010, 07:37:17 AM »
C# is a Microsoft invention although it is based on C. This could be used if the processor board in the Bot is running a Microsoft operating system (horrors).

Since most Bots use micro-controller chips plain old C is widely supported by the programming tools for the various u-controllers like PICs, AVRs, etc.

Offline chelmi

  • Supreme Robot
  • *****
  • Posts: 496
  • Helpful? 15
    • Current projects
Re: software
« Reply #2 on: July 19, 2010, 10:05:48 AM »
C# is a Microsoft invention although it is based on C. This could be used if the processor board in the Bot is running a Microsoft operating system (horrors).

Nope. There is an open source environment to compile and execute C# on a variety of OS, it's called Mono.

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,944
  • Helpful? 99
Re: software
« Reply #3 on: July 19, 2010, 12:48:18 PM »
Really, wow learned something new again.
thanks.

But is it still geared toward an OS such as Linux from what I just read and not ucontrollers?

Offline chelmi

  • Supreme Robot
  • *****
  • Posts: 496
  • Helpful? 15
    • Current projects
Re: software
« Reply #4 on: July 19, 2010, 02:37:36 PM »
But is it still geared toward an OS such as Linux from what I just read and not ucontrollers?

Definitely not for ucontrollers. It still requires a virtual machine to run, and this is far too heavy for a MCU.

Offline RoboMoonTopic starter

  • Jr. Member
  • **
  • Posts: 19
  • Helpful? 0
Re: software
« Reply #5 on: July 20, 2010, 02:33:52 AM »
When is prefer to program the MCU in C and when is prefer in assembler ?

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,944
  • Helpful? 99
Re: software
« Reply #6 on: July 20, 2010, 08:05:41 AM »
Assembler is preferred when code size and execution speed is important.
C is preferred when the code algorithms are complex or if the code needs to be portable to other processors.

Offline Loligo

  • Jr. Member
  • **
  • Posts: 10
  • Helpful? 1
Re: software
« Reply #7 on: July 24, 2010, 01:44:12 PM »
RoboMoon,

I'm not at all a roboticist, but I can tell you what I know about the advantages of C, and the advantages of learning it.

For the situation discussed above, where asm routines may be needed for performance; many C compilers will also let you wrap hand-optimized ASM routines in standard C function-calls. These functions will look, and be called in your code, just like any other function written in C.

This also allows you to have a separate function of the same name that contains only C, and automatically choose which to compile into the rest of your code (using the C pre-processor). One reason it is good to have your asm-optimized C functions written in plain C as well, is that the asm will be specific to the processor, while the functions written in plain C code will be portable. It is also nice to have an easy-to-follow plain-C routine to act as the standard for the asm code.

Though many of the more modern languages (including C#) are based on C (C is sort-of the "Latin" of many modern languages) knowing C# may not help you much in learning C. The most powerful things in C, such as pointers, are also the most difficult to fully master, and the modern languages often seem to include, as one of their primary aims, completely shielding coders from these more difficult constructs.

This shielding, however, also tends to put a very high barrier between the coder and the hardware. No problem if you are coding database applications on a server with browser-based user interfaces. In fact, in that situation it is a net advantage, since you can't hang yourself with rope you don't have...  On the other hand, this inability to get right to the hardware --while an advantage for high-level coding-- is likely to be a huge disadvantage for robotics. This is primarily just a gut guess though, since, as I've said, I'm not (yet) very knowledgeable about robotics design.

Finally (and I can vouch for this one), when you learn C, you will have a huge advantage in learning the higher-level (more modern) languages. This is because, C is the original syntax that most of those modern languages are modeled on. Many of the constructs, which C does at the hardware level have merely been abstracted in the more modern languages. In this case, when learning the modern language you will recognize in the higher-level-construct, the set of low-level operations that went into providing it.

In short, the time you spend learning C is a win-win. You will be able to design without restrictions at the low level required (i think) by robots, and you will have a basis-understanding that gives you insight, which will make learning the newer higher-level languages easier.

 -John
« Last Edit: July 24, 2010, 01:57:12 PM by Loligo »

 


data_list