ATXMEGa32A4AU problem z uart
: 06 gru 2021, 10:18
Witam , problem polega na odczytywaniu tylko 2 bajtów z bufora uart , wysyłając 5 zaków np.12345 na wyświetlaczu pojawią się tylko 12 a reszty po prostu nie ma . Czy ktoś napotkał podobny problem ...
Code: [Zaznacz cały] [Rozwiń/Zwiń]
- $regfile = "xm32a4udef.dat"
- $crystal = 32000000
- $hwstack = 32
- $swstack = 32
- $framesize = 32
- Debug Off
- Config Submode = New
- Config Eeprom = Quick
- $lib "xmega.lib"
- $external _xmegafix_clear
- $external _xmegafix_rol_r1014
- Config Osc = Disabled , 32mhzosc = Enabled , 32khzosc = Enabled 'We use internal 32MHz
- Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1 'Internal 32MHz, no prescaler
- Config Priority = Static , Vector = Application , Lo = Enabled 'Init Interrupts
- Config Com3 = 38400 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
- Config Serialin3 = Buffered , Size = 32 , Bytematch = None
- Open "COM3:" For Binary As #3
- Enable Interrupts
- Config Lcd = 16 * 2 , Chipset = Dogm162v5
- Config Lcdpin = Pin , Db4 = Porta.4 , Db5 = Porta.5 , Db6 = Porta.6 , Db7 = Porta.7 , E = Porta.3 , Rs = Portb.0
- Cursor Off
- Cls
- Dim L1 As Byte
- Dim Comm As String * 8
- Dim Buf As Byte
- Dim Znak As Byte
- Do
- If Ischarwaiting(#3) > 0 Then
- Do
- Znak = Inkey(#3)
- Select Case Znak
- Case 10 :
- Case 13 :
- Case Else
- Comm = Comm + Chr(znak)
- End Select
- Buf = Ischarwaiting(#3)
- Loop Until Buf = 0
- End If
- Incr L1
- Cls
- Locate 1 , 1 : Lcd Comm
- Locate 2 , 1 : Lcd L1
- Comm = ""
- Wait 1
- Loop