9 years, 10 months ago.

sample Class lib inherits Serial Class but no output at all

I am trying to write a sample lib which inherits the Serial Class from mbed.h, I could manage to compile the code but there is no output at all when I run it.

I am thinking it might be a inheritance problem for OOP. I have no idea what's wrong and stuck by that now ...

Could anyone take a look of my sample class which is the only repository under my profile.

Thanks a lot !!

Terry

Question relating to:

Sample RS232 class lib inherits Serial Class

1 Answer

9 years, 10 months ago.

The problem, your LPC1768 has 32kB + 16kB + 16kB of RAM memory, 32kB is the general purpose you normally only use. From your code:

ringBuffer = new char[65536];

You allocate 64kB here already. Even if you would have the complete 64kB available, that still wouldn't fit with other variables. Do you really need such a gigantic buffer? If yes, then consider the LPC4088, that should solve all your memory issues.

Something to take into account, you have printfs placed in your code for debugging it. Thats good, but there is one problem (I know, ran into it myself often enough), you inherit Serial, which also as printf, so instead of printf'ing to your PC, it will use the printf function of your class, sending it to p9, p10. To send it to your pc use:

std::printf("I like cookies\r\n");

Accepted Answer

Really thank you very much !!

Finally I can continue with my work :D :D

posted by Terry Tam 17 Jun 2014