Jump to content
Sign in to follow this  
Paresh

Multiplication Problem

Recommended Posts

Hi friend

I am using Boostc complier with MPLAB IDE.

In programming during interrupt i can multiply two 8 bit register simple multiplication instrucation.

Then after during running programe once agine i want ot multiply two number.

But At time i could not use this Multiplication.

Reply me what can i do?

Thanking u

Paresh

Share this post


Link to post
Share on other sites

Paresh,

In programming during interrupt i can multiply two 8 bit register simple multiplication instrucation.

Then after during running programe once agine i want ot multiply two number.

But At time i could not use this Multiplication.

Its not very clear what you have a problem with. Can you provide a short but complete program that demonstrates the issue.

 

Regards

Dave

Share this post


Link to post
Share on other sites
Paresh,
In programming during interrupt i can multiply two 8 bit register simple multiplication instrucation.

Then after during running programe once agine i want ot multiply two number.

But At time i could not use this Multiplication.

Its not very clear what you have a problem with. Can you provide a short but complete program that demonstrates the issue.

 

Regards

Dave

 

 

unsigned char No = 10;

unsigned char Number = 15;

unsigned int result;

unsigned int result1;

 

 

void interrupt(void)

{

 

Result = No * No;

 

}

 

 

void main(void)

{

 

result1 = Number * Number;

 

}

 

 

so i got resulting error like this.

 

Error: Function called in more than one execution thread: __mul_8u_8u

 

what can i do?

Share this post


Link to post
Share on other sites

hi here i send you onesmall programme

 

unsigned char No = 10;

unsigned char Number = 15;

unsigned int result;

unsigned int result1;

 

 

void interrupt(void)

{

result = No * No;

 

}

 

void mian(void)

{

 

result1 = Number * Number;

}

 

 

i got Error like this

Error: Function called in more than one execution thread: __mul_8u_8u

 

Reply me

What can i do?

Parehs

Share this post


Link to post
Share on other sites

This is just because you are calling the same multiply function in two different threads. Firstly in interrupt thread and secondly in the main() thread.

Share this post


Link to post
Share on other sites

Hi friends

I know what is problem But How can i solve this problem?

is there other altrnet remain so i can do my job sucessesfully?

give me reply

PArehs

Share this post


Link to post
Share on other sites
Hi friends

I know what is problem But How can i solve this problem?

is there other altrnet remain so i can do my job sucessesfully?

give me reply

PArehs

 

I assume you are using a PIC16 device.

 

The best solution is to get rid of the multiply from the interrupt. IE set a flag in the interrupt to indicate that the data requires multiplying.

 

The reason for this is that the multiply routine calls a hidden subroutine. The PIC16 devices have a limited call stack depth. By using a call in an interrupt you are reducing the call depth allowable in the main thread.

 

If you absolutely must have a multiply in the interrupt then may I suggest that in the interrupt you use chars and in the main thread you use ints. That way the interrupt will call a separate hidden function (mul_8u_8u) to the main thread. This of course will greatly expand the program memory requirements.

 

You may get away with using signed chars in the main thread, the trick is to use different data types.

 

Perhaps Dave or Pavel may be able to confirm/ clarify this suggestion.

Share this post


Link to post
Share on other sites

Hello friend

here same error problem now face another way also.

in my programme i can call one funcation routine number of time some at one place i can call this routine then i got same error like provious i got.

 

i find conclution that in PIC16F914 there are two pages avilable.

if funcaton defination and funcation call should be in different place then it give this type erro.

 

are you agree with me? if yes then i want solution for that.

 

reply me

thank you

 

Paresh

Share this post


Link to post
Share on other sites
Hello  friend

here same error problem now face another way also.

in my programme i can call one funcation routine number of time some at one place i can call this routine then i got same error like provious i got.

 

i find conclution that in PIC16F914 there are two pages avilable.

if funcaton defination and funcation call should be in different place then it give this type erro.

 

are you agree with me? if yes then i want solution for that.

 

reply me

thank you

 

Paresh

 

Please see various previous comments about calling functions from seperate threads of execution.

 

Please feel free to apply the same solution each time you come across this problem.

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...