Parallel bus emulation by GPIO ports

Dependencies:   mbed parallel_bus

main.cpp

Committer:
nxp_ip
Date:
2012-07-12
Revision:
2:57997f9f23ea
Parent:
1:84f14b88a570

File content as of revision 2:57997f9f23ea:

//  paprallel bus library demo 
//      10-Jul-2012 : original
//      12-Jul-2012 : using version 2 library 

#include "mbed.h"
#include "hardware_abs.h"

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( 0xDA, 0xAA );
    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)
        ;
}