// ---------------------------------------------------- // TEST application for // Cruise Control application for Panther Electro-Steer // // -- TEST3 -- drive the ElectroSteer relays // // 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 rattle() { // aCore_Outportc(0x0368,0); // buzzer on aDig_Write(STARDIO, 1); aCore_Sleep(1000); aDig_Write(STARDIO, 0); aDig_Write(PORTDIO, 1); aCore_Sleep(1000); aDig_Write(PORTDIO, 0); aDig_Write(STARDIO, 1); aCore_Sleep(1000); aDig_Write(STARDIO, 0); aDig_Write(PORTDIO, 1); aCore_Sleep(1000); aDig_Write(PORTDIO, 0); aCore_Outportc(0x0369,0); // buzzer off } void main () { int i; // // initialize the digital output ports aDig_Config(PORTDIO, ADIG_OUTPUT); aDig_Config(STARDIO, ADIG_OUTPUT); // Print sign on message aPrint_String("Test 3, drive ElectroSteer relays\n"); aCore_Sleep(2000); // Sleep a second, then move one direction 1 second aCore_Sleep(10000); aPrint_String(" going starboard...\n"); aDig_Write(STARDIO, 1); aCore_Sleep(10000); aDig_Write(STARDIO, 0); // Sleep a second, then move the other direction 1 second aCore_Sleep(10000); aPrint_String(" going port...\n"); aDig_Write(PORTDIO, 1); aCore_Sleep(10000); aDig_Write(PORTDIO, 0); // Sleep a second, then single rattle aCore_Sleep(10000); aPrint_String(" single rattle...\n"); rattle(); // Sleep a second, then double rattle aCore_Sleep(10000); aPrint_String(" double rattle...\n"); rattle(); aCore_Sleep(3000); rattle(); // Print sign off message aPrint_String("Test 3 finished\n"); aCore_Sleep(1000); }