I'm using VISA & VS2005 to control my serial device and I'm a traditional VB 6.0 user and also beginner in serial communication...!
I open, send & receive message of my device but I think my code looks not good and need some hints....
Here is my code...
Private mbSession As MessageBasedSession
...
...
Dim SerSess As New VisaNS.SerialSession(VISAResourceName)
SerSess.BaudRate = 19200
SerSess.DataBits = 8
SerSess.Parity = Parity.None
SerSess.StopBits = StopBitType.One
SerSess.FlowControl = FlowControlTypes.None
mbSession = CType(ResourceManager.GetLocalManager().Open(VISAResourceName), MessageBasedSession)
...
mbsession.write(....)
do
if mbsession.read() ="....." then
exit do
end
loop
...
My questions are
1. Why I can't change serial setting such as baudrate, databits, parity, etc using mbsession. Do I have to use another session(SerSess) as above code?
2. I always receive some charaters such as "ACK", "NANK", etc, whenever I send characters to my device. In my code I used "do... loop" to read this respond, but are there any method or event that I know?
Thanks in advance.
메시지가 01-13-2009 08:26 AM
에 djlee에 의해 편집되었음