answersLogoWhite

0

A macro is just short hand. A subrountine is "called."

Subroutines can save memory by reducing repeated code, but take more time because you have to push arguments and return addresses, and push the result and pop back.

A macro is the code literally inserted where you put it. It doesn't save any memory but is as fast as the bit of code you put there, saves typing, and is easier to read.

For example, if I define a macro

#define TOGGLE_PIN1 PORTD.1=0;PORTD.1=1;PORTD.1=0

and put it in my code like so

putsf("I'm going to toggle PIN1 now");
TOGGLE_PIN1;
putsf("PIN1 was toggled");

it would be exactly the same, to the processor, as

putsf("I'm going to toggle PIN1 now");
PORTD.1=0;PORTD.1=1;PORTD.1=0;
putsf("PIN1 was toggled");

j.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

How macro calls within macros are handled?

'=============>> Public Sub Main() 'Your code Call One 'your code End Sub '<<============= '=============>> Public Sub One() MsgBox "Hi from One" End Sub '<<============= > Does it matter where the other macros are stored or is it > better to have them all in one module? Unless there are a larger number of macros, they can be stored in a single module. However, for organisational reasons, it is usually better to store macros by type in different modules. Regards Rollick


What is the difference between a system and a subsystem?

explain the difference between systems and sub systems


What is the difference between assembly and sub-assembly?

== ==


What is the difference between a speaker and a subwoofer?

A Sub Woofer is a type of speaker, but the main difference between normal speakers and a sub woofer is in the range of sound it produces. A sub woofer produces the lower pitches that other speakers can't clearly put out.


Difference between directory and sub directory in dos?

A directory within an existing directory is called a sub directory.


What is the difference between the base words super and sub?

Think of 'super' as over or above and 'sub' as under or below.


Difference between core culture and sub culture?

core culture


What is the difference between meat and food?

Meat is a sub category of food.


What is the difference between sub net masking and default masking?

It is Almost same


What is the difference between the sub machine and a machine?

Size of the weapon and size of ammuntion it fires.


How can you tell the doffermce between 2s subshell and 2p subshell?

You can tell the difference between a 2s sub-shell and 2p sub-shell from their energy levels, because a 2p sub-shell is a higher energy level than a 2s sub-shell.


Difference between subroutine and function?

Both A function and a Sub carry out a procedure, but only A function returns a result while a Sub does not return a result.