/* Multi EM1000 Modem Application Copyright (c) 1999, Z-World Engineering A LP3100 controller controls one EM1000 which alternately sends serial messages to alternate EM1000's. The two receiving EM1000s should be configured for passive listening via the DWN.EM 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 LP3100 (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 LP3100 to ground of the EM1000. The other connection digital output pin 14 to the CTL input of the EM1000. If available, code for the LP3100 should be compiled and debugged using the SIB2 and a serial cable from H4 connecting to the master 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 LP3100 #use "EM1000.LIB" #use eziolp31.lib void send(char *pcName, char *wCount); void em_Mode(int bCmd); void main( void) { //*********************************************** Board & variables setup ***************************************************** char Lead[100]; //working buffer #1 char End[] = "The time will now be sent to Allan's EM1000.\r"; //Supplemental message char End2[] = "The time will now be sent to Richard's EM1000.\r"; //Supplemental message char Combo[128]; //Buffer to concat to 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; sTM.tm_mon = 2; sTM.tm_mday = 21; sTM.tm_hour = 9; sTM.tm_min = 33; sTM.tm_sec = 00; while (tm_wr ( &sTM )); // Write New Time to RTC //*/ //************************* Set up message to be sent ***************************** outport(0x4084,1); //flip the RS 232 driver anc CTS switches to set outport(0x4083,1); //up both 232 for operation outport(0x4082,1); emInit (); while(1) { memset(Combo, '\0', sizeof Combo); 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); strcat(Combo, Lead); memcpy(&Combo[strlen(Lead)], End, strlen(End)); send ( "10.10.6.10",Combo ); emDelay(1000*30); // delay for 30 seconds to allow receiving units to scroll message memset(Combo, '\0', sizeof Combo); 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); strcat(Combo, Lead); memcpy(&Combo[strlen(Lead)], End2, strlen(End)); send ( "10.10.6.20",Combo); emDelay(1000*30); } }//****************************** 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 library function for use on a lp3100 outport(0x4060, (bCmd?0x00:0x001) ); //channel DOUT0 Pin #14 of header H2 }//**************************** End of modified em_Mode *********************