// ---------------------------------------------------- // TEST application for // Cruise Control application for Panther Electro-Steer // // -- TEST1 -- Read the config switches // // Copyright 2005,2006, Mike Noel, All Rights Reserved // ---------------------------------------------------- #include #include #include #include // ********************* Definitions ********************* // digital i/o port definitions. // 0 - output - reflex uses to drive buzzer... // 1 - output - drive ES relay to go port // 2 - output - drive ES relay to go starboard // 3 - input - read ES switch labeled DN // 4 - input - read ES switch labeled UP // 5 - output - enable Horizontal Daventech compass // 6 - output - enable Vertical Daventech compass // 7 - input - read configuration switch labeled 4 // 8 - input - read configuration switch labeled 3 // 9 - input - read configuration switch labeled 2 // 10- input - read configuration switch labeled 1 #define PORTDIO 1 #define STARDIO 2 #define DnButton 3 #define UpButton 4 #define EnaHC 5 #define EnaVC 6 #define Config4 7 #define Config3 8 #define Config2 9 #define Config1 10 // ********************* Test Routine ******************** void main () { // int i; char SwitchBits=0; // initialize the ports aDig_Config(Config1, ADIG_INPUT); aDig_Config(Config2, ADIG_INPUT); aDig_Config(Config3, ADIG_INPUT); aDig_Config(Config4, ADIG_INPUT); // Print sign on message aPrint_String("Test 1, Read the Config Switches\n"); aCore_Sleep(5000); // Get and print config switch settings i = aDig_ReadInt(Config4); SwitchBits = (char)i; i = aDig_ReadInt(Config3); SwitchBits = (SwitchBits+SwitchBits) + (char)i; i = aDig_ReadInt(Config2); SwitchBits = (SwitchBits+SwitchBits) + (char)i; i = aDig_ReadInt(Config1); SwitchBits = (SwitchBits+SwitchBits) + (char)i; SwitchBits = SwitchBits ^ 0x0f; aPrint_String("Switches (xxxx4321) "); aPrint_CharBin(SwitchBits); aPrint_String(" \n"); aCore_Sleep(5000); // Print sign off message aPrint_String("Test 1 finished\n"); aCore_Sleep(1000); }