mscomm32.ocx

hi there,

please help me regarding the mscomm32 in vb6. i tried to transmit serial data from computer to microcontroller through serial port. and i have some trouble on it.

I have a textbox, and a command button. while i press the command button, the computer will transmit a string of data on the textbox to the microcontroller. i use "mscomm1.output = text1.text". and on the microcontroller side, if the microcontroller receive a byte of data from computer,it will send "ack" back to the computer, my program work fine if i send a character to the microcontroller, but if i send a "string" it doesnt work if i run it, but in debug mode, it works well.

if i have a string in the textbox, i.e "test", then the computer will send it byte per byte, it would first send 'b', and after receive the "ack" from microcontroller, the computer send the next character 'e', and so on. where is the problem? please help me.

regards,
zhi yi


Comments

  • [b][red]This message was edited by DrMarten at 2006-9-30 6:27:7[/red][/b][hr]
    : hi there,
    :
    : please help me regarding the mscomm32 in vb6. i tried to transmit serial data from computer to microcontroller through serial port. and i have some trouble on it.
    :
    : I have a textbox, and a command button. while i press the command button, the computer will transmit a string of data on the textbox to the microcontroller. i use "mscomm1.output = text1.text". and on the microcontroller side, if the microcontroller receive a byte of data from computer,it will send "ack" back to the computer, my program work fine if i send a character to the microcontroller, but if i send a "string" it doesnt work if i run it, but in debug mode, it works well.
    :
    : if i have a string in the textbox, i.e "test", then the computer will send it byte per byte, it would first send 'b', and after receive the "ack" from microcontroller, the computer send the next character 'e', and so on. where is the problem? please help me.
    :
    : regards,
    : zhi yi
    =====================================================================

    Hi,

    Have you tried setting up a loop that sends the string one byte or
    character at a time, each time waiting for the acknowledge or ack signal?

    You could put a delay in the loop.
    You probably need to use a timer control.


    Regards,

    Dr M.

  • Thanks Dr. M, can you please give me an example using OnComm event property especially the "comEvReceive"?


    regards,
    zhi yi

    : [b][red]This message was edited by DrMarten at 2006-9-30 6:27:7[/red][/b][hr]
    : : hi there,
    : :
    : : please help me regarding the mscomm32 in vb6. i tried to transmit serial data from computer to microcontroller through serial port. and i have some trouble on it.
    : :
    : : I have a textbox, and a command button. while i press the command button, the computer will transmit a string of data on the textbox to the microcontroller. i use "mscomm1.output = text1.text". and on the microcontroller side, if the microcontroller receive a byte of data from computer,it will send "ack" back to the computer, my program work fine if i send a character to the microcontroller, but if i send a "string" it doesnt work if i run it, but in debug mode, it works well.
    : :
    : : if i have a string in the textbox, i.e "test", then the computer will send it byte per byte, it would first send 'b', and after receive the "ack" from microcontroller, the computer send the next character 'e', and so on. where is the problem? please help me.
    : :
    : : regards,
    : : zhi yi
    : =====================================================================
    :
    : Hi,
    :
    : Have you tried setting up a loop that sends the string one byte or
    : character at a time, each time waiting for the acknowledge or ack signal?
    :
    : You could put a delay in the loop.
    : You probably need to use a timer control.
    :
    :
    : Regards,
    :
    : Dr M.
    :
    :

  • Please post your code here and i'll see if i can help.

    Regards,

    Dr M.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories