LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert a normal number to binary?

As others have mentioned, internally the number is already binary.
 
In the first post it was mentioned that the data types are one or two bytes, so it cannot be 32bits (4 bytes)!
 
Just divide the 12000  (keep this as I32!) by 10, convert the result to I16 and typecast it to a binary string. Most likely, you cannot use I16 as the primary input, because the 10x higher raw value might exceed the range of I16.
 
You still haven't told us what data representation the instrument accepts.

Message Edited by altenbach on 07-30-2007 08:16 AM

0 Kudos
Message 11 of 129
(2,295 Views)
VISA is an API that works with serial, GPIB, Ethernet, etc. VISA is the only supported method of serial communication in recent LabVIEW versions. If it doesn't work, there can be numerous reasons. You could have the wrong type of cable, incorrect com settings, or you are sending the data incorrectly. If you had mentioned that you were using serial and VISA Write in your first post, you could have saved a lot of guess work on the people answering your question. What you probably need to do is convert your number to a string with the type Cast function. Using the Byte Array to String will also work. If you continue to have problems, it would help if you attached the user manual for the motor or at least mention the make and model. Someone here may have experience with it.
0 Kudos
Message 12 of 129
(2,291 Views)
Ok, you need to realize you talking to a labview idiot. You are a god in labwiew and I just bumble through things.
 
When you say that the number is already in binary, I don't really know what you mean by this. Yes I am aware that computers speak in binary, but what does this mean to me? If i was to type in 12000 into a numeric control that was type I16 with radix displayed and set as decimal, and then I wired the output of that Directly to VISA WRITE, are you saying it is already in binary without any need for conversion? When i probe the wire, It still says 12000, not 10111011100000  
0 Kudos
Message 13 of 129
(2,286 Views)

That doesn't make any sense. You cannot wire a numeric control to VISA Write. Even if you could, did you ever stop to think that the probe display is not set to display binary.

Read my answer about using the Type Cast.

0 Kudos
Message 14 of 129
(2,280 Views)
Wow Dennis and altenbach. I know im in good hands now.
 
The drive is a Sieb&Meyer FC80
 
The manual is attached:
 
 
0 Kudos
Message 15 of 129
(2,278 Views)
A probe is just another indicator that will format the underlying binary data for easy human consumption. You can create a custom probe that shows the binary values if you prefer that.
 
To write to the serial port, the data typically needs to be a generic string. That's where typcast comes into play.
 
Why don't you attach your code for better communication of the issues?
0 Kudos
Message 16 of 129
(2,272 Views)
I agree that attaching the code will help. You can also run of the example commands. Open the Basic Serial Write and Read example. Right click on the 'string to write' Control and select Hex Display. Do the same thing to the 'read string' indicator. In the 'string to write', enter the 06 1D 6B 01 66 01 0A command that is listed in the 5.1 example in the manual. You should get back 06.
0 Kudos
Message 17 of 129
(2,261 Views)

So I have talked at length with the manufaturer about the code formatting. It is very complicated.

I can send information as strings in hex number format.  apparently LABVIEW knows to send this via binary thru the serial cable?

How exactally do I use this typecast block.

I am going to re-start my code using the examle dennis pointed me twords, thank you. Its seems to be a good start.

I need to make some controls to start/stop the motor, change the speed, and request the information bundle from the motor controller.

 

 

 

0 Kudos
Message 18 of 129
(2,240 Views)

I need to somehow count the bytes that I am sending in my message. This is the first section of the message to the FC80, how many bytes I am going to send before I stop.

This includes the checksum, which needs to also be calculated, as well as the block count which needs to be calculated, as well as the Byte cuonter.

So lets figure out:

How do I count the numbe rof bytes i want to send, and then include this in the message, have a rolling block counter that increments every time i SEND a message and has valid values of 0-255.

Then the Checksum is the summation of bits from the first 7 items in the message I send to the controller, which shult result in a 3 digit number. To calculte the checksum you discard the first digit in the total, and in hex subtract those two remaining digits from "FF", then Add one. Then convert that number back to hex, and that is the checksum.

My head is exploding from the complexity of this.

 

 

0 Kudos
Message 19 of 129
(2,237 Views)

here is the VI I started, Its not much more than the example and the 8 parts of the message, 4 of which need to be calculated.

how do i use that typecast to smash it all down to a HEX string??

 

Message Edited by Vr6Fidelity on 07-30-2007 01:46 PM

0 Kudos
Message 20 of 129
(2,218 Views)