




免费预览已结束,剩余7页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
If youre really looking to learn about PLCs, you NEED our book.Your Personal PLC Tutor - A Guide to Understanding PLCsEasy to read and uses plain language! Get $FREE$ priority mail shipping too!You WILL be glad you did!Click Here now to order1: FC37 Thread Tools Display Modes April 28th, 2008, 03:28 AM #1 sapoleon MemberJoin Date: Aug 2003Location: still in IsraelPosts: 271 S7 bytes to DInt Hi.I have a new project, and its in siemens S7. I can say that Im having a hard time, because its my first project with S7.In the project, I read a Cognex camera through Profinet, I get a result, that is a numeric code in separate bytes. So. Its like a string.The thing is, that I have to send to an HMI this value like a DInt, and I dont have any idea on how to begin. I started looking for the IEC FC37 but it seems that I have to make a string out of the series of bytes that i get. I get the bytes in PIB261 to PIB269 (always 9 cyphers).I will appreciate if someone can point me in the direction on how to make a string from the bytes, so I can try the FC37 and convert it to a DInt.Thanks. _I am responsible for everything.except my very responsibility.J.P.Sartre Last edited by sapoleon; April 28th, 2008 at 03:33 AM. sapoleonView Public ProfileFind More Posts by sapoleonApril 28th, 2008, 04:05 AM #2 Bratt MemberJoin Date: Nov 2003Location: West SwedenPosts: 382 Create a new string in a datablock with 9 chars STRING9 then you can simply move the data from the input area. You will also need to initialize the actual value of the string either you can write 000000000 in the inital and actual value of the datablock or writeL 9T DB1.DBB1 /Byte containg current length of stringThe first two bytes of a string contains max length and current lengthHere i created a string named text STRING9 in db 1L PIB261T DB1.Text1 /If your string is named textL PIB262T DB1.Text2.CALL STRNG_DIS :=DB1.TextRET_VAL:=MD0 Last edited by Bratt; April 28th, 2008 at 04:19 AM. BrattView Public ProfileFind More Posts by BrattApril 28th, 2008, 04:16 AM #3 L DAR2,P#0.0 MemberJoin Date: Nov 2006Location: UKPosts: 2,095 Heres another example: L DAR2,P#0.0View Public ProfileFind More Posts by L DAR2,P#0.0April 28th, 2008, 04:33 AM #4 sapoleon MemberJoin Date: Aug 2003Location: still in IsraelPosts: 271 Thanks A LOT for the quick responses.I see that i have to take into account 2 extra bytes in the string for max length and used lenght.That is to say, that the string will be of 11 chars, but i still define it for 9 chars.In the method defined by Bratt, how can I access the two first bytes of the string? _I am responsible for everything.except my very responsibility.Absolut Like DB1.DBB 0 / MaxDB1.DBB1 /Current Or by using the pointer version like L D AR2,P#0.0 described but then you need to write in stl format.If its always nine chars you can create the datablock and write 000000000 in the inital and actual value of the string then you dont need to write anything in the length bytes. The 2 length bytes will always contain nine. Actually you only ned to write the zeros in actual value but its good to write it in the inital value aswell if someone decides to initziale the datablock in the future. Last edited by Bratt; April 28th, 2008 at 04:45 AM. 2:FC38String in Int. Was ist hier falsch ? Hallo,ich mchte einen String, der in einem DB Steht in eine INT wandeln.Der DB20 ist folgendermaen angelegt:COMMENT ARRAY0.1023CHARIn den Positionen 8, 9, 10 und 11 steht jeweils ein ASCII zeichen.z.B.4711Diese 4 Zeichen sollen nun in ein INT gewandelt werden.ICh habe hierzu ohne Erfolg folgenden Code probiert.Code: CALL BLKMOV SRCBLK :=P#DB20.DBX8.0 BYTE 4 / /RCV_DB_A.comment8 byte 4 RET_VAL:=#RetVal DSTBLK :=P#DB21.DBX0.0 BYTE 4 L 4 /4 Zeichen Lnge T DB21.DBB 0 /max T DB22.DBB 1 /aktuell CALL STRNG_I S :=DB21.IR_CODE_S /RCV_DB_A.HS_IR_CODE RET_VAL:=IR_NummerDer DB21 ist angelegt wie folgt:IR_CODE_S string20IR_Nummer ist global angelegt als INT.Ich bekomme aber imm eine 0 in IR_Nummer, obwohl beim betrachten des DB20 dort die Zeichen fr ca. 2 Sekunden stehen.Kann mir jemand helfen, bevor ich verzweifle.Danke.noeppkes . noeppkesffentliches Profil ansehenSuche alle Beitrge von noeppkes #2 05.10.2007, 20:32 Ralle Super-ModeratorRegistriert seit: 27.05.2004Ort: Thringen, die dunkle oder auch kalte HeimatBeitrge: 6.654 Abgegebene Danke: 93Erhielt 974 Danke fr 755 Beitrge Zitat:Zitat von noeppkes Hallo,ich mchte einen String, der in einem DB Steht in eine INT wandeln.Der DB20 ist folgendermaen angelegt:COMMENT ARRAY0.1023CHARIn den Positionen 8, 9, 10 und 11 steht jeweils ein ASCII zeichen.z.B.4711Diese 4 Zeichen sollen nun in ein INT gewandelt werden.ICh habe hierzu ohne Erfolg folgenden Code probiert.Code: CALL BLKMOV SRCBLK :=P#DB20.DBX8.0 BYTE 4 / /RCV_DB_A.comment8 byte 4 RET_VAL:=#RetVal DSTBLK :=P#DB21.DBX0.0 BYTE 4 L 4 /4 Zeichen Lnge T DB21.DBB 0 /max T DB22.DBB 1 /aktuell CALL STRNG_I S :=DB21.IR_CODE_S /RCV_DB_A.HS_IR_CODE RET_VAL:=IR_NummerDer DB21 ist angelegt wie folgt:IR_CODE_S string20IR_Nummer ist global angelegt als INT.Ich bekomme aber imm eine 0 in IR_Nummer, obwohl beim betrachten des DB20 dort die Zeichen fr ca. 2 Sekunden stehen.Kann mir jemand helfen, bevor ich verzweifle.Danke.noeppkes .Schreibfehler? _GruRalle. therere 10 kinds of people . those who understand binaries and those who dont . Ralleffentliches Profil ansehenBesuchen Sie die Homepage von Ralle!Suche alle Beitrge von Ralle #3 05.10.2007, 20:37 noeppkes Erfahrener BenutzerThemenstarter Registriert seit: 02.08.2006Beitrge: 135 Abgegebene Danke: 36Erhielt 1 Danke fr 1 Beitrag Schreibfehler ? Hallo,das verstehe ich jetzt nicht.Was meinst du damit.noeppkes . noeppkesffentliches Profil ansehenSuche alle Beitrge von noeppkes #4 05.10.2007, 20:38 Ralle Super-ModeratorRegistriert seit: 27.05.2004Ort: Thringen, die dunkle oder auch kalte HeimatBeitrge: 6.654 Abgegebene Danke: 93Erhielt 974 Danke fr 755 Beitrge Zitat:Zitat von noeppkes Hallo,das verstehe ich jetzt nicht.Was meinst du damit.noeppkes .Code:L 4T DB21.DBB 0 /maxT DB22.DBB 1 /aktuellDas hier! _GruRalle. therere 10 kinds of people . those who understand binaries and those who dont . Ralleffentliches Profil ansehenBesuchen Sie die Homepage von Ralle!Suche alle Beitrge von Ralle #5 05.10.2007, 20:39 zotos Erfahrener BenutzerRegistriert seit: 07.03.2004Ort: SdwestpfalzBeitrge: 3.492 Abgegebene Danke: 629Erhielt 706 Danke fr 541 Beitrge Zitat:Zitat von noeppkes Hallo,das verstehe ich jetzt nicht.Was meinst du damit.noeppkes .Auf wie viele Datenbausteine ist denn der eine String verteilt?DatenBaustein 20, 21, 22 _SPS steht ja schlielich fr: Satire, Polemik und Sarkasmus.Aus gegebenem Anlass: Support gibt es nur noch hier im Forum oder im Chat. Kein Toolsupport via PN oder Telefon!So Long, and Thanks for All the FishGendert von zotos (05.10.2007 um 20:42 Uhr). zotosffentliches Profil ansehenSuche alle Beitrge von zotos #6 05.10.2007, 20:42 noeppkes Erfahrener BenutzerThemenstarter Registriert seit: 02.08.2006Beitrge: 135 Abgegebene Danke: 36Erhielt 1 Danke fr 1 Beitrag String in INT wandeln. Hallo Zotos,der DB20 wird direkt vom CP340 beschrieben.Dort steht mein Eingangsprotokoll.Un eben in den Bytes 8 . 11 (4 Stck) steht ein ASCII-String den ich eben in eine INT wandeln will.Ich hoffe ich konnte es vertndlich erklren.noeppkes . noeppkesffentliches Profil ansehenSuche alle Beitrge von noeppkes #7 05.10.2007, 20:44 zotos Erfahrener BenutzerRegistriert seit: 07.03.2004Ort: SdwestpfalzBeitrge: 3.492 Abgegebene Danke: 629Erhielt 706 Danke fr 541 Beitrge Was treibst Du dann mit dem DatenBaustein 22? Da sollte 21 stehen! _SPS steht ja schlielich fr: Satire, Polemik und Sarkasmus.Aus gegebenem Anlass: Support gibt es nur noch hier im Forum oder im Chat. Kein Toolsupport via PN oder Telefon!So Long, and Thanks for All the Fishzotosffentliches Profil ansehenSuche alle Beitrge von zotos #8 05.10.2007, 20:49 noeppkes Erfahrener BenutzerThemenstarter Registriert seit: 02.08.2006Beitrge: 135 Abgegebene Danke: 36Erhielt 1 Danke fr 1 Beitrag String in INT Hallo Zotos,ich bin leider noch ein purer Anfnger.Das mit dem DB22 habe ich bersehen.Ansonsten wrde es funktionieren ?(Ich qule mich schon seit mehreren Stunden damit rum)noeppkes . noeppkesffentliches Profil ansehenSuche alle Beitrge von noeppkes #9 05.10.2007, 20:52 zotos Erfahrener BenutzerRegistriert seit: 07.03.2004Ort: SdwestpfalzBeitrge: 3.492 Abgegebene Danke: 629Erhielt 706 Danke fr 541 Beitrge Ich habe keine Ahnung probiere es mal aus. An
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 国家基本公共卫生服务规范第三考核试卷及答案完整版
- 2025东莞版高净值人士离婚财产分割协议书
- 胆茶碱受体机制-洞察及研究
- 2025房地产并购贷款合同
- 2025年度电力工程电工技术支持聘任合同
- 2025第二实验小学学生宿舍管理与维修服务合同
- 2025年企业人事经理高端定制服务合同
- 2025版私单育儿嫂服务合同综合育儿管理与辅导协议
- 2025年度土地招标建房与智慧城市交通管理系统合作合同
- 2025第五章合同担保共51张的养老保险产品销售风险控制协议
- 改造雨水篦子施工方案
- 中国新能源汽车电池托盘行业市场全景调研及前景战略研判报告
- 化学实验室试剂采购与管理考核试卷
- DB11T 334.5-2019 公共场所中文标识英文译写规范 第5部分:医疗卫生
- TB10104-2003 铁路工程水质分析规程
- 突发环境事件应急预案编制要点及风险隐患排查重点课件
- 14J936变形缝建筑构造
- 住院医师全科医师规范化培训24小时负责工作制实施细则
- 肿瘤放射治疗质量控制规范
- 保育员开学前培训内容
- 青少年药物滥用的影响因素与预防方法
评论
0/150
提交评论