Temp-Indicator Using AT89C52

Embed Size (px)

Citation preview

  • 7/28/2019 Temp-Indicator Using AT89C52

    1/12

    c o n s t r u c t i o n

    electronics for you July 2004

    temperature indicator

    using at89c52AdityA RAne

    Heres a microcontroller-based tem-perature indicator that displays thetemperature in the range o 55C

    to 125C. Besides AT89C52 microcontroller,it uses a temperature sensor chip and anLCD module. The indicator outputs thecalibrated data in digital orm. The programor the microcontroller is written in C andnot in Assembly language. Since C programhas well-dened syntax, it ar outweighs

    the merits o the Assemblylanguage program.

    th crcu

    Fig. 1 shows the block dia-gram o the temperature in-dicator using microcontrollerAT89C52. The power supplyor the circuit is regulatedby IC 7805 and supplied todierent parts o the unit.

    c o n s t r u c t i o n

    Fig. 1: Block diagram of temperature indicator using AT89C52

    Fig. 2: Circuit diagram of temperature indicator using AT89C52

  • 7/28/2019 Temp-Indicator Using AT89C52

    2/12

    c o n s t r u c t i o n

    electronics for youJuly 2004

    DS1621 is the temperature sensor chip. Themicrocontroller unit (MCU) reads the tem-perature rom the sensor. The temperaturedata is compared with certain user-denedtemperature values and processed insidethe MCU as per the program and then sentto the LCD or display.

    Fig. 2 shows the circuit o temperatureindicator using microcontroller AT89C52.Working o each section o the circuit iscovered in the ollowing paragraphs.

    Power supply. The power supply unitconsists o a step-down transormer (230VAC primary to 0-9V, 250mA secondary),bridge rectier and voltage regulator. Theoutput o the transormer is ed to bridge rec-tier diodes D1 through D4 (each 1N4007).The ripple rom the output bridge rectier isltered by capacitor C1 and ed to regulatorIC 7805. The regulated output is given tothe temperature sensor, microcontroller unitand LCD module, respectively.

    When switch S1 is closed, LED1 glowsto indicate the presence o power in thesystem.

    Temperature sensor.Temperature sen-sor chip DS1621 (IC3) is an 8-pin DIP IC.Its pin details are shown in Fig. 3 and theinternal block diagram in Fig. 4. The chipcan measure temperatures rom 55C to+125C in 0.5C increments, which areread as 9-bit values. It can operate o 2.7Vto 5.5V. Data is read/written via a 2-wireserial interace. Pins 1 and 2 o the tempera-ture IC are connected to pins 11 and 10 othe microcontroller, respectively.

    The thermala larm output(T

    out) o IC DS1621

    activates whenthe temperatureexceeds user-dened high tem-perature TH. Theoutput remains

    active until the temperature drops belowuser-dened low temperature TL. User-de-ned temperature settings are stored in thenon-volatile memory. Temperature settings

    and temperature readings are all commu-nicated to/rom IC DS1621 over a 2-wireserial cable. The most signicant bit (MSB)o the data is transmitted rst and the lastsignicant bit (LSB) is transmitted last.

    Addressing . The chip address oDS1621 comprises internal preset code nib-ble 1001 (binary) ollowed by externallycongurable address pins/bits A2, A1 and

    A0. The eighth bit o the address byte isdetermined by the type o operation (eitherread or write) that is to be perormed. Forwriting to the device the eighth bit is 0and or reading rom the device the eighthbit is 1. In our case, A2, A1 and A0 pinsare grounded and hence the device addressor writing is 1001000b or 90(hex) and orreading the device address is 10010001bor 91(hex).

    Confguration/status register. Thisregister can be accessed or reading orwriting by issuing command byte AC(hex)rom the master (82C52). This register isparticularly required i DS1621 is used orthermostat control, since it contains fagbits THF (high-temperature fag) and TLF(low-temperature fag) which are set to1 when temperature crosses the respec-tive limits earlier written into TH andTL registers. It also contains the fag bit(Done), which is set to 1 when resultso conversion are available ater issuingo start conversion command EE(hex).The other bits o conguration register aredened below:

    NVB is the non-volatile memory busy

    Fig. 3: Pin details of IC

    DS1621

    Fig. 4: Internal block diagram of IC DS1621

    Parts List

    Semiconductors:IC1 - 7805 regulator ICIC2 - AT89C52 microcontrollerIC3 - DS1621 temperature sensorD1-D4 - 1N4007 rectier diodesLED1 - Red LED

    Resistors (all -watt, 5% carbon,

    unless stated otherwise):

    R1 - 1-kilo-ohmR2 - 47-kilo-ohmR3 - 10-kilo-ohmR4, R5 - 4.7-kilo-ohmVR1 - 1-kilo-ohm preset

    Capacitors:C1 - 470F, 25V electrolytic

    capacitorC2, C3, C4 - 0.1F ceramic diskC5 - 10F, 16V electrolytic

    capacitorC6,C7 - 33pF ceramic capacitor

    Miscellaneous:Transormer - 230V AC primary to 0-9V,

    250mA secondaryCrystal - 12 MHzLCD - 161 LCD moduleS1 - On/O SPST switch

    Fig. 5: Pin details of IC AT89C52

  • 7/28/2019 Temp-Indicator Using AT89C52

    3/12

    c o n s t r u c t i o n

    electronics for you July 2004

    fag, 1 is write to an E2 memory cell inprogress, 0 indicates that non-volatilememory is not busy, POL is non-volatileoutput polarity bit (1=active-high and

    0=active-low) and 1SHOT is one-shotmode. A copy to E2 may take up to 10 ms.I 1SHOT is 1, DS1621 will perorm onetemperature conversion upon receptiono the Start Convert T protocol. I 1SHOTis 0, DS1621 will continuously perorm

    temperature conversions. This bit is non-volatile.

    Command Set. Complete commandinstruction set or accessing various internal

    registers as well as or starting andstopping o conversion process aregiven in Table I. For understandingthe exact sequence in which Start

    bit, address byte, acknowledgement bit,command byte(s) and data byte(s) are tobe sent along the I2C bus, please reer to thedatasheet o DS1621, wherein these aspectshave been explained in proper detail. Thiswill help in understanding the contents o

    the main program.Microcontroller unit. Microcontroller

    AT89C52 (IC2) is a 40-pin IC rom Atmel.Its pin details are shown in Fig. 5. LikeAT89C51, it also belongs to the 8031/8051amily. Microcontroller AT89C52 has a2568-bit internal random-access memory(RAM), eight interrupt sources and 8 kB ofash memory compared to128x8-bit inter-nal RAM, six interrupt sources and 4 kB ofash memory in AT89C51. By combininga versatile 8-bit CPU with fash memoryon a monolithic chip, Atmel AT89C52 is apowerul, highly fexible and cost-eective

    solution to many embed-ded control applications.

    Ports 0 and 2 are 8-bitbidirectional input/output(I/O) ports. These portshavent been used in thistemperature indicator.

    Port 1 is an 8-bit bidi-rectional I/O port with in-ternal pull-ups. Ports 1.0through 1.7 are connectedto pins 7 through 14 othe LCD. Port-1 outputbuers can sink/sourceour TTL inputs.

    Port 3 is an 8-bit bi-directional I/O port withinternal pull-ups. Ports3.0 and 3.1 o IC2 areconnected to serial clockline (SCL) and serial dataline (SDA) o IC3, respec-tively. Ports 3.2 through3.4 are connected to pins4 through 6 o the LCD,respectively. Port-3 outputbuers can sink/sourceour TTL inputs.

    A 12MHz crystal oscil-lator is connected to X

    TAL1

    and XTAL2

    pins or operation o the micro-controller. A high pulse on RST pin (pin 9)while the oscillator is running resets themicrocontroller. In this circuit, this pin isconnected to +Vcc through capacitor C5(10 F, 16V). The external-access enablepin (EA) is connected to +Vcc or internalprogram executions. This pin also receivesthe 12V programming-enable voltage (V

    PP)

    during fash programming when 12V pro-gramming is selected.

    th prgra

    The C-language program or microcon-troller AT89C52 is compiled using cross-compiler C51 Version 7.10 rom Keil Sot-

    Fig. 6: Solder-side PCB layout for temperature indicatorusing AT8952

    Fig. 7: Component layout for the PCB

    tabLe i

    Ds1621 Commnd s

    inucon Dcpon Poocol

    Read Temperature Reads last converted temperature value rom Aah

    temperature register.Read Counter Reads value o count remaining rom counter. A8h

    Read Slope Reads value o the slope accumulator. A9h

    Start Convert T Initiates temperature conversion. EEh

    Stop Convert T Halts temperature conversion. 22h

    Access TH Reads or writes high temperature limit value into A1h

    TH register.

    Access TL Reads or writes low temperature limit value into A2h

    TL register.

    Access Conguration Reads or writes conguration data to conguration ACh

    register.

  • 7/28/2019 Temp-Indicator Using AT89C52

    4/12

    c o n s t r u c t i o n

    electronics for you July 2004

    ware. The demo version o this compileris available or ree on the Website www.keil.com. It can compile programs up to2 kB only, which is sucient or writingmost programs.

    For testing the display, the programHello.c is given here. This program, whenloaded to AT89C52, displays Hello! HowR U? on the LCD. The Hello.c programhas nothing to do with temperature. Itjust guarantees a perect communicationbetween the LCD and the microcontroller.For temperature indication, the programTemp52.c is used. The programs Hello.cand Temp52.c, along with the hex les, aregiven at the end o this article.

    The communication interace be-tween the temperature sensor and themicrocontroller chip ollows the I2C (In-ter Integrated Circuit) standard, whichis implemented in C here. I2C is asimple master/slave type interace.Simplicity o the IC system is primarilydue to the bidirectional 2-wire (SDA andSCL) design and the protocol ormat.Bidirectional communication is through2-wire lines (which are either active-low or passive-high). In the program,the i2c_stop, i2c_start, i2c_write andi2c_read unctions are used or commu-nicating Clock and Data rom DS1621 toP3.0 and P3.1 o AT89C52, respectively.Such unctions as command, ready anddisplay in the program are used or driv-ing the LCD.

    Program compilation or 8051 amily

    controller. Keil C51 can compile C pro-grams or most o the Atmel amily micro-controllers. It also supports other devices.Unlike other cross-compilers (Hi-Tech, IAR,SDCC, etc), Keil C51 oers such eatures asast code generation, strong multitaskingenvironment, real-time operating systemand inbuilt code optimisation. To enjoythese eatures, youll need ull version othe compiler.

    Keil C51 has options to generateAssembly code and all the code listingsupported by 8051 amily, but Assemblylanguage generated cannot be recompiledon any other assembler. As ar as codegeneration is concerned, it uses mini-mum RAM and on-chip fash, allowingaster and optimised program in Intel-Hex ormat, which can be loaded to themicrocontroller using any programmer.Conversion o C program into Intel-Hexormat takes only a ew seconds. In act,you dont require all that long Assemblyprogram in order to generate the outputhex le.

    LCdFor display, a Lampex make 16x1 LCD(model GDM1601A) was used. Pin con-nections o this LCD are given in Table II.Pins 15 and 16 havent been used. Pin 3 isconnected to the circuit ground through a1-kilo-ohm preset that is used to controlthe light intensity o the LCD. Note that theHitachi make 161 LCD (HD44780A00)will not work in this project.

    Csruc

    The circuit o this temperature indicator

    using microcontroller AT89C52 can beassembled on any general-purpose, single-side PCB. The microcontroller chip and thetemperature sensor chip are mounted onthe respective IC bases. Ensure a propercontact between pins o the IC bases andthe solder points on the PCB. CapacitorsC3 and C4 must be connected near IC2and IC3, respectively. The actual-size,single-side PCB layout or the circuit andits component layout are shown in Figs 6and 7, respectively.

    Prgra cplaAter youve installed Keil C51 in your PC,you can compile C program and gener-ate hex le in either DOS or Windowsmode. Here, program compilation or theprogram Hello.c has been explained. Thesame procedure is to be ollowed or thetemperature indication program Temp52.c. For more example programs, reer to thedirectory in your hard drive where Keil isinstalled in the example older.

    DOS mode. 1. Installation o Keil C51automatically generates Keil older inyour computers C drive.

    2. Go to C:\Keil\C51\Bin olderinside Keil older.

    3. Copy Hello.c into Bin older.4. Copy Regx52.h rom C:\Keil\

    C51\Inc\Atmel older into C:\Keil\C51\Bin older.

    5. Type c51 Hello.c against thepromptand press Enter key.

    6. Type bl51 Hello.obj. This com-mand is used or linking the Hello.objle created by Keil C51.

    7. Type oh51 Hello. This commandis used or creating the hex le.

    Windows mode. 1. Installation oKeil C51 sotware automatically createsthe icon Keil uVision2 on the desktop.

    2. Double-click Keil uVision2.3. Suppose you have kept Hello.c

    under C:\Windows\Desktop\Hello older.Open Hello.c rom the File menu.

    4. From the menu bar, select Project/New Project. Name the new project andsave it with extension .uv2.

    5. Select CPU as Atmel/AT89C52.6. Choose Yes in the option Copy stan-

    dard 8051 code to current project older.7. Choose View/Project Window. A

    Project Workspace window appears.8. Double-click Target 1.9. Right-click Source Group1 and se-

    lect Add les to Group Source Group1.A window appears.

    10. Add Hello.c and close this win-dow.

    11. Double-click Source Group1 onthe Project Workspace window. Now thele name Hello.c appears.

    12. From Project menu, select Op-tions or File Hello.c. In Properties,choose le type as C source le.

    13. Again rom Project menu, selectOptions or Target Target1. A screenappears.

    14. Choose Output and tick on HexFile or generating the hex le. Againchoose Listing option and tick on Con-ditional and Assembly Code.

    15. Open the Project menu and selectBuild Target or press F7. The compilershows Hello 0 Error(s), 0 Warning(s)in the output window just below the proj-ect window.

    16. Close the screen and go to theHello older to see the generated hex leand listing le.

    Load the hex le into the microcon-troller chip using a programmer. (Hereweve used Atmel Flash Programmer rom

    tabLe ii

    Pn Conncon of h LCD

    Pn No. Funcon

    Pin 1 Ground (Gnd)

    Pin 2 +Vcc

    Pin 3 V0 (display intensity control)

    Pin 4 RS (connected to P3.2 o AT89C52)Pin 5 R/W (connected to P3.3 o AT89C52)

    Pin 6 EN (connected to P3.4 o AT89C52)

    Pin 7 D0 (connected to P1.0 o AT89C52)

    Pin 8 D1 (connected to P1.1 o AT89C52)

    Pin 9 D2 (connected to P1.2 o AT89C52)

    Pin 10 D3 (connected to P1.3 o AT89C52)

    Pin 11 D4 (connected to P1.4 o AT89C52)

    Pin 12 D5 (connected to P1.5 o AT89C52)

    Pin 13 D6 (connected to P1.6 o AT89C52)

    Pin 14 D7 (connected to P1.7 o AT89C52)

    Pin 15 Backlight +Vcc (not used)

    Pin 16 Backlight Gnd (not used)

  • 7/28/2019 Temp-Indicator Using AT89C52

    5/12

    c o n s t r u c t i o n

    electronics for youJuly 2004

    temP52.C

    /* Written By: Aditya RaneT.E Computer Engg, Lokmanya Tilak College o Engineer-

    ing, New Bombay, VashiE-mail: [email protected] or temperature indicator compiled under keil

    'C' */

    #include#include#include

    //------------------------------------------------------------------------//Global Variable

    //-------------------------------------------------------------------------int temperature;#dene HIGH 0x01 // Active High Signal#dene LOW 0x00 // Active Low Signal#dene TRUE 0x01 // Active High State#dene FALSE 0x00 // Active Low State

    //-------------------------------------------------------------------------// Functions Prototyping//-------------------------------------------------------------------------void ready (void);void command (int);void display (char *);void i2c_stop (void);void i2c_start (void);void i2c_write (unsigned char);unsigned char i2c_read (void);void convert (unsigned char);

    //-------------------------------------------------------------------------// Port Denation//-------------------------------------------------------------------------#dene DATA P3_1 // Serial data#dene CLOCK P3_0 // Serial clock

    //Begining o Main Programvoid main (void){int tmp;char str[16];bit fag = FALSE;unsigned char ch;void command (int);void display (char *);command(0x3c);command(0x0c);command(0x06);while(1){

    i2c_start();i2c_write(0x90);i2c_write(0xEE);i2c_stop();

    i2c_start();i2c_write(0x90);i2c_write(0xAA);i2c_start();i2c_write(0x91);ch = i2c_read();i2c_stop();temperature = 0;convert(ch);i(fag == FALSE){

    fag = TRUE;

    tmp = temperature;}else{

    i(tmp != temperature){

    tmp = temperature;sprint(str,"%d%s

    ",temperature," Centigrade");command(0x01);command(0x80);display(str);

    }}

    }}

    //Delay Servive Routinevoid delay_time (void)

    {unsigned int i;or(i=0;i

  • 7/28/2019 Temp-Indicator Using AT89C52

    6/12

    c o n s t r u c t i o n

    electronics for you July 2004

    HeLLo.C#include#include#include

    void ready(void);void command(int);void display(char *);void main (void){command(0x3c);command(0x0c);command(0x06);command(0x01);command(0x80);display("Hello! How R U ?");while(1);}

    void command(int a){void ready(void);

    ready();P1=a;P3_2=0x00;P3_3=0x00;P3_4=0x01;P3_4=0x00;}

    void display(char *str){unsigned int i;or(i=0;i

  • 7/28/2019 Temp-Indicator Using AT89C52

    7/12

    c o n s t r u c t i o n

    electronics for you July 2004

    #include #include #include #include #include #include #include

    #include #include #include #include #include #include //Global Sub routinesvoid runprog();//Run programvoid viewprog();//Display Programvoid viewstat();//Display statusvoid orceout();//Force outputsvoid helpu(); //Helpvoid exiter();//Exit to Dosvoid openingmenu();//Opening menuvoid paintscreen(int scrclr);//Paint screenvoid border(); //Draw bordersvoid displaystat();//Display statusvoid displayhelp(char helpilename[10]);//Display a

    Help File

    //Logic commandsvoid ser(int inputno);//seie conacvoid par(int inputno);//Paallel Conacvoid ope(int outputno);//Oupuvoid opl(int outputno);//Oupu lachvoid opu(int outputno);//Oupu unlachint tmr(int tno,int timeset);//timeint ctu(int cno,int countset);//Coune Upint ctd(int cno,int countset);//Coune Downint rto(int hourr,int minn);//real time Oupu//Read Inputs And Energise Outputsvoid inputread();//read inpu povoid setoutputs();//se oupu//Global variables//Inputs and Outputs Image tableint I1,I2,I3,I4,I5,O1,O2,O3,O4,O5,O6,O7,O8;int NI1,NI2,NI3,NI4,NI5,NO1,NO2,NO3,NO4,NO5,

    NO6,NO7,NO8;//Coune Up

    int C1,C2,C3,C4,C5;int CACC1,CACC2,CACC3,CACC4,CACC5;int CDN1,CDN2,CDN3,CDN4,CDN5;int risingedge;//Counters Downint CO1,CO2,CO3,CO4,CO5;int COACC1,COACC2,COACC3,COACC4,COACC5;int CODN1,CODN2,CODN3,CODN4,CODN5;int cd1,cd2,cd3,cd4,cd5;//Timersint T1,T2,T3,T4,T5;int TACC1,TACC2,TACC3,TACC4,TACC5;int TEN1,TEN2,TEN3,TEN4,TEN5;int TDN1,TDN2,TDN3,TDN4,TDN5;int tmrscan1,tmrscan2,tmrscan3,tmrscan4,tmrscan5;//Results Registerint res;//Real Time Outputint RTDN;struct time t;class TTimer r;//For the scan timerdouble te,se;time_t frst1,second1,frst2,second2,frst3,second3,frst4,

    second4,frst5,second5;//Command And Parameter Registerint commno[1000];int para1[1000],para2[1000];//Start o mainvoid main(){openingmenu();}//Opening menu

    SoURCe Code FoR PRoGRAmmABLe LoGiC ContRoLLeR (PC BASed)

    void openingmenu(){window(1,1,80,25);clrscr();paintscreen(9);border();textcolor(YELLOW);

    textbackground(LIGHTBLUE);gotoxy(25,3);cprint(==PC Based Logic Controller==);gotoxy(30,4);cprint(Ver 1.0 (5 I/p,8 O/p));textcolor(LIGHTGREEN);gotoxy(25,6);cprint(== M A I N M E N U ==);gotoxy(25,7);cprint(**********************);textcolor(LIGHTRED);gotoxy(25,9);cprint(F1 >- Run a Logic Program);gotoxy(25,11);cprint(F2 >- View/Edit a Logic Program);gotoxy(25,13);cprint(F3 >- View Input/Output Status);gotoxy(25,15);cprint(F4 >- Force Outputs);

    gotoxy(25,17);cprint(F5 >- Online Help);gotoxy(25,19);cprint(F6 >- Exit);

    USERCHOICE:while(!kbhit()){}char userchoice=getch();switch(userchoice){case (char(59)):runprog();break;case (char(60)):viewprog();break;case (char(61)):viewstat();break;case (char(62)):orceout();break;case (char(63)):helpu();break;case (char(64)):exiter();break;deault:goto USERCHOICE;}

    }//paints the screen with specifed colourvoid paintscreen(int scrclr){textbackground(scrclr);or(int x=0;x

  • 7/28/2019 Temp-Indicator Using AT89C52

    8/12

    c o n s t r u c t i o n

    electronics for youJuly 2004

    gotoxy(10,7);cprint(==================);gotoxy(10,8);cprint(Input # 1(I1):);gotoxy(10,9);cprint(Input # 2(I2):);gotoxy(10,10);cprint(Input # 3(I3):);gotoxy(10,11);cprint(Input # 4(I4):);

    gotoxy(10,12);cprint(Input # 5(I5):);gotoxy(10,13);textcolor(CYAN);cprint(Controller Outputs);gotoxy(10,14);cprint(==================);gotoxy(10,15);cprint(Output # 1(O1):);gotoxy(10,16);cprint(Output # 2(O2):);gotoxy(10,17);cprint(Output # 3(O3):);gotoxy(10,18);cprint(Output # 4(O4):);gotoxy(10,19);cprint(Output # 5(O5):);gotoxy(10,20);cprint(Output # 6(O6):);

    gotoxy(10,21);cprint(Output # 7(O7):);gotoxy(10,22);cprint(Output # 8(O8):);textcolor(YELLOW);gotoxy(40,3);cprint(Counter(UP) Preset ACC Done);gotoxy(40,4);cprint(====================

    =);gotoxy(40,5);cprint(Counter #1);gotoxy(40,6);cprint(Counter #2);gotoxy(40,7);cprint(Counter #3);gotoxy(40,8);cprint(Counter #4);gotoxy(40,9);

    cprint(Counter #5);textcolor(GREEN);gotoxy(40,10);cprint(Counter(DOWN) Preset ACC Done);gotoxy(40,11);cprint(====================

    ==);gotoxy(40,12);cprint(Counter #1);gotoxy(40,13);cprint(Counter #2);gotoxy(40,14);cprint(Counter #3);gotoxy(40,15);cprint(Counter #4);gotoxy(40,16);cprint(Counter #5);gotoxy(40,17);textcolor(LIGHTRED);

    cprint(Timer Enable Preset ACC Done);gotoxy(40,18);cprint(====================

    ==);gotoxy(40,19);cprint(Timer #1);gotoxy(40,20);cprint(Timer #2);gotoxy(40,21);cprint(Timer #3);gotoxy(40,22);cprint(Timer #4);gotoxy(40,23);cprint(Timer #5);gotoxy(40,24);

    cprint(RTO Timer Done:);gotoxy(10,23);textcolor(YELLOW);cprint(Last Scan(msec):);gotoxy(10,24);textcolor(LIGHTBLUE);cprint(File Name:);gotoxy(21,24);textcolor(LIGHTBLUE);cprint(%15s,logicfle);

    //Starting To Read The Filecount=0;while(!infle.eo()){infle>>comm;

    i(stricmp(comm,ser)==0){commno[count]=1;infle>> para1[count];}

    i(stricmp(comm,par)==0){commno[count]=2;infle>> para1[count];}

    i(stricmp(comm,ope)==0){commno[count]=3;infle>> para1[count];}

    i(stricmp(comm,opl)==0){commno[count]=4;infle>> para1[count];}

    i(stricmp(comm,opu)==0){commno[count]=5;infle>> para1[count];}

    i(stricmp(comm,tmr)==0){commno[count]=6;infle>> para1[count];infle>>para2[count];}

    i(stricmp(comm,ctu)==0){commno[count]=7;infle>> para1[count];infle>>para2[count];}

    i(stricmp(comm,ctd)==0){commno[count]=8;infle>> para1[count];infle>>para2[count];}

    i(stricmp(comm,rto)==0){commno[count]=9;infle>> para1[count];infle>>para2[count];}

    count=count+1;}infle.close();//Running The Programwhile(!kbhit()){}char choice;choice=getch();switch(choice)

    {case(char(59)):goto RUN;break;case(char(27)):openingmenu();break;}

    RUN:textcolor(YELLOW+BLINK);_setcursortype(_NOCURSOR);or(;;)

    {res=1;inputread();or(n=0;n=100){=0;te=r.Time();

    }r.Reset();displaystat();i(kbhit())

    {i ((in = getch())==\x1B)break;}

    }gotoxy(45,2);cprint(ESC =Stop and EXIT);

    gotoxy(70,2);cprint(Prog=HALT);while(!kbhit()){}choice=getch();switch(choice)

    {case(char(59)):goto RUN;break;case(char(27)):openingmenu();break;deault:openingmenu();}

    }//View/Edit Programvoid viewprog(){char lfle[15];char* comm;char tot[25];

    comm=Edit ;window(1,1,80,25);clrscr();paintscreen(4);border();textcolor(YELLOW);textbackground(4);gotoxy(20,4);cprint( View /Edit Controller File );gotoxy(20,5);cprint(====================

    ==);window(3,8,75,8);textcolor(YELLOW);clrscr();textcolor(CYAN);cprint(Enter the Logic File Name (New or Existing):(????.

    lgx) - );scan(%15s,&lfle);

    strcat(tot,comm);strcat(tot,lfle);system(tot);openingmenu();}//View I/P,O/P Statusvoid viewstat(){char in;int inpu;int inpuo;window(1,1,80,25);clrscr();paintscreen(4);border();textcolor(YELLOW);textbackground(4);gotoxy(20,4);cprint( Logic Controller Input Output Status );

    gotoxy(20,5);cprint(====================

    ==);gotoxy(25,6);cprint(Press ESC TO Exit Status Screen);gotoxy(20,8);textcolor(LIGHTRED);cprint(Controller Inputs:);gotoxy(20,9);cprint(==================);gotoxy(20,11);cprint(Input # 1(I1):);gotoxy(20,12);cprint(Input # 2(I2):);gotoxy(20,13);

  • 7/28/2019 Temp-Indicator Using AT89C52

    9/12

    c o n s t r u c t i o n

    electronics for you July 2004

    cprint(Input # 3(I3):);gotoxy(20,14);cprint(Input # 4(I4):);gotoxy(20,15);cprint(Input # 5(I5):);gotoxy(20,17);textcolor(CYAN);cprint(Controller Outputs);gotoxy(20,18);cprint(==================);

    gotoxy(20,20);cprint(Output # 1(O1):);gotoxy(20,21);cprint(Output # 2(O2):);gotoxy(20,22);cprint(Output # 3(O3):);gotoxy(20,23);cprint(Output # 4(O4):);gotoxy(40,11);cprint(Output # 5(O5):);gotoxy(40,12);cprint(Output # 6(O6):);gotoxy(40,13);cprint(Output # 7(O7):);gotoxy(40,14);cprint(Output # 8(O8):);_setcursortype(_NOCURSOR);or(;;)

    {

    //can inpuinpu=inp(0x379);i ((inpu & 8)==0){gotoxy(35,11);textcolor(GREEN);

    cprint(ON );}i ((inpu & 8)==8){gotoxy(35,11);textcolor(YELLOW);

    cprint(OFF);}i ((inpu & 16)==0){gotoxy(35,12);textcolor(GREEN);

    cprint(ON );}i ((inpu & 16)==16){gotoxy(35,12);textcolor(YELLOW);

    cprint(OFF);}i ((inpu & 32)==0){gotoxy(35,13);textcolor(GREEN);

    cprint(ON );}i ((inpu & 32)==32){gotoxy(35,13);textcolor(YELLOW);

    cprint(OFF);}i ((inpu & 64)==0){gotoxy(35,14);textcolor(GREEN);

    cprint(ON );}i ((inpu & 64)==64){gotoxy(35,14);textcolor(YELLOW);

    cprint(OFF);}i ((inpu & 128)==128){gotoxy(35,15);textcolor(GREEN);

    cprint(ON );}i ((inpu & 128)==0){gotoxy(35,15);textcolor(YELLOW);

    cprint(OFF);}//scan outputsinpuo=inp(0x378);i ((inpuo & 1)==1){gotoxy(36,20);textcolor(GREEN);

    cprint(ON );}i ((inpuo & 1)==0){gotoxy(36,20);textcolor(YELLOW);

    cprint(OFF);}i ((inpuo & 2)==2){gotoxy(36,21);textcolor(GREEN);

    cprint(ON );}i ((inpuo & 2)==0){gotoxy(36,21);textcolor(YELLOW);

    cprint(OFF);}i ((inpuo & 4)==4){gotoxy(36,22);textcolor(GREEN);

    cprint(ON );}i ((inpuo & 4)==0){gotoxy(36,22);textcolor(YELLOW);

    cprint(OFF);}i ((inpuo & 8)==8){gotoxy(36,23);textcolor(GREEN);

    cprint(ON );}

    i ((inpuo & 8)==0){gotoxy(36,23);textcolor(YELLOW);cprint(OFF);}

    i ((inpuo & 16)==16){gotoxy(56,11);textcolor(GREEN);cprint(ON );}

    i ((inpuo & 16)==0){gotoxy(56,11);textcolor(YELLOW);cprint(OFF);}

    i ((inpuo & 32)==32){gotoxy(56,12);textcolor(GREEN);cprint(ON );}

    i ((inpuo & 32)==0){gotoxy(56,12);textcolor(YELLOW);cprint(OFF);}

    i ((inpuo & 64)==64){gotoxy(56,13);textcolor(GREEN);cprint(ON );}

    i ((inpuo & 64)==0){gotoxy(56,13);textcolor(YELLOW);cprint(OFF);}

    i ((inpuo & 128)==128){gotoxy(56,14);textcolor(GREEN);

    cprint(ON );}i ((inpuo & 128)==0){gotoxy(56,14);textcolor(YELLOW);

    cprint(OFF);}i(kbhit())

    {i ((in = getch())==\x1B)break;

    }}

    openingmenu();}

    //Force Outputsvoid orceout(){char cho;char in;window(1,1,80,25);clrscr();paintscreen(4);border();textcolor(YELLOW);textbackground(4);gotoxy(25,3);cprint( Force Controller Outputs );gotoxy(25,4);cprint(====================

    ==);gotoxy(10,8);cprint(Output # 1- F1);gotoxy(10,9);

    cprint(Output # 2- F2);gotoxy(10,10);cprint(Output # 3- F3);gotoxy(10,11);cprint(Output # 4- F4);gotoxy(10,12);cprint(Output # 5- F5);gotoxy(10,13);cprint(Output # 6- F6);gotoxy(10,14);cprint(Output # 7- F7);gotoxy(10,15);cprint(Output # 8- F8);gotoxy(30,7);cprint(Output Status>>);gotoxy(30,18);cprint(ESC=Exit to Main..);_setcursortype(_NOCURSOR);or(;;)

    {while(!kbhit()){textcolor(LIGHTRED);outp(0x378,0);gotoxy(35,8);cprint(OFF);gotoxy(35,9);cprint(OFF);gotoxy(35,10);cprint(OFF);gotoxy(35,11);cprint(OFF);gotoxy(35,12);cprint(OFF);gotoxy(35,13);cprint(OFF);gotoxy(35,14);cprint(OFF);

    gotoxy(35,15);cprint(OFF);}

    cho=getch();textcolor(GREEN);

    i(cho==(char(59))){outp(0x378,1);gotoxy(35,8);cprint( ON);};

    i(cho==(char(60))){outp(0x378,2);gotoxy(35,9);cprint( ON);};

    i(cho==(char(61))){outp(0x378,4);gotoxy(35,10);cprint( ON);};

    i(cho==(char(62))){outp(0x378,8);gotoxy(35,11);cprint( ON);};

    i(cho==(char(63))){outp(0x378,16);gotoxy(35,12);c

    print( ON);};i(cho==(char(64))){outp(0x378,32);gotoxy(35,13);c

    print( ON);};i(cho==(char(65))){outp(0x378,64);gotoxy(35,14);c

    print( ON);};i(cho==(char(66))){outp(0x378,128);gotoxy(35,15);

    cprint( ON);};i(cho==(char(27))){openingmenu();};delay(100);

    }

    }//Help Utilityvoid helpu(){window(1,1,80,25);clrscr();paintscreen(9);border();textbackground(LIGHTBLUE);textcolor(YELLOW);gotoxy(25,5);cprint(==M A I N H E L P M E N U==);gotoxy(25,6);cprint(++++++++++++++++++++

    +);textcolor(LIGHTRED);gotoxy(25,8);cprint(F1 >- Help on Running a Logic Program);

    gotoxy(25,10);cprint(F2 >- Help on Viewing/Editing a Logic Pro-

    gram);gotoxy(25,12);cprint(F3 >- Help on Viewing Input/Output Status);gotoxy(25,14);cprint(F4 >- Help on Force Outputs);gotoxy(25,16);cprint(F5 >- About This Program);gotoxy(25,18);cprint(ESC >- Return to Main);HELPCHOICE:while(!kbhit()){}char userchoiceh=getch();switch(userchoiceh){case (char(59)):{textcolor(LIGHTRED);displayhelp(

    HELPS.PG1);}break;

    case (char(60)):{textcolor(LIGHTGREEN);displayhelp(HELPS.PG2);}break;

    case (char(61)):{textcolor(LIGHTCYAN);displayhelp(HELPS.PG3);}break;

    case (char(62)):{textcolor(YELLOW);displayhelp (HELPS.PG4);}break;

    case (char(63)):{textcolor(LIGHTMAGENTA);displayhelp(HELPS.PG5);}break;

    case (char(27)):openingmenu();break;deault:goto HELPCHOICE;}

    getch();}//Exit To DOSvoid exiter(){window(1,1,80,25);clrscr();

    paintscreen(9);border();textcolor(YELLOW+BLINK);textbackground(9);gotoxy(25,10);cprint(Exiting to DOS.....);delay(2000);textcolor(YELLOW);clrscr();exit(1);}//Logic Controller Commands//Series Contactsvoid ser(int inputno){

  • 7/28/2019 Temp-Indicator Using AT89C52

    10/12

    c o n s t r u c t i o n

    electronics for youJuly 2004

    int addr;switch(inputno)

    {case 1:addr=I1;break;case 2:addr=I2;break;case 3:addr=I3;break;case 4:addr=I4;break;case 5:addr=I5;break;case 6:addr=NI1;break;case 7:addr=NI2;break;

    case 8:addr=NI3;break;case 9:addr=NI4;break;case 10:addr=NI5;break;case 11:addr=O1;break;case 12:addr=O2;break;case 13:addr=O3;break;case 14:addr=O4;break;case 15:addr=O5;break;case 16:addr=O6;break;case 17:addr=O7;break;case 18:addr=O8;break;case 19:addr=NO1;break;case 20:addr=NO2;break;case 21:addr=NO3;break;case 22:addr=NO4;break;case 23:addr=NO5;break;case 24:addr=NO6;break;case 25:addr=NO7;break;case 26:addr=NO8;break;

    case 27:addr=CDN1;break;case 28:addr=CDN2;break;case 29:addr=CDN3;break;case 30:addr=CDN4;break;case 31:addr=CDN5;break;case 32:addr=~CDN1;break;case 33:addr=~CDN2;break;case 34:addr=~CDN3;break;case 35:addr=~CDN4;break;case 36:addr=~CDN5;break;case 37:addr=CODN1;break;case 38:addr=CODN2;break;case 39:addr=CODN3;break;case 40:addr=CODN4;break;case 41:addr=CODN5;break;case 42:addr=~CODN1;break;case 43:addr=~CODN2;break;case 44:addr=~CODN3;break;case 45:addr=~CODN4;break;

    case 46:addr=~CODN5;break;case 47:addr=TEN1;break;case 48:addr=TEN2;break;case 49:addr=TEN3;break;case 50:addr=TEN4;break;case 51:addr=TEN5;break;case 52:addr=~TEN1;break;case 53:addr=~TEN2;break;case 54:addr=~TEN3;break;case 55:addr=~TEN4;break;case 56:addr=~TEN5;break;case 57:addr=TDN1;break;case 58:addr=TDN2;break;case 59:addr=TDN3;break;case 60:addr=TDN4;break;case 61:addr=TDN5;break;case 62:addr=~TDN1;break;case 63:addr=~TDN2;break;case 64:addr=~TDN3;break;

    case 65:addr=~TDN4;break;case 66:addr=~TDN5;break;case 67:addr=RTDN;break;case 68:addr=~RTDN;break;}

    res=res&addr;}//Parallel Contactsvoid par(int inputno){int addr;switch(inputno)

    {case 1:addr=I1;break;case 2:addr=I2;break;

    case 3:addr=I3;break;case 4:addr=I4;break;case 5:addr=I5;break;case 6:addr=NI1;break;case 7:addr=NI2;break;case 8:addr=NI3;break;case 9:addr=NI4;break;case 10:addr=NI5;break;case 11:addr=O1;break;case 12:addr=O2;break;

    case 13:addr=O3;break;case 14:addr=O4;break;case 15:addr=O5;break;case 16:addr=O6;break;case 17:addr=O7;break;case 18:addr=O8;break;case 19:addr=NO1;break;case 20:addr=NO2;break;case 21:addr=NO3;break;case 22:addr=NO4;break;case 23:addr=NO5;break;case 24:addr=NO6;break;case 25:addr=NO7;break;case 26:addr=NO8;break;case 27:addr=CDN1;break;case 28:addr=CDN2;break;case 29:addr=CDN3;break;case 30:addr=CDN4;break;case 31:addr=CDN5;break;

    case 32:addr=~CDN1;break;case 33:addr=~CDN2;break;case 34:addr=~CDN3;break;case 35:addr=~CDN4;break;case 36:addr=~CDN5;break;case 37:addr=CODN1;break;case 38:addr=CODN2;break;case 39:addr=CODN3;break;case 40:addr=CODN4;break;case 41:addr=CODN5;break;case 42:addr=~CODN1;break;case 43:addr=~CODN2;break;case 44:addr=~CODN3;break;case 45:addr=~CODN4;break;case 46:addr=~CODN5;break;case 47:addr=TEN1;break;case 48:addr=TEN2;break;case 49:addr=TEN3;break;case 50:addr=TEN4;break;

    case 51:addr=TEN5;break;case 52:addr=~TEN1;break;case 53:addr=~TEN2;break;case 54:addr=~TEN3;break;case 55:addr=~TEN4;break;case 56:addr=~TEN5;break;case 57:addr=TDN1;break;case 58:addr=TDN2;break;case 59:addr=TDN3;break;case 60:addr=TDN4;break;case 61:addr=TDN5;break;case 62:addr=~TDN1;break;case 63:addr=~TDN2;break;case 64:addr=~TDN3;break;case 65:addr=~TDN4;break;case 66:addr=~TDN5;break;case 67:addr=RTDN;break;case 68:addr=~RTDN;break;}

    res=res|addr;}// Outputsvoid ope(int outputno){i(res==1)

    {switch(outputno)

    {case 1:O1=1;break;case 2:O2=1;break;case 3:O3=1;break;case 4:O4=1;break;case 5:O5=1;break;case 6:O6=1;break;

    case 7:O7=1;break;case 8:O8=1;break;

    }}

    i(res==0){switch(outputno)

    {case 1:O1=0;break;case 2:O2=0;break;

    case 3:O3=0;break;case 4:O4=0;break;case 5:O5=0;break;case 6:O6=0;break;case 7:O7=0;break;case 8:O8=0;break;

    }}

    res=1;}//latched outputvoid opl(int outputno){i(res==1)

    {switch(outputno)

    {case 1:O1=1;break;case 2:O2=1;break;

    case 3:O3=1;break;case 4:O4=1;break;case 5:O5=1;break;case 6:O6=1;break;case 7:O7=1;break;case 8:O8=1;break;

    }}

    res=1;}//Output Unlatchvoid opu(int outputno){i(res==1)

    {switch(outputno)

    {case 1:O1=0;break;case 2:O2=0;break;

    case 3:O3=0;break;case 4:O4=0;break;case 5:O5=0;break;case 6:O6=0;break;case 7:O7=0;break;case 8:O8=0;break;

    }}

    res=1;}//Timer Functionint tmr(int tno,int timeset){switch(tno){case(1):T1=timeset;break;case(2):T2=timeset;break;case(3):T3=timeset;break;case(4):T4=timeset;break;

    case(5):T5=timeset;break;}i(res==1)

    {switch(tno)

    {case(1):i(tmrscan1==0){frst1=time(NULL);tmrscan1

    =1;};break;case(2):i(tmrscan2==0){frst2=time(NULL);tmrscan2

    =1;};break;case(3):i(tmrscan3==0){frst3=time(NULL);tmrscan3

    =1;};break;case(4):i(tmrscan4==0){frst4=time(NULL);tmrscan4

    =1;};break;case(5):i(tmrscan1==0){frst1=time(NULL);tmrscan1

  • 7/28/2019 Temp-Indicator Using AT89C52

    11/12

    c o n s t r u c t i o n

    electronics for you July 2004

    =1;};break;}

    switch(tno){

    case(1):{second1=time(NULL);};break;case(2):{second2=time(NULL);};break;case(3):{second3=time(NULL);};break;case(4):{second4=time(NULL);};break;case(5):{second5=time(NULL);};break;

    }

    switch(tno){case(1):i(TDN1!=1){TEN1=1,TACC1=second1-

    frst1;};break;case(2):i(TDN2!=1){TEN2=1;TACC2=second2-

    frst2;};break;case(3):i(TDN3!=1){TEN3=1;TACC3=second3-

    frst3;};break;case(4):i(TDN4!=1){TEN4=1;TACC4=second4-

    frst4;};break;case(5):i(TDN5!=1){TEN5=1;TACC5=second5-

    frst5;};break;}

    switch(tno){case(1):i(ditime(second1,irst1)==T1){TDN1=1;};

    break;

    case(2):i(ditime(second2,irst2)==T2){TDN2=1;};break;

    case(3):i(ditime(second3,irst3)==T3){TDN3=1;};break;

    case(4):i(ditime(second4,irst4)==T4){TDN4=1;};break;

    case(5):i(ditime(second5,irst5)==T5){TDN5=1;};break;

    }

    }

    i(res==0){

    switch(tno){

    case(1):{TEN1=0;TACC1=0;tmrscan1=0;TDN1=0;};break;

    case(2):{TEN2=0;TACC2=0;tmrscan2=0;TDN2=0;};break;

    case(3):{TEN3=0;TACC3=0;tmrscan3=0;TDN3=0;};break;

    case(4):{TEN4=0;TACC4=0;tmrscan4=0;TDN4=0;};break;

    case(5):{TEN5=0;TACC5=0;tmrscan5=0;TDN5=0;};break;

    }

    }}//Up Counterint ctu(int cno,int countset){switch(cno){case(1):C1=countset;break;case(2):C2=countset;break;

    case(3):C3=countset;break;case(4):C4=countset;break;case(5):C5=countset;break;}i(res==1&&risingedge==0)

    {switch(cno)

    {case(1):i(CDN1!=1){CACC1=CACC1+1;};break;case(2):i(CDN2!=1){CACC2=CACC2+1;};break;case(3):i(CDN3!=1){CACC3=CACC3+1;};break;case(4):i(CDN4!=1){CACC4=CACC4+1;};break;case(5):i(CDN1!=1){CACC5=CACC5+1;};break;

    }risingedge=1;

    }i(res==0&&risingedge==1)risingedge=0;

    switch(cno){case(1):i(CACC1==C1)CDN1=1;break;case(2):i(CACC2==C2)CDN2=1;break;case(3):i(CACC3==C3)CDN3=1;break;case(4):i(CACC4==C4)CDN4=1;break;case(5):i(CACC5==C5)CDN5=1;;break;

    }i(countset==0&&res==1){switch(cno)

    {case(1):{CACC1=0;CDN1=0;};break;case(2):{CACC2=0;CDN2=0;};break;case(3):{CACC3=0;CDN3=0;};break;case(4):{CACC4=0;CDN4=0;};break;case(5):{CACC5=0;CDN5=0;};break;

    }}

    }//Down Counterint ctd(int cno,int countset){switch(cno){

    case(1):{CO1=countset;};break;case(2):{CO2=countset;};break;case(3):{CO3=countset;};break;case(4):{CO4=countset;};break;case(5):{CO5=countset;};break;}i(res==1&&risingedge==0)

    {switch(cno)

    {case(1):i(CODN1!=1){cd1=cd1+1;COACC1=CO1-

    cd1;};break;case(2):i(CODN2!=1){cd2=cd2+1;COACC2=CO2-

    cd2;};break;case(3):i(CODN3!=1){cd3=cd3+1;COACC3=CO3-

    cd3;};break;case(4):i(CODN4!=1){cd4=cd4+1;COACC4=CO4-

    cd4;};break;case(5):i(CODN3!=1){cd5=cd5+1;COACC5=CO5-

    cd5;};break;}

    risingedge=1;}

    i(res==0&&risingedge==1)risingedge=0;

    switch(cno){case(1):i(CO1==cd1)CODN1=1;break;case(2):i(CO2==cd2)CODN2=1;break;case(3):i(CO3==cd3)CODN3=1;break;case(4):i(CO4==cd4)CODN4=1;break;case(5):i(CO5==cd5)CODN5=1;;break;

    }i(countset==0&&res==1){switch(cno)

    {case(1):{COACC1=0;CODN1=0;};break;

    case(2):{COACC2=0;CODN2=0;};break;case(3):{COACC3=0;CODN3=0;};break;case(4):{COACC4=0;CODN4=0;};break;case(5):{COACC5=0;CODN5=0;};break;

    }}

    }//Real Time Outputint rto(int hourr,int minn){int hr,mn;i(res==1){gettime(&t);

    i(hourr==t.ti_hour && minn==t.ti_min){RTDN=1;}i(hourr==0 && minn==0){RTDN=0;}

    }

    }//Reading From And Sending Outputsvoid inputread(){int inpval;inpval=inp(0x379);i((inpval&8)==0)I1=1;i((inpval&8)==8)I1=0;i((inpval&16)==0)I2=1;i((inpval&16)==16)I2=0;i((inpval&32)==0)I3=1;i((inpval&32)==32)I3=0;i((inpval&64)==0)I4=1;i((inpval&64)==64)I4=0;i((inpval&128)==0)I5=0;i((inpval&128)==128)I4=1;NI1=~I1;

    NI2=~I2;NI3=~I3;NI4=~I4;NI5=~I5;NO1=~O1;NO2=~O2;NO3=~O3;NO4=~O4;NO5=~O5;NO6=~O6;NO7=~O7;NO8=~O8;}//Sending Output To The Portvoid setoutputs(){int outval;outval=1*O1+2*O2+4*O3+8*O4+16*O5+32*O6+6

    4*O7+128*O8;

    outp(0x378,outval);}//Display Status On Screenvoid displaystat(){textcolor(YELLOW);gotoxy(25,8);cprint(%d,I1);gotoxy(25,9);cprint(%d,I2);gotoxy(25,10);cprint(%d,I3);gotoxy(25,11);cprint(%d,I4);gotoxy(25,12);cprint(%d,I5);gotoxy(26,15);cprint(%d,O1);gotoxy(26,16);

    cprint(%d,O2);gotoxy(26,17);cprint(%d,O3);gotoxy(26,18);cprint(%d,O4);gotoxy(26,19);cprint(%d,O5);gotoxy(26,20);cprint(%d,O6);gotoxy(26,21);cprint(%d,O7);gotoxy(26,22);cprint(%d,O8);gotoxy(55,5);cprint(%3d,C1);

  • 7/28/2019 Temp-Indicator Using AT89C52

    12/12

    c o n s t r u c t i o n

    electronics for youJuly 2004

    gotoxy(55,6);cprint(%3d,C2);gotoxy(55,7);cprint(%3d,C3);gotoxy(55,8);cprint(%3d,C4);gotoxy(55,9);cprint(%3d,C5);gotoxy(62,5);cprint(%3d,CACC1);

    gotoxy(62,6);cprint(%3d,CACC2);gotoxy(62,7);cprint(%3d,CACC3);gotoxy(62,8);cprint(%3d,CACC4);gotoxy(62,9);cprint(%3d,CACC5);gotoxy(68,5);cprint(%d,CDN1);gotoxy(68,6);cprint(%d,CDN2);gotoxy(68,7);cprint(%d,CDN3);gotoxy(68,8);cprint(%d,CDN4);gotoxy(68,9);cprint(%d,CDN5);gotoxy(55,12);

    cprint(%3d,CO1);gotoxy(55,13);cprint(%3d,CO2);gotoxy(55,14);cprint(%3d,CO3);gotoxy(55,15);cprint(%3d,CO4);gotoxy(55,16);cprint(%3d,CO5);gotoxy(62,12);cprint(%3d,COACC1);gotoxy(62,13);cprint(%3d,COACC2);gotoxy(62,14);cprint(%3d,COACC3);gotoxy(62,15);

    cprint(%3d,COACC4);gotoxy(62,16);cprint(%3d,COACC5);gotoxy(68,12);cprint(%d,CODN1);gotoxy(68,13);cprint(%d,CODN2);gotoxy(68,14);cprint(%d,CODN3);gotoxy(68,15);

    cprint(%d,CODN4);gotoxy(68,16);cprint(%d,CODN5);gotoxy(49,19);cprint(%d,TEN1);gotoxy(49,20);cprint(%d,TEN2);gotoxy(49,21);cprint(%d,TEN3);gotoxy(49,22);cprint(%d,TEN4);gotoxy(49,23);cprint(%d,TEN5);gotoxy(57,19);cprint(%3d,T1);gotoxy(57,20);cprint(%3d,T2);gotoxy(57,21);cprint(%3d,T3);

    gotoxy(57,22);cprint(%3d,T4);gotoxy(57,23);cprint(%3d,T5);gotoxy(64,19);cprint(%3d,TACC1);gotoxy(64,20);cprint(%3d,TACC2);gotoxy(64,21);cprint(%3d,TACC3);gotoxy(64,22);cprint(%3d,TACC4);gotoxy(64,23);cprint(%3d,TACC5);gotoxy(70,19);

    cprint(%d,TDN1);gotoxy(70,20);cprint(%d,TDN2);gotoxy(70,21);cprint(%d,TDN3);gotoxy(70,22);cprint(%d,TDN4);gotoxy(70,23);cprint(%d,TDN5);gotoxy(56,24);

    cprint(%d,RTDN);gotoxy(27,23);cprint(%.2,te*1000);}//Help File Displayvoid displayhelp(char helpflename[10]){stream infle;textbackground(BLACK);window(1,1,80,25);const int max=80;char buer[max];clrscr();infle.open(helpflename,ios::in);i(infle.ail()){window(10,8,70,9);textcolor(YELLOW+BLINK);clrscr();

    cprint(.....Help not Available or Error Opening File ...\n\r..Press any Key to Return to Main.....);

    getch();openingmenu();}while(!infle.eo()){infle.getline(buer,max);cout