Current (on Nov. 15th, 2014) LPC1114 Ticker function has a trouble after one hour and 11 minutes after due to 32bit timer overflow. I hope this will be fine by mbed support team.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*
00002  * mbed Application program / Ticker has a bug!?
00003  *  by Kenji Arai / JH1PJL
00004  *      http://mbed.org/users/kenjiArai/
00005  *      Created: Nobember  15th, 2014
00006  */
00007 #include "mbed.h"
00008 
00009 Ticker t;
00010 
00011 uint32_t t_count;
00012 uint8_t flag;
00013 
00014 void cyclic(void){   flag = 1;}
00015 
00016 int main(void){ // PLease wait 1 hour 11 minutes and 34.9 seconds
00017     t.attach(&cyclic, 1.0);
00018     flag = 0;
00019     t_count = 0;
00020     while(true) {
00021         while(flag == 0){
00022             wait(0.1); 
00023             printf(".");
00024         }
00025         flag = 0;
00026         printf("\r\nt_count=%8d, TMR32B1=%14d\r\n", ++t_count, LPC_TMR32B1->TC);
00027     }
00028 }