go_away

Author Topic: PIC Compiler: Why Not Just Assembly?  (Read 3522 times)

0 Members and 1 Guest are viewing this topic.

Offline ParthTopic starter

  • Full Member
  • ***
  • Posts: 71
  • Helpful? 0
PIC Compiler: Why Not Just Assembly?
« on: June 09, 2008, 04:19:56 PM »
Hey everybody. If I get a PIC16F877 (as in the Cerebellum), I have a few choices for compilers. However, the only free one would be in Assembly language. After reading through the $50 robot tutorial, there is no writing done while compiling.

So, do I need to know Assembly language for this compiler? I thought I just click the build button and it compiles it into a .hex file for me. Any advice would be very much appreciated!  :)

EDIT: For the Assembly compiler, do you have to write the program in Assembly language? Or does it not matter what language you write the program in?
« Last Edit: June 09, 2008, 04:28:20 PM by Parth »

Offline paulstreats

  • Supreme Robot
  • *****
  • Posts: 1,381
  • Helpful? 21
Re: PIC Compiler: Why Not Just Assembly?
« Reply #1 on: June 09, 2008, 05:47:21 PM »
The assembly compiler needs you to write in assembly.

A language such as c is much easier and less complicated to understand. When you compile the c language, it creates an assembler file which then gets compiled into hex.

I know it sounds tempting if you got a good price on it but jumping straight into something that you have to use assembler for on your first time may be a bit too much for you.

If you do want to buy the cerebellum board, it maybe advantageous to get a PIC18F4550 / PIC18F4720 microcontroller aswell. These are pin to pin compatable that you can swap with the other microcontroller (PIC17F877/a), but microchip do a free student edition C compiler for the PIC18 range of devices. The only trouble is that it wont have a bootloader installed so you will have to build or buy your own programmer.

I strongly suggest for a first project not to attempt to use assembly (I think the amount of effort that goes into it would put you off)

Offline ParthTopic starter

  • Full Member
  • ***
  • Posts: 71
  • Helpful? 0
Re: PIC Compiler: Why Not Just Assembly?
« Reply #2 on: June 09, 2008, 06:25:48 PM »
Thanks so much! As tempting as the offer was, I had to let it down... Oh well, at least I won't get frustrated by trying to program in Assembly!  :P

-Parth

Offline ALZ

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 1
Re: PIC Compiler: Why Not Just Assembly?
« Reply #3 on: June 10, 2008, 12:00:49 AM »
If you are new to programming microcontroller don't look at assembly as something bad. It is thee BEST way to learn about the PIC and how to program it.  You will get a  sense about timing that you will never get if you just use "C" off the bat. Many people on this site over use "interrupts". They should only be used when you really have to. If you programmed in assembly you would know how much time they take. If you want to use "C" after that then you will have a good understanding what those statements are doing. 

Thanks so much! As tempting as the offer was, I had to let it down... Oh well, at least I won't get frustrated by trying to program in Assembly!  :P

-Parth

Offline SixRingz

  • Full Member
  • ***
  • Posts: 76
  • Helpful? 0
  • Bit's and pc's = Robot.
Re: PIC Compiler: Why Not Just Assembly?
« Reply #4 on: June 10, 2008, 04:07:42 AM »
Quote
Many people on this site over use "interrupts". They should only be used when you really have to. If you programmed in assembly you would know how much time they take.

When you say they take time, are you referring to the amount of clock cycles each call to an interrupt takes? (Finishing instruction, push, pop etc)
At my University I've been taught to try keep real-time programs event-driven, which is basically 100% interrupts. I'm not saying you are wrong, just want to learn more! This is off topic here though, will create a new thread. ALZ, if you have the time, please explain more there.  ;D
Grounding things properly means burying them in the backyard...

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,660
  • Helpful? 169
    • Society of Robots
Re: PIC Compiler: Why Not Just Assembly?
« Reply #5 on: June 19, 2008, 03:29:34 PM »
Just an FYI, you can use C to program the Cerebellum . . . as with all other PICs . . .

Offline benji

  • Supreme Robot
  • *****
  • Posts: 832
  • Helpful? 0
Re: PIC Compiler: Why Not Just Assembly?
« Reply #6 on: June 19, 2008, 04:35:46 PM »
assembly is the best when it comes to time sensitive coding
every operation u write you know how much time it takes to get done
good ol' BeNNy

 


Get Your Ad Here

data_list