Data bits.
hi frends i am using a variable to store the material no as:
data var_mat_no(18) type c.
this variable stores the material no read from a data base table.now as the size specfied of the material no. is 18 i took the variable's length also 18.but when i dispalyed the var_mat_no it shows the material no with length 18.and the actual material no is of 8 digits like if the material no is 13000000 then it displays it as:
000000000013000000
i want to display it as only 13000000.and want to neglect the 10 zero's before it.wat shud i do?
Did you try the SHIFT statement?
shift matnr LEFT DELETING LEADING '0'
Also remember to CONDENSE the field after the shift.
Br,
Advait
Edited by: Advait Gode on Sep 18, 2009 8:16 AM
Similar Messages
-
Pre-programmed sequence for data bits on parallel port.
I've found and made a bunch of vis that allow for interactive high/low control of the 8 data bits on the parallel port. I want to control each pin with a pre-programmed pattern of bits. Any ideas?
A U8 is an unsigned 8 bit number. To create one place a number control down on the front panel. Right-click on it and select Representation>>U8. To create an array of U8s you place an array control down, and then drag the above numeric into the array shell. You now have an array of U8s, which you can expand and place things in it.
-
Modbus ASCII software protocol with 8 data bits
Hi All,
I must communicate (serial) with a Handheld 3016 device (a particle counter from LightHouse). It uses Modbus ASCII software protocol with 8 data bits.
Every Modbus ASCII software protocol, I have been looking through use 7 data bits.
Any kind of Modbus LabVIEW libraries (old one like nimodbus.llb or new one like ni_lib_modbus_library-1.1.5.38.vip) let the chose to “tag” RTU (8 data bits) or ASCII (7 data bits).
*** There is nowhere ASCII with 8 data bits ***
I always get a kind of “framing error”... obviously since I can't set the com ok...
Any advices??
Thanks a lot for any help
Vids65Wayne,
Thanks indeed for answering
Have a look at the document attached, page 111, appendix C.
It looks like a very standard Modbus setting except the Data Bits numbers... :?
Have a good day
Attachments:
248083400-1 R2 (Op Man H2016 H3016 H5016 Gen E) Letter.pdf 5041 KB -
7 Data Bits, Even Parity, 1 Stop Bit over IP
Hello,
I have a service provider that required ALL transmission even over IP to be 7 Data Bits, Even Parity, 1 Stop Bit. Is this even possible?
I have been going around and around with this dude. 7E1 is serial communications not IP communications right? Maybe I am wrong...
Regards,
-JeffHello,
I have a service provider that required ALL
transmission even over IP to be 7 Data Bits, Even
Parity, 1 Stop Bit. Is this even possible?
It is not possible. What you are talking about is serial protocol with involves more than 8 bits. A stop bit is used to frame the other bits and would lie outside the 8 bit boundary.
Section 1.2 in the following works well enough in explaining this....
http://www.freebsd.org/doc/en_US.ISO8859-1/articles/serial-uart/
Although unlikely it is possible that the provider actually does require an encoded serial protocol (stop bit required.) If that is the case then the service provider needs to provide the specific encoding that they need. However I suspect that they don't require the stop bit. It is quite possible that they require the even parity however.
I have been going around and around with this dude.
7E1 is serial communications not IP communications
right? Maybe I am wrong...That statement is probably incorrect presuming that in fact the actual word size is 8 bits. You use 7 bits for data. You then compute the eighth bit such that the bits in the word (all 8) are even. You can use a 128 size array to do a simple look up for this.
IP of course takes 8 bits so this is no problem. The character set would be a 7 bit character set like ascii. -
Writing 7 data bits/even parity over sockets
Hi, I'm having trouble finding information on this topic, even though several threads out there allude to the subject so hopefully someone can clarify this for me...take a simple case: I need to send a byte over a socket formatted as 7bits/even parity, say for example the character 4. So in ASCII this has the binary representation 00110100, I flip the parity bit to make it even and we get 10110100. But Java doesn't support unsigned chars and thus will not let me create a byte > 127. I've tried to send it as an int (180), short, hex(b4) but the conversions don't seem to address the underlying problem; most of the solutions posted to similar problems involved the next step up ie. 16bit short but doesn't this send a high byte and a low byte out over the socket which will be interpreted by the gateway expecting 8-bit unsigned bytes as 2 individual bytes?
- CraigIt turned out to be the wrong value once I coded it. The code for that and the correct one is below.
byte b1 = (byte)(256 - '4');
System.out.println("wrong b=" + (int)b1);
System.out.println("wrong b=" + Integer.toHexString(b1));
byte b2 = (byte)Integer.parseInt("1111111110110100", 2);
System.out.println("right b=" + (int)b2);
System.out.println("right b=" + Integer.toHexString(b2)); -
Does anyone have the time to discover if Windows Media Center has to be on a twenty four hour automatic download or is there an exact set hour or variable to install on every system?
Hi,
Could you please make it more clear for the issue here?
Do you mean to download Windows Media Center or use Windows Media Center to download?
If you want to get Windows Media Center, please see:
Get Windows Media Center
Regarding the usage of WMC, please see:
Getting started with Windows Media Center
If any misunderstandings, please let me know.
Best regards
Michael Shao
TechNet Community Support -
I want to buy a new ipod but can I move my apps without losing in-app data?
I can back-up my ipod, wipe it and then restore the back-up without losing my game worlds and other in-app data bit what if i do this to another ipod. Won't i loss all of my data? Also, my ipod is really slow these days so I wanted to format it but how can i do that without losing my data AND without damaging my ipod? The back ups were made by icloud and directly restored. I wiped my ipod using the delete all data and settings function on my ipod. I've used that function with ios 5 and 6. Please be serious because i keep all of my data on my ipod!
Already thanks!
J. Paalman
(Could i also delete apps without losing data?)See:
iOS: Transferring information from your current iPhone, iPad, or iPod touch to a new device
You can just reatore from backup. If you restore via iTunes all yur synced media like apps and music has to be in the iTunes library since synced media is not included in the backup
If you restore from iClould backup only iTunes purchases are restore. -
How to get data from serial port to GUI textArea
From Serial Port.....
Messages from base (always 5 bytes):
0xAA, 0, 0, 0, 0xBB - IDLE Mode
0xAA, 0, 0x80, 0x80, 0xBB - Question Mode
messages from terminal (always 6 bytes):
0xAA, a, b, c, chksum, 0xBB
where chksum = a+b+c;
a = address (0-250)
the 2 MSB's of b represenet the answer:
0 0 - A
0 1 - B
1 0 - C
1 1 - D
the 6LSB's of b and 8bits of c is the time for answer, in milliseconds.
(0-16384 milliseconds)
I have VB Code for that but I want the same thing in Java ...
Can any one help me?
Here's VB Code..
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "Aakar GUI"
ClientHeight = 4665
ClientLeft = 60
ClientTop = 375
ClientWidth = 6105
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 311
ScaleMode = 3 'Pixel
ScaleWidth = 407
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdPort
Caption = "Open Port"
Height = 375
Left = 120
TabIndex = 4
Top = 600
Width = 1455
End
Begin VB.ComboBox cmbPort
Height = 315
ItemData = "Form1.frx":0000
Left = 120
List = "Form1.frx":0016
Style = 2 'Dropdown List
TabIndex = 3
Top = 120
Width = 2895
End
Begin VB.CommandButton cmdEnd
Caption = "End"
Height = 495
Left = 1560
TabIndex = 2
Top = 1320
Width = 1215
End
Begin VB.CommandButton cmdStart
Caption = "Start"
Height = 495
Left = 120
TabIndex = 1
Top = 1320
Width = 1215
End
Begin VB.TextBox txtMessage
Height = 2040
Left = 119
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 0
Top = 2475
Width = 5848
End
Begin VB.Timer tmrRead
Enabled = 0 'False
Interval = 1
Left = 2040
Top = 600
End
Begin MSCommLib.MSComm MSComm1
Left = 3120
Top = 360
_ExtentX = 1164
_ExtentY = 1164
_Version = 393216
DTREnable = 0 'False
ParityReplace = 45
SThreshold = 1
End
Begin VB.Label Label5
Caption = "Result Data:"
Height = 375
Left = 120
TabIndex = 5
Top = 2115
Width = 1320
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim PortIsOpen As Boolean
Dim Answers(4) As String
Dim RejectKeystroke As Boolean
Private Sub cmbPort_Change()
Debug.Print cmbPort.ListIndex
End Sub
Private Sub cmbPort_Validate(Cancel As Boolean)
'Cancel = True
End Sub
Private Sub cmdEnd_Click()
MSComm1.Output = "e"
txtMessage.Text = ""
End Sub
Private Sub cmdPort_Click()
On Error GoTo ErrorHandler
If cmbPort.ListIndex < 0 Then Exit Sub
If PortIsOpen Then
cmbPort.Enabled = True
MSComm1.PortOpen = False
PortIsOpen = False
cmdPort.Caption = "Open Port"
cmdStart.Enabled = False
cmdEnd.Enabled = False
Else
MSComm1.CommPort = cmbPort.ListIndex + 1
cmbPort.Enabled = False
MSComm1.PortOpen = True
PortIsOpen = True
cmdPort.Caption = "Close Port"
cmdStart.Enabled = True
cmdEnd.Enabled = True
End If
Exit Sub
ErrorHandler:
Debug.Print Err.Number
Debug.Print Err.Description
MsgBox Err.Description, vbExclamation Or vbOKOnly, "Error opening port"
cmbPort.Enabled = True
PortIsOpen = False
cmdPort.Caption = "Open Port"
cmdStart.Enabled = False
cmdEnd.Enabled = False
End Sub
Private Sub cmdStart_Click()
MSComm1.Output = "s"
txtMessage.Text = ""
End Sub
Private Sub Form_Initialize()
Dim tmp As Variant
tmp = InitCommonControls
End Sub
Private Sub Form_Load()
Answers(0) = "A"
Answers(1) = "B"
Answers(2) = "C"
Answers(3) = "D"
'MSComm1.Settings = "9600,n,8,1"
''MSComm1.Settings = "115200,n,8,1"
'MSComm1.PortOpen = True
On Error GoTo ErrorHandler1
MSComm1.CommPort = 1 ' comm port 1
MSComm1.RThreshold = 1 ' use 'on comm' event processing
MSComm1.Settings = "9600,n,8,1" ' baud, parity, data bits, stop bits
MSComm1.SThreshold = 1 ' allows us to track Tx LED
MSComm1.InputMode = comInputModeText 'comInputModeBinary ' binary mode, you can also use
' comInputModeText for text only use
PortIsOpen = False
cmbPort.ListIndex = 0
' open the port
MSComm1.PortOpen = True
cmbPort.Enabled = False
PortIsOpen = True
cmdPort.Caption = "Close Port"
cmdStart.Enabled = True
cmdEnd.Enabled = True
Exit Sub
ErrorHandler1:
Debug.Print Err.Description
PortIsOpen = False
cmbPort.Enabled = True
cmdPort.Caption = "Open Port"
cmdStart.Enabled = False
cmdEnd.Enabled = False
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If MSComm1.PortOpen Then MSComm1.PortOpen = False
End Sub
Private Sub lblOption_Click()
End Sub
Private Sub MSComm1_OnComm()
' Synopsis: Handle incoming characters, 'On Comm' Event
' Description: By setting MSComm1.RThreshold = 1, this event will fire for
' each character that arrives in the comm controls input buffer.
' Set MSComm1.RThreshold = 0 if you want to poll the control
' yourself, either via a TImer or within program execution loop.
' In most cases, OnComm Event processing shown here is the prefered
' method of processing incoming characters.
Dim i As Long
Dim sBuff As String ' buffer for holding incoming characters
Const MTC As String = vbCrLf ' message terminator characters (ususally vbCrLf)
Const LenMTC As Long = 2 ' number of terminator characters, must match MTC
Dim iPtr As Long ' pointer to terminatior character
' OnComm fires for multiple Events
' so get the Event ID & process
Select Case MSComm1.CommEvent
' Received RThreshold # of chars, in our case 1.
Case comEvReceive
' read all of the characters from the input buffer
' StrConv() is required when using MSComm in binary mode,
' if you set MSComm1.InputMode = comInputModeText, it's not required
'sBuff = sBuff & StrConv(MSComm1.Input, vbUnicode)
'If Len(txtMessage.Text) > 4096 Then txtMessage.Text = ""
sBuff = MSComm1.Input
Dim ch As String
Dim PacketStart As Boolean
Dim PacketLength As Integer
Dim Packet() As String
PacketStart = False
PacketLength = 0
While (Len(sBuff) > 0)
ch = Left(sBuff, 1)
If (ch = Chr(&HAA)) Then PacketStart = True
If (ch = Chr(&HBB)) Then PacketStart = False
If (ch <> Chr(&HAA) And ch <> Chr(&HBB)) Then
PacketLength = PacketLength + 1
ReDim Preserve Packet(PacketLength)
Packet(PacketLength) = ch
End If
'txtMessage.Text = txtMessage.Text + Format(Hex(Asc(ch)), " @@")
sBuff = Right(sBuff, Len(sBuff) - 1)
Wend
If (PacketLength = 3) Then
Debug.Print "Command packet recieved"
'txtMessage.Text = txtMessage.Text + vbCrLf + "Address =" + Str(Asc(Packet(1)))
'txtMessage.Text = txtMessage.Text + vbCrLf + "Address =" + Str(Asc(Packet(2)))
End If
If (PacketLength = 4) Then
Debug.Print "Response packet recieved"
txtMessage.Text = txtMessage.Text + "Address =" + Str(Asc(Packet(1))) + _
" Answer = " + Answers((Asc(Packet(2)) And &HC0) / 64) + _
" Time =" + Str((Asc(Packet(2)) And &H3F) * 256 + (Asc(Packet(3)))) + "mS" + vbCrLf
'txtMessage.Text = txtMessage.Text + vbCrLf + "Address =" + Str(Asc(Packet(1)))
'txtMessage.Text = txtMessage.Text + vbCrLf + "Option =" + Str((Asc(Packet(2)) And &HC0) / 64)
'txtMessage.Text = txtMessage.Text + vbCrLf + "Time =" + Str((Asc(Packet(2)) And &H3F) * 256 + (Asc(Packet(3))))
End If
If (PacketLength <> 4 And PacketLength <> 3) Then Debug.Print "Unknown packet of length" + Str(PacketLength) + " recieved"
txtMessage.Text = txtMessage.Text + vbCrLf
' An EOF charater was found in the input stream
Case comEvEOF
DoEvents
' There are SThreshold number of characters in the transmit buffer.
Case comEvSend
DoEvents
' A Break was received.
Case comEventBreak
DoEvents
' Framing Error
Case comEventFrame
DoEvents
' Data Lost.
Case comEventOverrun
DoEvents
' Receive buffer overflow.
Case comEventRxOver
DoEvents
' Parity Error.
Case comEventRxParity
DoEvents
' Transmit buffer full.
Case comEventTxFull
' Unexpected error retrieving DCB]
Case comEventDCB
DoEvents
End Select
End Sub
Private Sub tmrRead_Timer()
'MSComm1.Output = vbCrLf + vbCrLf
'MSComm1.Output = Chr(128)
End Sub
Private Sub txtMessage_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift = 2 Or Shift = 4 Then RejectKeystroke = False Else RejectKeystroke = True
End Sub
Private Sub txtMessage_KeyPress(KeyAscii As Integer)
If RejectKeystroke Then
KeyAscii = 0
End If
End SubThanks in advance..I want to replicate the entire VB program as Java Program.
This has to be included in my project which i am doing in java. -
Hello everyone,
as the title says, I am trying to use a motor called "MP285" by Sutter Instruments via LabView. The control unit of this motor only has a RS232-output, but I use a Serial-to-Usb-Adapter to connect the device to the PC.
My problem is the following:
I tried to perform a basic Input/Output test by using the Ni MAX an sending ASCII strings to the control unit (after configuring it according to the reference manual), which worked fine. I also used the "jabber"-function of the control unit to send an output string to the PC and was also able to read that string from the buffer. Besides, when I used a LabView-VI to send a command via VISA Write, it also appears on the display of the control (at least the ASCII letters).
Accordingly, I assume that the Serial-to-USB-adapter does work. Is that for sure, or can the adapter evoke any other problems?
However, when I try to use the shipped controlling software, the motor won't work. Furthermore, I contacted the customer support and they sent me some VIs and a LabView-Project, which was tested by the company. Unfortunately, it did not work for me. The motor wouldn't move, when I sent the command, although the LabView-interface indicates that there the connection between PC and controller has been established. As the program has many features and I only need a command to move the motor, read the position and set the origin, I tried to build my own VI. I had a look at some basic VIs for motor control and referred to the manual.
As it seems, the controller uses data streams of full bytes (8 bits, not ASCII) in Big Endian for its strings (I copied the information at the bottom of this text). Thus, I tried to concatenate particular strings to send it via VISA in the correct form (see attached). Do I have to convert the "m" into hexadecimal explcitly? I looked up "Convert ASCII to Hexadecimal", but when I try this, the output string does not change.
However, when I send this string to the controller in normal mode, nothing happens . When I activate the Input/Ouput test (see above), there is a m displayed on the controller unit. So I guess, I am messing up the command structure. Can anybody help me please?
Kind regards
PS: Sorry for cleaning up the diagramm..
PPS: For some reason, I could not attach the VI because " The contents of the attachment doesn't match its file type". So, I changed the name in "-vi" instead of ".vi" as suggested by a forum user. Hope this works for you!
Excerpt form the reference manual:
General Information:
"Command requests are single bytes followed by optional parameters and terminated by a
carriage return (CR, 0Dh). The data stream consists of full bytes (all 8 bits — not ASCII.
The lowest order byte (for example, of the four bytes encoding the X coordinate) is the first
into the controller and is the first out. The default Baud rate is 9600. Commands are
processed bytewise by interrupt and executed only after the terminating CR is received.
There are no delimiters within command strings. The controller will reply with carriage
return (CR, 0Dh) at the completion of normal command processing."
Command structure:
Get Current Position command ‘c’CR 063h + 0Dh
returns xxxxyyyyzzzzCR three signed long (32-bit) integers + 0Dh
Go To Position command ‘m’xxxxyyyyzzzzCR 06Dh + three signed long (32-bit) integers + 0Dh
returns CR 0Dh
Setting up for Serial Communication:
First, use the 9-pin serial port cable provided with the MP-285 to connect the “serial port” of
your computer to that of the MP-285 controller. Next configure your terminal emulator (e.g.,
HyperTerminal in Microsoft Windows (9X and above) to the following settings (or their
equivalent):
• TTY mode
• Echo typed characters locally only (do not echo input to the computer serial port back to
the controller)
• Baud rate to 9600
• 8 data bits, no parity, 1 stop bit
• COM port - set to the port to which you have connected the MP-285 controller
Solved!
Go to Solution.
Attachments:
MotorTestVI-vi 17 KBThank you for your feedback!
To make this clear: I dont know if the motor MOVES when sending the appropriate command via MAX. That is because I dont know how to enter the binary? command. I only tried to send some string like "dear moto please move" to see if this ASCII string can be displayed on the control unit while running the input-mode (which I described above).
This works for both, MAX and my Labview-Vi.
However, these are the I/O traces:
1. MAX: I sent the string: "Test"
NI I/O trace:
viWrite (ASRL25::INSTR (0x026B41E8), "Test", 4, 4) Process ID: 0x0000123C Thread ID: 0x00001434 Start Time: 16:18:31.599 Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
2. LabView-Vi (I removed everything that followed the first "Visa Write" and added the recommended property node to check if my termination char is correct). I sent string "TEST".
14. viOpenDefaultRM (0x065171F0) Process ID: 0x0000154C Thread ID: 0x00000678 Start Time: 16:24:34.918 Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
15. viParseRsrc (0x065171F0, "COM25", 4, 25) Process ID: 0x0000154C Thread ID: 0x00000678 Start Time: 16:24:34.918 Call Duration 00:00:00.002 Status: 0 (VI_SUCCESS)
16. VISA Set Attribute ("COM25", 0x3FFF001A, 3000) Process ID: 0x0000154C Thread ID: 0x00000678 Start Time: 16:24:34.920 Call Duration 00:00:00.020 Status: 0 (VI_SUCCESS)
17. VISA Set Attribute ("COM25", 0x3FFF0021, 1200) Process ID: 0x0000154C Thread ID: 0x00000678 Start Time: 16:24:34.940 Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
18. VISA Set Attribute ("COM25", 0x3FFF0022, 8) Process ID: 0x0000154C Thread ID: 0x00000678 Start Time: 16:24:34.940 Call Duration 00:00:00.001 Status: 0 (VI_SUCCESS)
19. VISA Set Attribute ("COM25", 0x3FFF0024, 10) Process ID: 0x0000154C Thread ID: 0x00000678 Start Time: 16:24:34.941 Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
20. VISA Set Attribute ("COM25", 0x3FFF0023, 0) Process ID: 0x0000154C Thread ID: 0x00000678 Start Time: 16:24:34.941 Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
21. VISA Set Attribute ("COM25", 0x3FFF0038, 1) Process ID: 0x0000154C Thread ID: 0x00000678 Start Time: 16:24:34.941 Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
22. VISA Set Attribute ("COM25", 0x3FFF0018, 13) Process ID: 0x0000154C Thread ID: 0x00000678 Start Time: 16:24:34.941 Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
23. VISA Set Attribute ("COM25", 0x3FFF0025, 0) Process ID: 0x0000154C Thread ID: 0x00000678 Start Time: 16:24:34.941 Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
24. VISA Set Attribute ("COM25", 0x3FFF00B3, 2) Process ID: 0x0000154C Thread ID: 0x00000678 Start Time: 16:24:34.941 Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
25. VISA Get Attribute ("COM25", 0x3FFF0018, 13) Process ID: 0x0000154C Thread ID: 0x00000678 Start Time: 16:24:34.941 Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
26. VISA Get Attribute ("COM25", 0x3FFF0038, True) Process ID: 0x0000154C Thread ID: 0x00000678 Start Time: 16:24:34.941 Call Duration 00:00:00.000 Status: 0 (VI_SUCCESS)
27. VISA Write ("COM25", "TEST", 4) Process ID: 0x0000154C Thread ID: 0x00000678 Start Time: 16:24:34.941 Call Duration 00:00:00.001 Status: 0 (VI_SUCCESS)
28. VISA Close ("COM25") Process ID: 0x0000154C Thread ID: 0x00000678 Start Time: 16:24:34.942 Call Duration 00:00:00.110 Status: 0 (VI_SUCCESS)
Both strings are correctly displayed. -
How to add an array of data in Citadel database
I have an array of data which I want to directly put it in the Citadel Database. Normally the write tag VI writes one value at a time. How can this be done ?
It depends on what you really want. Could you be a little more specific? Does each point have its own separate timestamp? If so, you could simply put the "Write Tag.VI" inside a FOR LOOP and insert values one after another. This would give a separate timestamp to each value. I have attached a simple VI that shows how to do this.
Or are you looking to record some type of vector, where you log a complete array of data at each interval? I don't think this is possible (I'm using DSC 6.02) unless the data-type is a bit-array, in which case you would simply use "Write Data (bit array).vi".
Another option, depending on what you are aiming for, would be to create your own "VI-based Device Server" and use the VIs on the palette submenu call
ed "DSC Server Development". With your own Device Driver you can write multiple datapoints to the input queue simultaneuosly. In this way, you can write more than one point at a time... but that doesn't mean that each time interval will contain an array of data. Assuming that the data is analog, the data will still be logged to Citadel "one after another" so that when you look at it with the HTV, you will see one curve of analog values.
Attachments:
Write_array_to_citadel.vi 17 KB -
Cannot upload data to serial device using x-on, x-off in Labview but works OK in Hyperterminal
Hello,
I'm trying to write a Labview 7.1 App that will upload a motorola .S28 file to a custom designed piece of hardware. The serial port on the hardware device requires the serial port settings be set to 9600, 8,N,1, none, for general operation and my Labview app is able to send and receive information from the hardware using the NI VISA 4.00 serial read and write routines, so I know that there are no fundamental communications errors. The general communications also work when I set the com port to 9600, 8,N,1, x-on, x-off.
The problem I'm experiencing is that I can upload calibration files (which require x-on, x-off flow control) in Hyperterminal by:
1. configuring the Hyperterminal session for 9600, 8,N,1, x-on, x-off
2. selecting "Transfer--> Send Text File... when my device prompts me to upload the file.
This works 100% of the time in Hyperterminal, but I cannot accomplish the same upload in my Labview app.
The very first thing my LV app does is to pop up a dialog box to the user prompting him/her to select the desired com port (Visa Resource Name), Baud rate, Data bits, Parity, Stop bits, Flow Control, and allows the user to enable/disable the termination char and to set the termination char (always enabled and set to default 0xA). The flow control is set to x-on, x-off. This is accomplished using the VISA Configure Serial Port vi.
I have tried using both the VISA Write From File vi and also reading the file to a text variable then using the VISA (serial) Write vi but neither work. The VISA Write From File vi return count correctly identifies the number of bytes in the file but the hardware never returns it's transfer complete status message (remember this works 100% of the time in Hyperterminal). Does anyone out there have any advice as to how I can make this work?
Thanks,
IanThis is going to be a two-part solution, meaning you will need to change the way you read your file and the way you transmit the data.
First, when you read from your file, set the Read VI to read in Line Mode. When you do this, the output of the read will be an array of strings rather than a single string. It will basically read the file until it hits the CR/LF combination, but should strip the terminating characters from each line.
Second, in order to replace the carriage return which was stripped, you can configure VISA to transmit a termination character after each write is performed. In addition to setting the termination character to CR on the Configure Serial Port VI, you will want to use a VISA Property Node to set the Serial::End Mode For Writes properter to use the termination character.
Now, you can simply use a For loop to index through your string array, transmitting each line. You will have eliminated all your manual parsing of the file, which should simplify your application and increase performance. I have included a picture of how this could be done in LabVIEW 8.x. The file I/O interface looks different than it did in 7.1, but the same functionality exists.
-Jason S.
Message Edited by JasonS on 09-26-2007 08:49 AM
Attachments:
sendfile.jpg 23 KB -
Sending binary data over RS232 without conversion to ascii
I need to send binary data to a PIC without the data being converted to ascii. With the VISA vi's, when I want to send 11111111, it gets converted to a string "255", and is sent as "2","5","5" in ascii.
How can I send it as one byte?r_keller wrote:
@tbob: I probably shouldnt tell my customer that he's an idiot, and obviously 9 bit addressing/signalling modes seem to be not so uncommon in industry, so ur post does not really contribute to solve the problem.
Well I wouldn't call my customer an idiot either. I didn't know he was your customer. Sorry. Not every comment posted here is intended to directly solve a problem. We are a fun loving group, and occasional ribbings take place here. I still think that trying to use 9 bits over an 8-bit protocol is not a good way to go. But if it is the only way, then so be it.
r_keller wrote:
Does the Mark or Space parity bit add another 10th bit to the command or can i only use either ODD parity/Mark/Space?
According to the link you attached, the parity bit adds only one more bit. If the number of bits is set to 8, then the parity is the 9th bit, and you can only use Mark or Space to force that 9th bit to either 1 or 0 respectively. If you try to use odd or even parity, the protocol will determine the parity and change the bit accordingly, and it may not be the one you intended to send. The start and stop bits are fixed by the protocol and cannot be used for extra data bits.
Actually, until I read that article about using Mark and Space, I had no idea at all that sending 9 bits at a time was possible.
- tbob
Inventor of the WORM Global -
How can I write bits through the COM1 serial port?
I'm trying to write bits through the serial port COM1.
Labview "Write VI" only writes everything in string. It seems. How can I write bit by bit through COM1?
Thank you,
VanSerial transmission (COM port) protocol requires sending a group of bits at one time. You cannot just send one bit. Standard COM port settings must be either 7 or 8 data bits, 1 or 2 stop bits, etc... You have to group your bits 7 or 8 at a time. You could probably send a 0 byte or a 1 byte. This would be like sending 0000 0000 for a low bit and 0000 0001 for a high bit. Your receiving end would have to know how to interpret what you are sending if you choose this method. Of course you have to convert your byte into a string before sending to COM port. Wire a U8 data type to a Build Array input. Then wire the array output to a Byte Array to String input. The output of this function will be the character representation of your byte suitable for sending acr
oss a serial port.
- tbob
Inventor of the WORM Global -
Extract data from SAP and send to external system via Webmethods & IDOC's
Hi,
We need to Extract data from SAP and send to an external system via Webmethods middlewear using IDOCs. I have never used webmethods before and would like to know more about how to implement this scenario. I have used IDOCS in an EDI scenario before but not used it along with WebMethods.
Any pointers would be of great help. ThanksIf you have already ABAP programs /BAPI's in place then try to develop RFC interface and write some back ground programs to scheudl BAPI's and develop scenario but you need to implement error handling , data validation in PI mapping level.
or
take help from ABAPer to design in ABAP like writing Proxy program to pull data and send it PI.
if you are dealing with master data bit risky(correctness) but can be achived using PI. -
I am looking to put in a field that will automatically
populate the current date mm/dd/yyyy - I am creating a certificate
for the user to enter their name and print out the certificate with
the date they took the course. also while I am at it how can I
create a button for them to print just the current captivate page..
ThanksHi devokan and welcome to our little community
For the print bit, check out fellow Adobe Community Expert
Paul Dewhurst's print widget. You can see it by
clicking
this way cool and super handy little link.
For the date bit, I'm thinking you would have to resort to
using JavaScript. Still struggling a bit, however, with how you
would tie it into the movie. (or I suppose we should start calling
them projects now, since that's the term being used all over in
Captivate 2
As I understand it, ActionScript is more or less very similar
to JavaScript, so maybe something could be done in Flash that would
accomplish this. My Flash skills are nowhere near that level yet,
so I'll have to defer to one of our resident Flash experts for
that.
Cheers... Rick
Maybe you are looking for
-
Copy selected values from a table control into another table control
hi there, as seen in the subject i need to copy selected values from a table control into another table control in the same screen. as i dont know much about table controls i made 2 table controls with the wizard and started to change the code... rig
-
Master on a View and Detail on a Table
I have a master form and a detail tabular form attached to it - together, on the same page. Form is based on a view and the tab form is based on a table. Whenever an update needs to be done, then on the tabular form - detail record. If I try to creat
-
How do you lock wi fi on your laptop?
How do you lock wi fi on your laptop?
-
Disabling Distinct Feature in Answers
Hi All, I'm having a hard time to figure out the way of diabling Distinct values in Answers. I have 2 tables Dim and a Fact. The Sql generated in Answers is perfect. I executed this query in SQL database and it gave proper results(30400 rows). But th
-
Restoring ECC6.0 SR3 data on ECC6.0 SR2
Hi Friends I want to restore the database of ECC6.0 SR3 onto ECC6.0 SR2 version where the database is Oracle 10.2.2.0 on both servers and OS is Solaris 10. Will there be any problems in the same. Lokesh