•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Assembly section within the Software Development category of DaniWeb, a massive community of 456,470 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,806 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Assembly advertiser: Programming Forums
Views: 365 | Replies: 0
![]() |
Hi
I need to do a correlation of 40 samples using a dsPIC30F6014A (@80Mhz) in less than 15us, but found that when I write the correlation in C, it takes way too long (about 40us). I came accross the MAC function in assembly, which (if I can get it going) would be perfect. I am writing the assembly code inline in MikroC.
Unfortunatley I just can't get it to work. I have two main problems:
1) Using the following code, the ACCAL register only becomes 0000 0100, instead of 0001 0100. What's wrong?
2) The previous code was used mainly because I can't get the following code to work
The problem seems to be with the MAC insctruction, because the program runs to the end if I comment it out.
Where can I find working examples of prefetch and the MAC instructions. I have looked at everything I can find, but not a single website has a complete example that I can learn from. It is seriously frustrating spending hours on end on what should only be 5 lines of code. Any help will be appreciated!
Oh, and beware of googling MAC...
I need to do a correlation of 40 samples using a dsPIC30F6014A (@80Mhz) in less than 15us, but found that when I write the correlation in C, it takes way too long (about 40us). I came accross the MAC function in assembly, which (if I can get it going) would be perfect. I am writing the assembly code inline in MikroC.
Unfortunatley I just can't get it to work. I have two main problems:
1) Using the following code, the ACCAL register only becomes 0000 0100, instead of 0001 0100. What's wrong?
asm {
CLR ACCA
MOV #0x0004, W4;
MOV #0x0005, W5;
MAC W4*W5, A
MOV W4,PORTD
MOV W5,PORTF
MOV ACCA, W0
MOV W0, PORTG
}int Temp1 = 4 absolute 0x0802; //Declare variable and assign specific location
int Temp2 = 5 absolute 0x0804;
asm {
CLR ACCA; //Clears Accumulator A - not sure if this is necessary ?
MOV #0x0802,W8; //Move the variable address values into W8 and W10
MOV #0x0804,W10;
MAC W4*W5, A, [W8], W4, [W10], W5;
MOV W4,PORTD;
MOV W5,PORTF;
MOV ACCA, W0; //I can't move ACCA directly to PORTG - don't know why ?
MOV W0, PORTG;
}Where can I find working examples of prefetch and the MAC instructions. I have looked at everything I can find, but not a single website has a complete example that I can learn from. It is seriously frustrating spending hours on end on what should only be 5 lines of code. Any help will be appreciated!
Oh, and beware of googling MAC...
![]() |
•
•
•
•
•
•
•
•
DaniWeb Assembly Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
apple blog bugs clone companies computing core crossover daniweb defcon emulation hackers hacks hardware hate hoax iphone jbennet kevin rose leopard linux mac mac osx macbook macbook pro macs microsoft news office os os x osx parallels pc penryn pro processor secret security serunson tiger trojan unix virtualization vista vmware vulnerabilities wifi windows wine
- Previous Thread: 7 segment countdown from 99 with atmel 89s51??
- Next Thread: Frequency Counter


Linear Mode