Searching \ for '[PIC] MAPM Compiles!!!' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page:
Search entire site for: 'MAPM Compiles!!!'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] MAPM Compiles!!!'
2009\01\24@153652 by solarwind

picon face
I just got MAPM to compile successfully with my project on C30! When I
run it though, it says it's out of memory.


2009\01\24@153737 by solarwind

picon face
#include <p24hj128gp202.h>
#include <stdio.h>
#include "mapm/m_apm.h"

int main() {
       printf("Hello, world!\n");

       void *buffer = malloc(128);

       M_APM a, b, r;

   a = m_apm_init();
   b = m_apm_init();
   r = m_apm_init();

   //57 + 3 = 60 and print result
   m_apm_set_string(a, "57");
   m_apm_set_string(b, "3");
   m_apm_add(r, a, b);
   m_apm_to_string((char *)buffer, 4, r); //Buffer 4 decimal places
   printf("%s\n", (char *)buffer);

   //Sin(62 radians) and print result
   m_apm_sin(r, 16, r); //Calculate to 16 decimal places
   m_apm_to_string((char *)buffer, 16, r); //Buffer 16 decimal places
   printf("%s\n", (char *)buffer);
       return 0;

//sin(60) = -0.304810621

2009\01\27@031900 by Tamas Rudnai

face picon face

There is no return (or there is no sense for that in micros) in the mail
function as there is nowhere to return. What happens is that the startup
code calls the main functon again and again... If you wan to stop the
execution then you must put an infinite loop at the end. Not sure if that
the case but now there is no free for your allocated buffer so there must be
a memory leak in this way.


On Sat, Jan 24, 2009 at 8:37 PM, solarwind <> wrote:

{Quote hidden}

> -

More... (looser matching)
- Last day of these posts
- In 2009 , 2010 only
- Today
- New search...