S4C + PC serial communication
i have a S4C controller with a IRB1400 M97A and i want read information from PC by RS232.
i allready instaled Advanced Functions but i can't create instruction like VAR or OPEN or etc.
Someone can help me with sequence to create simple program to read from RS232?
thanks,
Emanuel Machado
Answers
-
Hello,
here are some examples to read data from a serial port.VAR iodev deRS232;
Open "sio1:", deRS232\Read;
stData:=ReadStr(deRS232\Time:=30);
nData:=ReadNum(deRS232\Time:=30);
Close deRS232;
You could aslo read and write binary data via the same channel:
Sending "Hello world" to the partner.
VAR iodev deRS232;
VAR num nOutBuffer{20};
VAR num nInput;
Open "sio1:", deRS232\Bin;
nOutBuffer {1} := 5; !( ENQ )
WriteBin deRS232, nOutBuffer, 1;
nInput := ReadBin (deRS232\Time:= 0.1);
IF nInput = 6 THEN !( ACK )
nOutBuffer {1} := 2; ! ( STX )
nOutBuffer {2} := 72; !( ’H’ )
nOutBuffer {3} := 101; ! ( ’e’ )
nOutBuffer {4} := 108; !( ’l’ )
nOutBuffer {5} := 108; !( ’l’ )
nOutBuffer {6} := 111; !( ’o’ )
nOutBuffer {7} := 32; !( ’ ’ )
nOutBuffer {8} := StrToByte("w"\Char); !( ’w’ )
nOutBuffer {9} := StrToByte("o"\Char); !( ’o’ )
nOutBuffer {10} := StrToByte("r"\Char); !( ’r’ )
nOutBuffer {11} := StrToByte("l"\Char); !( ’l’ )
nOutBuffer {12} := StrToByte("d"\Char); !( ’d’ )
nOutBuffer {13} := 3; ( ETX )
WriteBin deRS232, nOutBuffer, 13;
ENDIF
Close deRS232;
Besrt regards
Micky
0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 800 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings