ECE 4180
/
4180_L1_P7
Lab 1 Part 7
Revision 3:03e0b3710bf0, committed 2021-02-01
- Comitter:
- glanier9
- Date:
- Mon Feb 01 20:04:37 2021 +0000
- Parent:
- 2:934a0500abde
- Commit message:
- final
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 934a0500abde -r 03e0b3710bf0 main.cpp --- a/main.cpp Fri Jan 28 02:04:05 2011 +0000 +++ b/main.cpp Mon Feb 01 20:04:37 2021 +0000 @@ -50,17 +50,26 @@ led1=0; // Start Loopback test sending out and reading back values // loopback test uses A0 and B0 pins - so use a wire to jumper those two pins on MCP23S17 together + int sw = 0; while (1) { - // write 0xAA to MCP23S17 Port A - chip.write(PORT_A, 0xAA); - wait(.5); - // read back value from MCP23S17 Port B and display B0 on mbed led1 - led1 = chip.read(PORT_B)& 0x01; - // write 0x55 to MCP23S17 Port A - chip.write(PORT_A, 0x55); - wait(.5); - // read back value from MCP23S17 Port B and display B0 on mbed led1 - led1 = chip.read(PORT_B)& 0x01; - // led1 should blink slowly when it is all working +// // write 0xAA to MCP23S17 Port A +// chip.write(PORT_A, 0xAA); +// wait(.5); +// // read back value from MCP23S17 Port B and display B0 on mbed led1 +// led1 = chip.read(PORT_B)& 0x01; +// // write 0x55 to MCP23S17 Port A +// chip.write(PORT_A, 0x55); +// wait(.5); +// // read back value from MCP23S17 Port B and display B0 on mbed led1 +// led1 = chip.read(PORT_B)& 0x01; +// // led1 should blink slowly when it is all working + + // Read from B + sw = chip.read(PORT_B)& 0x01; + + chip.write(PORT_A, sw); + + + } }