Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Assembly / C?

Status
Not open for further replies.
PIC24 have their hardware divider built-in, so yeah it has to be really simple to use. I just never used any PIC24 yet. Not sure if C30 use the hardware divider...
 
speakerguy79 said:
A smart compiler might, in some instances, be better than someone coding assembly.

Let's say you wanted to divide a number by 4. Think of one way on a PIC18 device that a compiler might make this faster than someone coding in assembly.

Compilers also have the luxury of optimizing code without damaging the readability of the source.
 
ex-navy said:
I love sitting back and reading these opinions.

You have the ASM side

You have the C side.

You have the "sitting on the fence" guys.

All trying to convince the other side, of it's own merits.

Learn both, enrich yourself, try both, then, go with what's best for you after you walk in another mans shoes.

Psssshhhawww! Says the fence sitter. lol.

mister_e said:
PIC24 have their hardware divider built-in, so yeah it has to be really simple to use. I just never used any PIC24 yet. Not sure if C30 use the hardware divider...
Do they really? The dsPICs from which the PIC24s are based don't have a hardware divide. It takes 14-18 cycles (or something like that) to do the iterative divide they do support. They have some piece of hardware to help with division, but it's not a single cycle divide.
 
Last edited:
Well that's what their datasheet says... i wasn't aware of it 'till today... not sure the amount of cycles needed for the division... i just saw it was built-in :D
 
Last edited:
What flavor do you like

This forum has some of the best discussions!

What is so interesting is the amount of expertise from so many different "schools of thought" and how one can learn "so many ways to skin a cat, with so many tools"

I remember learning to program in machine language and how all of us techie's in the Navy balked at the first news of using a compiler.

So many advances in technology, so little time....
 
Last edited:
Regarding 24F DIV discussion - here is a paragraph from the Microchip document on migrating from the 18F to 24F series:

DIVIDER
PIC18F devices do not provide any hardware support
for division. Typical divide operations (signed 16/16 or
16/8) performed, using the standard PIC18F math
library, can take up to 38 instruction cycles to execute.
PIC24F devices do not have a hardware divider per se.
Instead, the PIC24F ALU is configured in hardware to
support a divide instruction, DIV. Together with the
REPEAT control instruction, DIV allows the ALU to
automatically execute the iterative division process as
a simple sequence instead of a long algorithm. DIV
supports several forms of 32/16 and 16/16 divides,
including fixed-point and fractional, and performs
executions in 19 instruction cycles.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top