I'm working on receive interrupt uart and I wanna store all of data as a string . I also catch data (one by one) byte until receiving ETX . When I catch ETX ,it means end of datas. unfortunately, my code doesn't work correctly and I catch incomplete datas in rcv_str_485 but rcv_array_485 is complete. that's strange and I beyond confused. I don't know what should I do for having datas as string . here is my variables :
Dim Rcv_str_485 As String * 1300
Dim Rcv_array_485(1300) As Byte At Rcv_str_485 Overlay
and here is my receive function:
Usart_rs485:
Rcv_485 = Usartf0_data
Select Case Num_data_485
Case 1:
Case 2:
Rcv_array_485(rcv_counter_485) = Rcv_485
Rcv_counter_485 = Rcv_counter_485+1
If Rcv_485 = 03 Then
Num_data_485 = 3
End If
Case 3:
Rcv_array_485(rcv_counter_485) = 0
Waitus 10
Rcv_complate_flag_485 = 1
Num_data_485 = 2
Rcv_counter_485 = 0
End Select
Return