Cannot write to serial port

Hi,
I am using jdk 1.3.1, forte ce 3.0 and j2me 1.0.3 beta.
I wrote a midlet that should write and read strings to and from the serial port.
Using the Emulator I have the reading working, but the writing freezes the execution.
Any ideas?
Debbie

Thanx for your reply (I have been asking this question everywhere for 2 weeks and no one has answered...).
I am using the Motorola i85s. It is specifially stated in the "i85s & i50sx Release 2 J2ME Developers' Guide Addendum" that the serial communications SHOULD work.
As I said - reading from the port (using the i85s Emulator) works - but writing to the port - freezes the execution. So this means that my connection is up and running - just the write is not working.
I would love to be able to load my midlet to my phone - since maybe on the phone it WILL miraculously work. But in this direction I am stuck with the fact that the JAL Lite does not load "network capable apps" - whereas I cannot get my hands on the Web JAL (which DOES load network capable apps) - since I have not succeeded to get thorugh the 100 steps that you must go through in order to use it... see for yourself at https://idenonline.motorola.com/ideveloper/program/program_jal.cfm).
Help...?

Similar Messages

  • Write to serial port and digital port at the same time

    hello,
    I need to write to the digital port and the serial port at the same time. Right now I have the two vi's (to write to the serial port, write to the digital port) in the sequence structure. First I write the digital port, then write the serial port. Using the oscilloscope, the interval between these two executions is 10 ms; and I need to reduce this interval to as small as possible. I would appreciate help in any way. Thank you.

    Hello;
    This is a little tricky. Since the transition from one sequence to another is completely Software timed, and windows manages all tasks that are running at one given time, there isn't a method to reduce that transition time.
    The most you can do is try to optimize your code so all the time expent on the transition is due only to the task management.
    Hope this helps.
    Filipe A.
    Applications Engineer
    National Instruments

  • Info about read or write a serial port with forms 6.0.5

    Anybody can give some info. on read or write a serial port using form (Developer 6.0.5).
    Thanks
    MM
    null

    One option you can try is to develop a DLL
    function to read/write serial port,
    and then write a ORA_FFI procedure to call the DLL function.
    Peter Ng
    Calgary, Canada
    null

  • Write to serial port asyncronously

    I am trying to write a commands to a serial port but my problem is that the operation is tedious so it is freezing up my UI. What makes it more complicated is that I must call this procedure when the form loads I want to ask if anyone can provide an alternative
    way to get the same or better result I was thinking of running it asynchronously but I don't know how to?
    This is the code I am calling on load
    If lblConnected.Text = "" Then
    MsgBox("Please connect to port.", MsgBoxStyle.OkOnly, "Validation")
    Exit Sub
    End If
    RichTextBox1.Text = ""
    Try
    With SerialPort1
    rcvdata = ""
    .Write("AT" & vbCrLf)
    Threading.Thread.Sleep(1)
    .Write("AT+CMGF=1" & vbCrLf)
    Threading.Thread.Sleep(1)
    .Write("AT+CPMS=""SM""" & vbCrLf)
    Threading.Thread.Sleep(1)
    .Write("AT+CMGL=""ALL""" & vbCrLf)
    Threading.Thread.Sleep(1)
    .Write("AT+CNUM" & vbCrLf)
    Threading.Thread.Sleep(2000)
    Dim lineoftext As String
    Dim arytextfile() As String
    Dim myString As String
    lineoftext = rcvdata.ToString
    arytextfile = Split(lineoftext, "Your number is", CompareMethod.Text)
    myString = "Your number is"
    lineoftext = lineoftext.Substring(lineoftext.IndexOf("Your number is"), 40)
    lineoftext = lineoftext.Replace("Your number is", "")
    lineoftext = lineoftext.Substring(0, 13)
    txtDonglePhoneNumber.Text = LTrim(lineoftext)
    End With
    Catch ex As Exception
    MsgBox(ex.Message)
    End Try
    I am trying to extract the phone number from this whole routine  and it works but its freezing up my UI. How can I run from another thread.
    If you think it you can achieve it

    Imports System.IO.Ports
    Imports System.Threading
    Public Class Form1
    Private comport As SerialPort
    Private sending As Boolean
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    sending = False
    End Sub
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    comport = CreateComport(comport)
    If sending = False AndAlso OpenComport(comport) = True Then
    Dim t As Threading.Thread = New Threading.Thread(AddressOf SendData)
    t.IsBackground = True
    t.Start(comport)
    End If
    End Sub
    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
    CloseComport(comport)
    End Sub
    Private Function CreateComport(ByVal port As SerialPort) As SerialPort
    If port Is Nothing Then
    port = New SerialPort("COM4", 9600, Parity.None, 8, StopBits.One)
    End If
    Return port
    End Function
    Private Function OpenComport(ByVal port As SerialPort) As Boolean
    Try
    If (Not port Is Nothing) AndAlso (port.IsOpen = False) Then
    port.Open()
    End If
    Return True
    Catch ex As Exception
    MessageBox.Show(String.Format("Exception :{0}", ex.ToString()))
    Return False
    End Try
    End Function
    Private Sub CloseComport(ByVal port As SerialPort)
    Try
    If (sending = False) AndAlso (Not port Is Nothing) AndAlso (port.IsOpen) Then
    port.Close()
    MessageBox.Show("Port closed")
    End If
    Catch ex As Exception
    MessageBox.Show(String.Format("Exception :{0}", ex.ToString()))
    End Try
    End Sub
    Private Sub SendData(ByVal port As Object)
    Dim buffer(1023) As Byte
    For i As Int32 = 0 To buffer.Length - 1
    buffer(i) = i Mod 256
    Next
    sending = True
    Try
    DirectCast(port, SerialPort).Write(buffer, 0, buffer.Length)
    Catch ex As Exception
    CloseComport(DirectCast(port, SerialPort))
    MessageBox.Show(String.Format("Exception :{0}", ex.ToString()))
    Finally
    sending = False
    End Try
    End Sub
    End Class
    在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。

  • Write to Serial Port without splitting string data

    Hi, all, thank you for your help in advance.
    Problem:
    I am trying to write to the serial port with VISA write module. Somehow the string I tried to send was splitted before it was sent. For example, if I want to send "127", it sends "7', "2", "1". I don't know if there's anyway to configure the module so that it sends out the whole string at once. I use the return count to indicate how many times it spits the data. So "127" now returns "3" (sent three times. I would like to have it to return "1" so that "127" was sent in whole).
    Project:
    I am working on an application where a DC motor is controlled by a controller talking to the PC's serial port. "127" stands for its maximum power. The controller devides the power into 128 steps. Therefore I need to input number from 0 to 127 to command the speed.
    Any help or suggestion will be appreciated!

    Thanks for the prompt replies.
    About Number/ASCII
    I am using the Atmega128-Controller Chip to read in the signals sent from the computer serial port. Then it sends signals to the motor controller. The Atmega chip reads the ASCII string and converts it to hexadecimal number, sending that number to the motor controller. I can program the Atmega chip so that it either translates the ASCII string into hex as mentioned or accepts as it is. Either way, I want it to read two byte information at once (00 to 7F).
    If the VISA serial write can send only one byte at a time, then I may have to program the chip so that it buffers the readings. I have tried using number/hex converter and number/string converter, either case, the fact that VISA Write spits one byte at a time hinders the programming. For example: I defined numbers 1 to 5 represents 20% to 100% power output with 20% increment Then I defined "10" as "90%" power, but it reads "1" "0" seperately, so the actual out put is "20%" then "0%".
    I used the example VI provided by NI : advanced serial write/read. For convenience, attached here. Not all modification I made is saved.

  • Cannot delete bluetooth serial port! going crazy! help!

    Brief background-
    I want to sync my Treo 680 with my intel iMac. I have never gotten BT sync to work with any mac or any palm I've ever had. But this time, somehow I did.
    And now it's dead again.
    I have given up on troubleshooting, and just want to delete all bluetooth profiles, devices, etc that I have created, and to start fresh.
    The thing is, they won't delete.
    In the bluetooth section of System Prefs, there is a sharing tab.
    Under that I have:
    Bluetooth file transfer
    bluetooth file exchange
    bluetooth-PDA-sync
    PalmBT
    the first three are not delete-able since they came with the system, I guess.
    "palmBT" is one I made, that is a duplicate of bluetooth-pda-sync.
    I just want to delete it altogether. They are both turned off, but it doesn't matter. if i try to turn either one on, I get an error. I forget the exact words- something about transport monitor could not complete my request.
    Not sure if this is an OS problem, or a palm hotsync problem. But like I said, I DID work for a while. I have no idea what may have changed to break it.
    So I select "palmBT" and click "remove serial port service" and get this error:
    "You are attempting to remove a port which is in use. Quit the application using this port and try again."
    What does this mean? The port most certainly is not 'in use'! If it were, I wouldn't be here looking for help! There are NO applications running- what am I supposed to quit?!
    Help!!!

    Ooh, god I hope not... just for this?! If that's the case I'll give up on BT sync and just stick with USB.
    if I do that, it will be the THIRD time I have had to wipe this hard drive since I got the computer in MARCH.
    I am still not fully recovered from the last time (but at least I have a backup now)
    there must be something else to try- anyone?

  • Esc Command to serial Port

    I'd like to send an esc command to the serial port in my LV-application. how I can do that ??
    I tried to use write to serial port and \1b as string but it not worked.
    In a terminal programm it works with the ESC key and with ALT+027.

    Hi,
    You have to be careful with the kind of datas that you send...
    You told that you sent \1b or something like this, but did you sent this in Ascii mode or \ mode... It's very different for the device...
    Maybe you have to write as a constant in \ mode the code \1b, and after that convert this string type to ascii mode using the roght button on the constant and then send the character to the device

  • Problem in Accessing serial port using java comm Api

    I have installed java comm Api in my pc.
    i have gone through the instalation instruction which comes on this package.
    I have done the instalation like this
    Copy win32com.dll to my <JDK>\bin directory.
    Copy comm.jar to my <JDK>\lib directory.
    Copy javax.comm.properties to my <JDK>\lib directory.
    and restart the system.
    But when i run the BlackBox , it is giving me message
    "serial port not found".
    Can any one tell me , what is the exact problem ?

    I'm not sure what you mean by BlackBox, but I have used the COMM api extensively.
    The majority of problems is that the api cannot see the serial port (which is what you are describing) and this is caused by incorrect placing of the javax.comm.properties file.
    As well as <JDK>\lib, try putting it into <JRE>\lib as well. That has often solved problems on my setup.

  • Pc to h/w communication by using serial port

    I have write a serial port codding but thre is problem in accessing the javax.comm.*' packege.
    I had downloaded that package on my pc but its not working.
    Could anybody help me?

    Hmm. Urgent. When is your project due? What have you tried so far? Whats not working? First you need to verify that all your hardware is connected properly and the UART is properly configured on teh 8051. Then you need to make sure that the software on both the PC and the 8051 are both working properly. Just curious, what class is this project for?

  • Serial Port Sniffer

    Hi all,
    I want to write a Serial Port Sniffer based on the proxy design pattern. Can I use the socket API for this purpose?
    Thanks
    Jean

    No, Sockets deal with TCP/IP. For serial ports you need to use javax.comm.

  • Problems reading the serial port with labview 5.1.

    I open the example serial.vi , I select write to serial port, run the programm, I don`t have any problem. But when I select read serial port, I get the error code 16392and hex code error x4008. I need to know what can I do? Thanks a lot

    Any time you get an error in LV you can right click on the error cluster indicator and do a "Explain Error".
    If you do this for the error code you reported, the explanation says that it was a framing error.
    In serial communications, a framing error indicates that the hardware was not able to detect a start bit, data then the stop bits that comprise a frame.
    This prompts me to suggest that you check you port setting on the serial port. You want to make sure you are setting the port for the correct;
    Number of start/stop bits,
    Baud rate
    data bits
    parity (just for good measure)
    and hardware handshaking.
    I hope this helps,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Unable to delete serial port (advanced bluetooth prefs)

    I was messing around with the advanced Bluetooth preferences and added a couple serial ports to this list.  But when I select the items, the remove button remains inactive.  How do I delete these?  (Note: checking the checkboxes doesn't change the state of the remove button.)

    Hi ChouDoufu,
    did you get a reply, or find a way to fix this problem? I'm experiencing exactly the same issue. Moreover, if I go to "My Bluetooth Places" and "View My Bluetooth services", I can see the various services, and even enable some of them such as File Transfer or Bluetooth Imaging. However, I cannot enable Bluetooth Serial Port, which is what I'd need to be able to connect my Palm with my Lenovo. By the way, it works fine with my other computers, just not with this Lenovo T60p...
    Cheers,
    ejay 

  • [SOLVED] How to set non-root access to serial ports?

    I have this device which is listed as
    /dev/ttyUSB0
    I need to
    sudo chown sms /dev/ttyUSB0
    every time I reboot. Normally I would think to add myself to some group but "tty" group is not doing the trick... proof:
    [sms@sms-linux ~]$ groups sms
    tty wheel sms
    [sms@sms-linux ~]$ MinOZW
    Starting MinOZW with OpenZWave Version 1.0.758
    2014-03-15 06:32:07.921 Cannot find a path to the configuration files at ../../../config/, Using /usr/local/etc/openzwave/ instead...
    2014-03-15 06:32:07.928 mgr, Added driver for controller /dev/ttyUSB0
    2014-03-15 06:32:07.929 Opening controller /dev/ttyUSB0
    2014-03-15 06:32:07.931 Trying to open serial port /dev/ttyUSB0 (attempt 1)
    2014-03-15 06:32:07.933 ERROR: Cannot open serial port /dev/ttyUSB0. Error code 13
    2014-03-15 06:32:07.935 ERROR: Failed to open serial port /dev/ttyUSB0
    2014-03-15 06:32:07.936 WARNING: Failed to init the controller (attempt 0)
    ^C
    [sms@sms-linux ~]$ sudo MinOZW
    [sudo] password for root:
    Starting MinOZW with OpenZWave Version 1.0.758
    2014-03-15 06:32:23.776 Cannot find a path to the configuration files at ../../../config/, Using /usr/local/etc/openzwave/ instead...
    2014-03-15 06:32:23.782 mgr, Added driver for controller /dev/ttyUSB0
    2014-03-15 06:32:23.784 Opening controller /dev/ttyUSB0
    2014-03-15 06:32:23.786 Trying to open serial port /dev/ttyUSB0 (attempt 1)
    2014-03-15 06:32:23.794 Serial port /dev/ttyUSB0 opened (attempt 1)
    Edit: yes, it was after logout and even reboot.
    Last edited by smsware (2014-03-15 15:07:15)

    Hi,
    I also have a similar problem. I added myself to uucp group, but I still cannot access the serial port.
    [manjaro@mycomp work]$ sudo gpasswd -a manjaro uucp
    [sudo] password for manjaro:
    Adding user manjaro to group uucp
    [manjaro@mycomp work]$ groups manjaro
    lp wheel uucp network video audio storage users
    [manjaro@mycomp work]$ ls -l /dev/ttyUSB0
    crw-rw---- 1 root uucp 188, 0 23.06.2014 21:32 /dev/ttyUSB0
    [manjaro@mycomp work]$ lpc21isp firmware.hex /dev/ttyUSB0 19200 11059
    lpc21isp version 1.97
    File firmware.hex:
    loaded...
    Start Address = 0x00004F9C
    converted to binary format...
    image size : 30304
    Image size : 30304
    Can't open COM-Port /dev/ttyUSB0 ! (Error: 13d (0xD))
    But when I try as root, it works:
    [manjaro@mycomp work]$ sudo lpc21isp firmware.hex /dev/ttyUSB0 19200 11059
    [sudo] password for manjaro:
    lpc21isp version 1.97
    File firmware.hex:
    loaded...
    Start Address = 0x00004F9C
    converted to binary format...
    image size : 30304
    Image size : 30304
    Synchronizing (ESC to abort)..... OK
    Read bootcode version: 13
    Download Finished... taking 27 seconds
    Now launching the brand new code
    Do you have any idea what I am doing wrong?
    Last edited by manjaro (2014-06-23 19:57:40)

  • How can I use the output value from SIMPLE PID to write something to the serial port?

    I am working on my Senior Design Project that requires the use of incoming compressed air, propotional valves, continuous servo motors, and a serial servo motor microcontroller.  I have figured out how to send byte sequences to the microcontroller through LabVIEW using the VISA serial write function.  The motors are attached to the valves to control the flow rate.  I have created my own simple feedback system using a bunch of case structures but I realized that I am basically trying to recreate the wheel (I basically was writing my own PID VI).   I have an older version of LabVIEW (7.0 Express) and theres no way to upgrade or buy the PID toolkit, so I am stuck using the Simple PID VI.  Also, the only way the motor works is sending an array of bytes to tell it to turn on/off, direction, and speed.  Is there any way I can use the Simple PID VI in conjunction with the VISA SERIAL write function, or is there any other way I can communicate with the serial port using this pid vi?  Any information would be appreciated.

    Hi gpatel,
    you know how to communicate to serial port, but you don't know how to send a value from SimplePID to serial port???
    You know how to communicate, but then you don't know how to communicate???
    You should explain this in more detail...
    Edit:
    From you first post you know what values your motor driver is expecting. You know which values the PID.vi is providing. Now all you need is a formula to reshape the values from PID to the motor. It's up to you to make such a formula. Unless you provide any details we cannot give more precise answers...
    Message Edited by GerdW on 02-28-2010 08:35 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • 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,
    Van

    Serial 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

Maybe you are looking for

  • Importing Swf

    Hi there, I have created a flash file using codebaby and it is transparent; however, when I bring it into adobe presenter, it has a black background.  How do I get rid of the black background of the imported swf file?  It looks great in other tools;

  • Why is the sound stopping?

    Hi flash users! I wonder if any of you can help me with a problem that is making me tear up my hair. I have this flash project I'm working on with a kind of a gallery of sounds. I have some buttons generated by actionscript and XML that will load whe

  • Oracle SQL DEVELOPER ERROR

    Hello everyone Can anyone here please help me with oracle sql developer error My problem is that i have installed oracle sql developer as a root and now when i execute the following command [root@localhost tmp]# sqldeveloper Oracle SQL Developer Copy

  • No ifIndex table when querying via SNMP

    Hello, looking for suggestions before opening up a TAC case. Just received a Nexus 3000 with NX-OS 6.0(2)U2(1) and when I attempt to walk the ifTable via SNMP the ifIndex table is not present. Walking the ifIndex table itself results in  "IF-MIB::ifI

  • What's normal CPU tempreture?

    What's the maximum cpu tempreture that z2 can stick? When I use effect of camera the cpu tempreture get 67 degree. Is it normal?