Forrest Posted July 11, 2006 Report Share Posted July 11, 2006 Greetings: I have a Smart motor by animatics that has an internal encoder that rolls over on i32 integers. the encoder is 2000 counts / rev and when you are running at 3600 RPM that will roll over in about 5 hours. (i will be running almost continousely) I am taking continous readings thru the RS232 port at 38400 baud of the counts. I need to convert the counts to a continous up positive going reading, unless the motor reverses, than a down going reading. Can i convert the readings into a Extended precision variable ?? Thanks Forrest Quote Link to comment
crelf Posted July 11, 2006 Report Share Posted July 11, 2006 Can i convert the readings into a Extended precision variable? I don't think convert is quite the right word - but you can add / subtract your i32 input to / from an i64 that you're handling in LabVIEW (I don't know your architecture, but maybe hold the position in a shift register?) Can you post some example code so we can make more informed suggestions? Quote Link to comment
Chris Davis Posted July 11, 2006 Report Share Posted July 11, 2006 Greetings: I have a Smart motor by animatics that has an internal encoder that rolls over on i32 integers. the encoder is 2000 counts / rev and when you are running at 3600 RPM that will roll over in about 5 hours. (i will be running almost continousely) I am taking continous readings thru the RS232 port at 38400 baud of the counts. I need to convert the counts to a continous up positive going reading, unless the motor reverses, than a down going reading. Can i convert the readings into a Extended precision variable ?? Thanks Forrest Perhaps you can get by with an up / down indication rather than an absolute "count" of the motor position. An example code snippet or a better explanation of your end goal might be in order here. Quote Link to comment
Forrest Posted July 11, 2006 Author Report Share Posted July 11, 2006 Greetings: I just have the numbers coming in from the RS232. The software in the motor just uses Integer 32 , so the number in the motor rolls over. Example: 2,147,483,648 + 1 = -2,147,483,647 ; ( next count )= -2,127,483,646 ; (next count)=-2,127,483,645 ... etc. Now i want a variable (extended mode) 2,147,483,648 + 1 = 2,147,483,649 ; ( next count )= 2,127,483,650 ; (next count)=2,127,483,651 ... etc. (ie. to increase al the time with out a sign roll over) Thanks Forrest Quote Link to comment
Yair Posted July 11, 2006 Report Share Posted July 11, 2006 One of the properties of signed integers is that a substraction operation will still be the opposite of an addition operation. So, if you take each number and substract the previous number from it you will get the right amount even if the number rolled over. You can use this to increment your counter. Since you don't have 64 bit integers in LV, you will either have to use your own logic or one of the floating point representations. Quote Link to comment
crelf Posted July 11, 2006 Report Share Posted July 11, 2006 Since you don't have 64 bit integers in LV... C'mon yen - get with the times! (LabVIEW 8 at least) Quote Link to comment
Guillaume Lessard Posted July 11, 2006 Report Share Posted July 11, 2006 The following sort of logic should do the trick (replacing the "reading" controls by input from your motor, and assuming that you make sure to make a reading more often than it can possibly roll over): Of course in LV7 you don't have 64-bit integers for free, but you can either do them yourself with two 32-bit integers or use doubles; their mantissa has 53 bits of precision so you won't lose count for a good long time. Quote Link to comment
crelf Posted July 12, 2006 Report Share Posted July 12, 2006 Of course in LV7 you don't have 64-bit integers for free, but you can either do them yourself with two 32-bit integers or use doubles; their mantissa has 53 bits of precision so you won't lose count for a good long time. They are both valid options, but personally I'd go for the 2 x 32bit integers - it's a more elegant solution. Quote Link to comment
Yair Posted July 12, 2006 Report Share Posted July 12, 2006 C'mon yen - get with the times! (LabVIEW 8 at least) I know that, but... Quote Link to comment
crelf Posted July 12, 2006 Report Share Posted July 12, 2006 I know that, but... Ahhh - good point. Consider me appropriately chastized :headbang: Looks like Guillaume Lessard's yen's suggestions are going to be your best way out. Quote Link to comment
Yair Posted July 12, 2006 Report Share Posted July 12, 2006 Looks like Guillaume Lessard's suggestions are going to be your best way out. Since we're chastising, aren't those suggestions identical to mine? Quote Link to comment
crelf Posted July 12, 2006 Report Share Posted July 12, 2006 Since we're chastising, aren't those suggestions identical to mine? I think identical is probably a bit of a stretch, but I have edited my previous post accorfingly Quote Link to comment
Guillaume Lessard Posted July 12, 2006 Report Share Posted July 12, 2006 Since we're chastising, aren't those suggestions identical to mine? Agreed. I just thought an illustration would help. I'd also wired my expample before I got to your reply... why waste? Quote Link to comment
Forrest Posted July 24, 2006 Author Report Share Posted July 24, 2006 (just Back from Vacation) Thanks I'll wire it up... By the way things will be better with Windows 3000 and Labview ver. 100.0 Thanks Forrest Quote Link to comment
crelf Posted July 24, 2006 Report Share Posted July 24, 2006 Labview ver. 100.0 I think that version would be called "LabVIEW 100.250" Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.