View previous topic :: View next topic |
Author |
Message |
Kilrah Guest
|
Calling a C function in the assembly? |
Posted: Sat Feb 25, 2006 4:04 pm |
|
|
Hello,
I have a little question... I'm currently writing a program on a PIC12F675. The program core is now working... but with 98% of used ROM, and some features are still missing.
I've seen I could save a lot of space on some comparisons if I wrote them in ASM, but there are function calls in there. Is it possible to call a C function from the ASM, give it its parameter and get the return value back?
That is provided I'm very short on RAM space as well, so would like to avoid extra vars.
Thanks,
Kilrah |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Feb 25, 2006 11:48 pm |
|
|
Before you do that, it's advisable to go through your code and
try to reduce ROM usage by re-writing portions of it.
This thread from the old board explains how to do this:
http://www.pic-c.com/forum/old/messages/1777.html |
|
|
Storic
Joined: 03 Dec 2005 Posts: 182 Location: Australia SA
|
|
Posted: Sun Feb 26, 2006 3:35 am |
|
|
Another way the increase your ROM is to use the 12F683, It is pined the same as the 12F675 with double the ROM, RAM etc. otherwise, try rewirting your code in a different way to make it smaller.
Andrew _________________ What has been learnt if you make the same mistake? |
|
|
sonicdeejay
Joined: 20 Dec 2005 Posts: 112
|
|
|
Guest
|
|
Posted: Mon Mar 06, 2006 1:47 pm |
|
|
Hmm, replying a bit late, I've been busy lately.
Thanks for the answers. The 12F683 seems a very nice alternative. Unfortunately I already bought a stock of 12F675s a while ago, before it existed, so I'll have to use these... :(
But I'll sure to order them next time, the 8MHz internal RC sounds good too ;)
I had already done the LST file check. Unfortunately a lot of the space is used by the software i2c routines that are the base of the application. But the compiler routines are way too complete for my use.
Anyway, I've nearly finished rewriting the software in assembly. I'm using around 43% of code space for the same functionality. That will leave me with enough space for everything for sure. |
|
|
|