




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、If you're really looking to learn about PLCs, you NEED our book."Your Personal PLC Tutor - A Guide to Understanding PLCs"Easy 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 Disp
2、lay Modes April 28th, 2008, 03:28 AM #1 sapoleon Member Join Date: Aug 2003Location: still in IsraelPosts: 271 S7 bytes to DInt Hi.I have a new project, and it's in siemens S7. I can say that I'm having a hard time, because it's my first project with S7.In the project, I read
3、 a Cognex camera through Profinet, I get a result, that is a numeric code in separate bytes. So. It's like a string.The thing is, that I have to send to an HMI this value like a DInt, and I don't have any idea on how to begin. I started looking for the IEC FC37 but it seems that I have to ma
4、ke 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
5、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 Member Join Date: Nov 2003Location: West SwedenPosts: 382 Create a new string in a datablock with 9 ch
6、ars 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
7、 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_DI"S :=DB1.TextRET_VAL:=MD0 Last edited by Bratt; April 28th, 2008 at 04:19 AM. BrattView Public Prof
8、ileFind More Posts by BrattApril 28th, 2008, 04:16 AM #3 L DAR2,P#0.0 Member Join Date: Nov 2006Location: UKPosts: 2,095 Here's another example: L DAR2,P#0.0View Public ProfileFind More Posts by L DAR2,P#0.0April 28th, 2008, 04:33 AM #4 sapoleon Member Join Date: Au
9、g 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
10、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 t
11、he 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
12、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 möchte einen String, der in einem DB Steht in eine INT wandeln.Der DB20 ist folgendermaßen angelegt:COMMENT ARRAY0.1023CHARI
13、n den Positionen 8, 9, 10 und 11 steht jeweils ein ASCII zeichen.z.B.'4''7''1''1'Diese 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&qu
14、ot;.comment8 byte 4 RET_VAL:=#RetVal DSTBLK :=P#DB21.DBX0.0 BYTE 4 L 4 /4 Zeichen Länge 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_Nummer"Der DB21 ist angelegt wie folgt:IR_CODE_S string20IR_Nummer
15、ist global angelegt als INT.Ich bekomme aber imm eine 0 in IR_Nummer, obwohl beim betrachten des DB20 dort die Zeichen für ca. 2 Sekunden stehen.Kann mir jemand helfen, bevor ich verzweifle.Danke.noeppkes . noeppkesÖffentliches Profil ansehenSuche alle Beiträge von noeppkes #2 &
16、#160; 05.10.2007, 20:32 Ralle Super-Moderator Ort: Thüringen, die dunkle oder auch kalte HeimatBeiträge: 6.654 Abgegebene Danke: 93Erhielt 974 Danke für 755 Beiträge Zitat:Zitat von noeppkes Hallo,ich möchte einen String, der in einem DB Steht in eine INT wandeln.Der DB
17、20 ist folgendermaßen angelegt:COMMENT ARRAY0.1023CHARIn den Positionen 8, 9, 10 und 11 steht jeweils ein ASCII zeichen.z.B.'4''7''1''1'Diese 4 Zeichen sollen nun in ein INT gewandelt werden.ICh habe hierzu ohne Erfolg folgenden Code probiert.Code: CALL "BLK
18、MOV" 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 Länge 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_Nummer"
19、Der 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 für ca. 2 Sekunden stehen.Kann mir jemand helfen, bevor ich verzweifle.Danke.noeppkes .Schreibfehler? _GrußRall
20、e. there're 10 kinds of people . those who understand binaries and those who don't . RalleÖffentliches Profil ansehenBesuchen Sie die Homepage von Ralle!Suche alle Beiträge von Ralle #3 05.10.2007, 20:37 noeppkes Erfahrener BenutzerThemenstarter Beiträ
21、;ge: 135 Abgegebene Danke: 36Erhielt 1 Danke für 1 Beitrag Schreibfehler ? Hallo,das verstehe ich jetzt nicht.Was meinst du damit.noeppkes . noeppkesÖffentliches Profil ansehenSuche alle Beiträge von noeppkes #4 05.10.2007, 20:38 Ralle Super-Moderator Ort: Thüri
22、ngen, die dunkle oder auch kalte HeimatBeiträge: 6.654 Abgegebene Danke: 93Erhielt 974 Danke für 755 Beiträge 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! _GrußRalle. there're
23、 10 kinds of people . those who understand binaries and those who don't . RalleÖffentliches Profil ansehenBesuchen Sie die Homepage von Ralle!Suche alle Beiträge von Ralle #5 05.10.2007, 20:39 zotos Erfahrener Benutzer Ort: SüdwestpfalzBeiträge: 3.492 Abgege
24、bene Danke: 629Erhielt 706 Danke für 541 Beiträge 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 schließlich für: Satire, Polemik und S
25、arkasmus.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 FishGeändert von zotos (05.10.2007 um 20:42 Uhr). zotosÖffentliches Profil ansehenSuche alle Beiträge von zotos #6 05.1
26、0.2007, 20:42 noeppkes Erfahrener BenutzerThemenstarter Beiträge: 135 Abgegebene Danke: 36Erhielt 1 Danke für 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 Stück) st
27、eht ein ASCII-String den ich eben in eine INT wandeln will.Ich hoffe ich konnte es vertändlich erklären.noeppkes . noeppkesÖffentliches Profil ansehenSuche alle Beiträge von noeppkes #7 05.10.2007, 20:44 zotos Erfahrener Benutzer Ort: SüdwestpfalzBeiträ
28、;ge: 3.492 Abgegebene Danke: 629Erhielt 706 Danke für 541 Beiträge Was treibst Du dann mit dem DatenBaustein 22? Da sollte 21 stehen! _SPS steht ja schließlich für: Satire, Polemik und Sarkasmus.Aus gegebenem Anlass: Support gibt es nur noch hier im Forum oder im Chat. Kein Tools
29、upport via PN oder Telefon!So Long, and Thanks for All the FishzotosÖffentliches Profil ansehenSuche alle Beiträge von zotos #8 05.10.2007, 20:49 noeppkes Erfahrener BenutzerThemenstarter Beiträge: 135 Abgegebene Danke: 36Erhielt 1 Danke für 1 Beitrag St
30、ring in INT Hallo Zotos,ich bin leider noch ein purer Anfänger.Das mit dem DB22 habe ich übersehen.Ansonsten würde es funktionieren ?(Ich quäle mich schon seit mehreren Stunden damit rum)noeppkes . noeppkesÖffentliches Profil ansehenSuche alle Beiträge von noeppkes #9 05.10.2007, 20:52 zotos Erfahrener Benutzer Ort: SüdwestpfalzBeiträge: 3.492 Abgegebene Danke: 629Erhielt 706 Danke für 541 Beiträge Ich habe keine Ahnung probiere es mal aus. Ansonsten hi
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 水疱抗炎药物研究-全面剖析
- 虚拟现实在电视中的应用-全面剖析
- 地球化学遥感技术-全面剖析
- 一年级数学学习习惯培养计划
- 2025-2025学年度数字化转型计划
- 石油钻井作业有限空间防范措施分析
- 城市交通建设进度及其安全保障措施
- 2025年学校少先队国际交流计划
- 脊髓功能恢复机制-全面剖析
- 跨境贸易便利化研究-全面剖析
- 2025-2030中国宠物行业市场发展分析及发展趋势与投资前景预测报告
- AGC-AVC培训课件教学课件
- 山洪灾害防御知识课件
- 决胜新高考·四川名优校联盟2025届高三4月联考英语+答案
- 宾馆卫生考试题及答案
- 殡葬法律法规试题及答案
- 带货主播职业发展路径与技能提升指南
- DB52/T 1212-2017 煤矿地面在用瓦斯泵及瓦斯泵站安全检查规范
- 境外道路货物运输应急预案
- 软件测试技术课程教学大纲
- 液压与气压传动完整版课件
评论
0/150
提交评论