免费预览已结束,剩余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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 危险废物转运交接安全管控方案
- 图文店用电安全操作规程
- 岸桥司机安全操作规程
- 2026年煤田地质试题及答案解析
- 结缔组织病相关间质性肺病居家呼吸训练共识
- 2026学年湖南省醴陵市一年级数学期末自测模拟黑金考题详细参考解析详细答案和解析
- Oracle开发面试题及详细答案(实战版)
- 2026年心血管病学综合知识竞赛试题及答案解析
- 电炉炼钢工安全操作规程
- 医用气体终端安装调试方案
- 2026黑龙江人才周佳木斯市向阳区急需紧缺专业技术人才引进11人笔试备考试题及答案详解
- 军用关键软硬件自主可控产品名录(2025年V1 完整版)
- 2026年学法减分考核题库及答案
- 第4课《夺取解放战争的胜利》第1课时(教学设计)
- 高中英语听力话题分类训练-旅游观光
- 向2026年新客户介绍产品演示邀请函(8篇)
- GB/T 22187-2026建立人体测量数据库的一般要求
- 2026年4月自考15043中国近现代史纲要试题
- 2026年4月自考14443消费者行为学试题
- 单侧双通道内镜腰椎间盘摘除术护理配合
- (2025年)儿科住院医师《小儿结核病题库考点》考试题附答案
评论
0/150
提交评论