Parallel bus emulation by GPIO ports

Dependencies:   mbed parallel_bus

Revision:
1:84f14b88a570
Parent:
0:b0587d0181e1
--- a/main.cpp	Tue Jul 10 05:39:46 2012 +0000
+++ b/main.cpp	Thu Jul 12 05:53:12 2012 +0000
@@ -1,22 +1,30 @@
+//  paprallel bus library demo 
+//      10-Jul-2012 : original
+//      12-Jul-2012 : using version 2 library 
+
 #include "mbed.h"
 #include "hardware_abs.h"
 
-#define ADDR    0xC3
-
-char    data[]  =   { 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8, 0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0, 0xEF };
-char    v;
+char    data[]  =   { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F };
+char    rd[ 16 ];
+char    a;
+char    b;
 
 int main() {
     hardware_initialize();
     reset( 10, 1000 );
 
-    write_data( 0xCA, 0x55 );
+    write_data( 0xCA, 0x55 );    
     write_data( 0xDA, 0xAA );
-    v   = read_data( 0xCA );
-    v   = read_data( 0xDA );
+    a   = read_data( 0xCA );
+    b   = read_data( 0xDA );
 
+    write_data( 0xC0, 0x02 );    
     write_data_burst( 0xC3, data, sizeof( data ) );
 
+    write_data( 0xC0, 0x02 );
+    read_data_burst( 0xC3, rd, sizeof( rd ) );
+
     while (1)
         ;
 }