
B |
Sample Programs
H Sample C Program for Turbo C/C++ DEMO1.C
This program is provided
#include <dos.h> #include <stdio.h> #include ªMCROCOMM.Cº
int | port; |
int | memtype; |
int | addr; |
int | count; |
char | buf [16]; |
int | temp; |
int | z,x,y,value1, value2 = 0; |
main ( )
{
while (z == 0)
{
port = 2 ; /* COM3 */ memtype = 2;
addr = 1; count = 16;
temp = TCL_Rreg(port,memtype,addr,count,buf); x = buf[0];
y = buf[1];
value1 = (x & 0x00ff) + ((y & 0x00ff) <<8) ; x = buf[2];
y = buf[3];
value2 = (x & 0x00ff) + ((y & 0x00ff) <<8) ;
printf(ªRegister 1, 2 values are %d %d \nº, value1, value2);
}
return (0);
}
GFK±0804B | Appendix B Micro PLC Protocol |