Parallel bus emulation by GPIO ports
Dependencies: mbed parallel_bus
main.cpp@1:84f14b88a570, 2012-07-12 (annotated)
- Committer:
- nxp_ip
- Date:
- Thu Jul 12 05:53:12 2012 +0000
- Revision:
- 1:84f14b88a570
- Parent:
- 0:b0587d0181e1
comment added
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nxp_ip | 1:84f14b88a570 | 1 | // paprallel bus library demo |
nxp_ip | 1:84f14b88a570 | 2 | // 10-Jul-2012 : original |
nxp_ip | 1:84f14b88a570 | 3 | // 12-Jul-2012 : using version 2 library |
nxp_ip | 1:84f14b88a570 | 4 | |
nxp_ip | 0:b0587d0181e1 | 5 | #include "mbed.h" |
nxp_ip | 0:b0587d0181e1 | 6 | #include "hardware_abs.h" |
nxp_ip | 0:b0587d0181e1 | 7 | |
nxp_ip | 1:84f14b88a570 | 8 | char data[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; |
nxp_ip | 1:84f14b88a570 | 9 | char rd[ 16 ]; |
nxp_ip | 1:84f14b88a570 | 10 | char a; |
nxp_ip | 1:84f14b88a570 | 11 | char b; |
nxp_ip | 0:b0587d0181e1 | 12 | |
nxp_ip | 0:b0587d0181e1 | 13 | int main() { |
nxp_ip | 0:b0587d0181e1 | 14 | hardware_initialize(); |
nxp_ip | 0:b0587d0181e1 | 15 | reset( 10, 1000 ); |
nxp_ip | 0:b0587d0181e1 | 16 | |
nxp_ip | 1:84f14b88a570 | 17 | write_data( 0xCA, 0x55 ); |
nxp_ip | 0:b0587d0181e1 | 18 | write_data( 0xDA, 0xAA ); |
nxp_ip | 1:84f14b88a570 | 19 | a = read_data( 0xCA ); |
nxp_ip | 1:84f14b88a570 | 20 | b = read_data( 0xDA ); |
nxp_ip | 0:b0587d0181e1 | 21 | |
nxp_ip | 1:84f14b88a570 | 22 | write_data( 0xC0, 0x02 ); |
nxp_ip | 0:b0587d0181e1 | 23 | write_data_burst( 0xC3, data, sizeof( data ) ); |
nxp_ip | 0:b0587d0181e1 | 24 | |
nxp_ip | 1:84f14b88a570 | 25 | write_data( 0xC0, 0x02 ); |
nxp_ip | 1:84f14b88a570 | 26 | read_data_burst( 0xC3, rd, sizeof( rd ) ); |
nxp_ip | 1:84f14b88a570 | 27 | |
nxp_ip | 0:b0587d0181e1 | 28 | while (1) |
nxp_ip | 0:b0587d0181e1 | 29 | ; |
nxp_ip | 0:b0587d0181e1 | 30 | } |