Showing the length of mbed datatypes in bytes.

Dependencies:   mbed OptrexLCD

Files at this revision

API Documentation at this revision

Comitter:
Eduard
Date:
Mon Nov 29 23:14:17 2010 +0000
Child:
1:275d27c2d033
Commit message:

Changed in this revision

OptrexLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OptrexLCD.lib	Mon Nov 29 23:14:17 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Eduard/code/OptrexLCD/#ef7b6dec773f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Nov 29 23:14:17 2010 +0000
@@ -0,0 +1,40 @@
+/*************************************************************************
+* Gets the length of mbeds datatypes and display those on a 20x4 Optrex LCD
+* This LCD needs a different timing than a normal LCD, see the 
+* OptrexLCD program for more information. 
+**************************************************************************/
+
+#include "mbed.h"
+#include "OptrexLCD.h"
+
+DigitalOut BlinkLed(LED4);
+
+TextLCD lcd(p10, p12, p15, p16, p17, p18, TextLCD::LCD20x4 ); // rs, e, d0-d3
+
+void WaitRefres() // procedure for showing the result for 3 seconds before getting the next datatypes 
+{
+    wait(3);
+    lcd.cls();
+    BlinkLed = !BlinkLed;
+}    
+    
+int main() 
+{
+    BlinkLed = 1;   // show the program is running
+    while(1)
+    {    
+        lcd.printf("sizeof(char)  == %d\n", sizeof(char));
+        lcd.printf("sizeof(short) == %d\n", sizeof(short));
+        lcd.printf("sizeof(int)   == %d\n", sizeof(int));
+        lcd.printf("sizeof(long)  == %d\n", sizeof(long));
+        WaitRefres();
+        
+        lcd.printf("sizeof(float)  == %d\n", sizeof(float));
+        lcd.printf("sizeof(double) == %d\n", sizeof(double));
+        WaitRefres();
+        
+        lcd.printf("sizeof(long double)\n == %d\n", sizeof(long double));
+        lcd.printf("sizeof(long long)\n == %d\n", sizeof(long long));
+        WaitRefres();
+    } 
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Nov 29 23:14:17 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e