na tą chwilę mam tak
Code: [Zaznacz cały] [Rozwiń/Zwiń]
- '-------------------------------------------------------------------------------------------
- 'ODBIÓR DANYCH UART1
- If Ischarwaiting(#RS485_1) > 0 Then 'calls _gotchar and use URXC
- Lcount_1 = Inkey(#RS485_1) 'pobierz znak z bufora
- If Lcount_1 = 13 Or Len(uart_command_1) > 20 Then '20 Then ' jeslii ENTER lub wiecej niz 20 znaków to call uartrx
- Call Uartrx1() 'wywołaj podprogram Uartrx1
- 'Debug "czyszczenie bufora po odebranje komendzie" 'Using a constant will let us change the prompt
- 'clear serialin 'nie sprawdzone
- Uart_command_1 = "" ' koniecznie potrzenbe do czysczenia bufora
- Else 'inaczej
- Uart_command_1 = Uart_command_1 + Chr(Lcount_1) 'kluczowe budowanie bufora
- End If 'koniec warunku
- End If 'koniec warunku
- '-------------------------------------------------------------------------------------------
Code: [Zaznacz cały] [Rozwiń/Zwiń]
- $nocompile
- ' odbiór danych z uart1 RS485_1
- Sub Uartrx1
- Debug #Debug_ , "jestem w uartrx1_"
- Lcount_1 = Split(uart_command_1 , Getcommands_1(1) , " ")
- Debug #Debug_ , "lcount= " ; Lcount_1
- Debug #Debug_ , "Uart_command_1= " ; Uart_command_1
- Debug #Debug_ , "debug uart_command_1= " ; Uart_command_1
- Debug #Debug_ , "debug Getcommands_1(1)= " ; Getcommands_1(1)
- Debug #Debug_ , "debug Getcommands_1(2)= " ; Getcommands_1(2)
- Debug #Debug_ , "debug Getcommands_1(3)= " ; Getcommands_1(3)
- Select Case Getcommands_1
- '-----------------------------------------------------------------------------------------
- Case G1_c_1:
- Debug #Debug_ , "jestem w command 1, case 1 "
- Adres_rs485 = Val(Getcommands_1(1))
- Debug #Debug_ , "odebrany adres urzadzenia: " ; Adres_rs485
- '-----------------------------------------------------------------------------------------
- Case G1_c_2:
- Debug #Debug_ , "jestem w command 1, case 2 "
- komenda_1 = Getcommands_1(2)
- Debug #Debug_ , "odebrana komeda_1: " ; komenda_1
- '-------------------------------------------------------------------------------------
- Case G1_c_3:
- Debug #Debug_ , "jestem w command 1, case 3 " '
- wartosc_1 = Val(Getcommands_1(3))
- Debug #Debug_ , "odebrana wartosc_1: " ; wartosc_1
- '-------------------------------------------------------------------------------------
- 'ponizej NIE USUWAJ TO JEST WAZNE!
- 'jak komenda nie rozpoznana zrób to
- Getcommands_1(1) = ""
- Getcommands_1(2) = ""
- Getcommands_1(3) = ""
- End Select
- 'ponizej NIE USUWAJ TO JEST WAZNE!
- 'jak komenda nei rozpoznana zrób to
- Getcommands_1(1) = ""
- Getcommands_1(2) = ""
- Getcommands_1(3) = ""
- '*******************************************************************************
- End Sub
Code: [Zaznacz cały] [Rozwiń/Zwiń]
- '-------------------------------------------------------------------------------------------
- If Flaga1s = 1 Then 'jeśli Flaga1s jest równa 1
- Flaga1s = 0 'wyzeruj Flaga1s
- Call Mruganie
- Print #RS485_1 , "200 a"
- 'Print #RS485_1 , "200 t"
- End If 'koniec warunku
- '-------------------------------------------------------------------------------------------
pozdrawiam Jacek.