/* This program is designed to act as a master controller to send the time to one EM1000, pause, then send the time to a different EM1000. Multi EM1000 Modem Application Copyright (c) 1999, Z-World Engineering A BL1600 controller controls one EM1000 which alternately sends serial messages to EM1000s. The two receiving EM1000s should be configured for passive listening via the LISTEN.BAT batch file. Make sure that each is configured with a unique IP address suitable for your network. Also make sure to modify the IP addresses in this program to match the ones you've selected. The master EM1000 should be configured minimally as follows (additional commands might be desired to control the flow of data from the master EM1000 to the slave EM1000s): baud 19200 configmode gpio connect request The RS-232 serial port of the BL1600 (serial port Z0) should be connected to the COM1/RS232 port of the EM1000. Two additional lines need to be added. One connects ground of the BL1600 to ground of the EM1000. The other connection digital output pin 0 (Bank B) to the CTL input of the EM1000. If available, code for the BL1600 should be compiled and debugged using the SIB2 to the core module and a serial cable from H12 connecting to the EM1000. If not available, simply downloading the code from the PC prior to switching the serial cable to the EM1000 should be sufficient. */ // Author: Richard Jensen Zworld Technical Support // Revision history: 01/07/00 1.0.2 multi_ip.c modified to send time through a BL1600 #use "EM1000.LIB" void send(char *pcName, char *wCount); void em_Mode(int bCmd); void main( void) { //*********************************************** Board & variables setup ***************************************************** char Lead[100]; //working buffer #1 struct tm sTM; //Structure to hold time variables ///* manually set time as needed manually set time as needed manually set time as needed sTM.tm_year = 00; // Date = Sep 8, 1999 sTM.tm_mon = 01; sTM.tm_mday = 18; sTM.tm_hour = 7; // Time = 14:35:00 pM sTM.tm_min = 3; sTM.tm_sec = 00; while (tm_wr ( &sTM )); // Write New Time to RTC //*/ //************************* Set up message to be sent ***************************** emInit (); while(1) { memset(Lead, '\0', sizeof Lead); while(tm_rd (&sTM)); //Read RTC values retry if errors sprintf(Lead, "The time is %02d:%02d hours. \0", sTM.tm_hour, sTM.tm_min); send ( "10.10.6.10", Lead ); emDelay(1000*40); // delay for 40 seconds memset(Lead, '\0', sizeof Lead); while(tm_rd (&sTM)); //Read RTC values retry if errors sprintf(Lead, "The time is %02d:%02d hours. \0", sTM.tm_hour, sTM.tm_min); send ( "10.10.6.20", Lead ); emDelay(1000*40); // delay for 40 seconds } }//****************************** End of Main ******************************** void send(char *pcName, char *wCount) { if (emRemoteName ( pcName )) if (emOpen (0)) { emDelay ( 500 ); emPrintf ( "%s \r",wCount ); emDelay ( 500 ); emClose (); } }//***************************** End of send ******************************** void em_Mode(int bCmd) { //outport ( DRV1,(bCmd?0xFF:0x00) ); re-define for use on a BL1600 bank HC1 outport(0x120, (bCmd?0x01:0x00) ); }//**************************** End of modified em_Mode *********************