hello i m using arm9 s3c2440 kit.using modbus protocol in vb .net2005 i m writing code for serial communication with other controller where i m setting value in its register for driving a motor.there also exists a RS232 to RS485 converter between my arm9 board and controller. Now when i compile my code n deploy the application over arm board n sets the value using modbus array then the value does get set n motor also get started with that frequency,but s soon as motor gets started after few seconds may b 5-10 the application crashes,and connection between arm board and pc which is through ACTIVE SYNC also breaks.I wanted to write random values of freq on controller 1 after the other,which is not happening due to crash. can some1 plzz tell me what the problem could be ??? thanks in advance Kapil
application keeps crashing
Without the application's code is almost impossible to answer something useful... If your application crushes, of course you have an error on you code, even if it's caused by hardware... your application should support it. Sérgio
hi, thanks for reply. @Edge11 :- yes thats my thaught too but dont know how to cross check the thing.so did tried without motor on simulator and the results are opposite that is this time it does not crash. @TheSergon13 :- well here is app code that i m trying...... for conneting the ports.... Private Sub Connect_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConnect.Click If SerialComm.IsOpen Then SerialComm.Close() End If Try 'Try catch for exception handling With SerialComm .PortName = "COM1" .BaudRate = 9600 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.Two End With SerialComm.Open() Catch ex As Exception MsgBox(ex.ToString) End Try AND for driving the motor using modbus structure is gModFrame(0) = &H1 ' Slave address gModFrame(1) = &HF ' Write multiple coils gModFrame(2) = &H0 ' Start address of coil gModFrame(3) = &H0 gModFrame(4) = &H0 ' No.of coils to write gModFrame(5) = &H20 ' gModFrame(6) = &H4 ' No. of bytes gModFrame(7) = &H7C ' Control word data lower order 8-1 gModFrame(8) = &H4 ' Speed reference Motor started with 0 freq. higher order 16-9 gModFrame(9) = &H0 ' Speed reference Motor started with 0 freq. gModFrame(10) = &H4 Call CRC_Calc(11) gModFrame(11) = Convert.ToByte((gCRC_Val And 255)) ' Low byte CRC value gModFrame(12) = Convert.ToByte((gCRC_Val >> 8)) ' High byte CRC value Try If (gSerialComm.IsOpen) Then gSerialComm.Write(gModFrame, 0, 13) End If Catch ex As Exception MsgBox(ex.ToString) End Try Array.Clear(gModFrame, 0, gModFrame.Length) Call Delay() 'Delay function called so that responce from Slave is received End Sub could u plz help me with the delay part too i've read abt it in a pdf acc to which delay should be 3.5 char long which approx to 4ms at 9600 baud.but currently i'vr written a random code which is Private Sub Delay() Dim i, j As New Integer Timer1.Enabled = True For j = 0 To 5 Step +1 For i = 0 To 16000 Step +1 Next i Next j End Sub i also tried using timer control but that didnt go as expected thanks in advance Kapil
1 thing that forgot inform is whenevr the app crashes then there is only 1 option to come back in editing mode in code by manually disconnect or stop.and from this point onwards the connection between arm board n my pc also gets break (which is using active sync s/w) n gets too much of time rather rebooting of arm board and some times pc too. Kapil
Hi Kapil, I'm not very good at vb, and I could not figure out the error. My suggestion is to use the debugger to and see what's failing, or use a label and keep printing status messages to it. When it crashes, you will see where it stopped (Don't use messageboxes, use fast methods). About the delay, the method you used is very inaccurate 'cause the time depends on the actual processor activity :) I had the same problem sometime ago and I solved it with a dll in C and exporting the Sleep function. But to you, the best way really is to program a Timer. Be careful 'cause you're using small time intervals, and it is necessary a little time to execute the code + time interval. If needed reduce the timer interval. Regards Sérgio