Hello, as the title says, I'm using a IFM CR1081 panel, and write string array to an cvs file. But I can't seem to find out how to read it from the storage of the panel. I do not wish to split the text line into several lines, only 1. Using Timestamp AND 'Sensor ' AND a number that indicates which sensor that has trigged.
Read/Write to the panel from the USB flash drive is ready, the only thing that I need is to actually read the *.cvs file that I recieve from the USB-storage.
So, writing from the panel into *.cvs file, to the USB-Flash drive, then automatically back to the panel, and read it and show it in a table is what I want to do.
IFxStartTHENÂ Â FileIdent:=SysFileOpen(FileName:=sFilename,Mode:='r');Â Â IFfileident<>0THENÂ Â Â Â SysFileRead(File:=Fileident,Buffer:=ADR(rawdata),Size:=SIZEOF(rawdata));Â Â Â Â filesizev:=SysFileGetSize(FileName:=sFilename);Â Â Â Â IFfilesizev>gc_RawDataSizeTHENÂ Â Â Â Â Â filesizev:=gc_RawDataSize;Â Â Â Â END_IFÂ Â Â Â SysFileClose(File:=fileident);(*thisfunctionisblocking*)Â Â ELSEÂ Â Â Â sStatus:='File does not exist';Â Â Â Â xStart:=FALSE;Â Â Â Â RETURN;(*nosuchfileavailable*)Â Â END_IF(*copydatatotypDataarray*)Â Â startposition:=0;Â Â i:=0;Â Â FORj:=1TOiMaxParamsDOÂ Â Â Â (*FirstvalueindatasetisoftypeDT.ThefollowingvalueisseperatedbybSeperator*)Â Â Â Â WHILErawdata[startposition+i]<>bSeperatorDOÂ Â Â Â Â Â i:=i+1;Â Â Â Â END_WHILEÂ Â Â Â rawdata[startposition+i]:=0;Â Â Â Â MEMCPY(pSourceAddress:=ADR(rawdata[startposition]),pDestinationAddress:=ADR(tempstring),BytesToCopy:=i+1);Â Â Â Â typdata[j].sDescription:=tempstring;Â Â Â Â startposition:=startposition+i+1;Â Â Â Â i:=0;Â Â Â Â (*Theparametervaluesareoftypeword.ThefollowingvaluesareseperatedbybSeperator*)Â Â Â Â FORk:=1TOgc_ParameterCount-1DOÂ Â Â Â Â Â WHILErawdata[startposition+i]<>bSeperatorDOÂ Â Â Â Â Â Â Â i:=i+1;Â Â Â Â Â Â END_WHILEÂ Â Â Â Â Â rawdata[startposition+i]:=0;Â Â Â Â Â Â MEMCPY(pSourceAddress:=ADR(rawdata[startposition]),pDestinationAddress:=ADR(tempstring),BytesToCopy:=i+1);Â Â Â Â Â Â typdata[j].Parameter[k]:=STRING_TO_REAL(tempstring);Â Â Â Â Â Â startposition:=startposition+i+1;Â Â Â Â Â Â i:=0;Â Â Â Â END_FORÂ Â Â Â (*Copyingthelastparameterfromtypword.ThedatasetisterminatedbyCRLF*)Â Â Â Â WHILErawdata[startposition+i]<>bEndOfFileDOÂ Â Â Â Â Â i:=i+1;Â Â Â Â END_WHILEÂ Â Â Â rawdata[startposition+i]:=0;Â Â Â Â MEMCPY(pSourceAddress:=ADR(rawdata[startposition]),pDestinationAddress:=ADR(tempstring),BytesToCopy:=i+1);Â Â Â Â typdata[j].Parameter[k]:=STRING_TO_REAL(tempstring);Â Â Â Â startposition:=startposition+i+2;(*ThedatasetisterminatedbyCRLF(13,10)*)Â Â Â Â i:=0;Â Â END_FOR(*copydatatotypDataarrayfinished*)Â Â sStatus:='Data read OK';Â Â xStart:=FALSE;END_IF
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello, as the title says, I'm using a IFM CR1081 panel, and write string array to an cvs file. But I can't seem to find out how to read it from the storage of the panel. I do not wish to split the text line into several lines, only 1. Using Timestamp AND 'Sensor ' AND a number that indicates which sensor that has trigged.
Read/Write to the panel from the USB flash drive is ready, the only thing that I need is to actually read the *.cvs file that I recieve from the USB-storage.
So, writing from the panel into *.cvs file, to the USB-Flash drive, then automatically back to the panel, and read it and show it in a table is what I want to do.
https://www.youtube.com/watch?v=ovTJ5AZY22g
Found out an other way for my task, just made an array in the retain memory, and write it to usb too.