Xmega, Cant read more than 2 chars from strings from USART

    Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

    Aufgrund technischer Veränderungen ist der Mailverkehr innerhalb des Forums (Private Nachrichten) nur noch eingeschränkt möglich. Die Einschränkung ist notwendig, um zusätzliche Betriebskosten für das Forum zu vermeiden. Näheres zu den Hintergründen im Thread "Aktuelles zum Forum".Wir bitten um Verständnis.

    Hinweis kann nach Kenntnisnahme deaktiviert werden!

    • Xmega, Cant read more than 2 chars from strings from USART

      Im trying to read datai sending from USART to the same usart, from tx to rx, i can read only 2 first chars from message. No matter what baud.
      How do i read it then?

      BASCOM-Quellcode

      1. $regfile = "xm256a3bdef.dat"
      2. $lib "xmega.lib"
      3. $hwstack = 128
      4. $swstack = 128
      5. $framesize = 512
      6. $external _xmegafix_clear
      7. $external _xmegafix_rol_r1014
      8. Const Xtal = 24000000 'tylko tu wpisujemy wymaganą wartość
      9. Dim Multiplier As Byte
      10. Multiplier = Xtal / 2000000 'mnożnik x 2Mhz wewn pll
      11. $crystal = Xtal
      12. Osc_pllctrl = Multiplier
      13. Config Priority = Roundrobin , Vector = Application , Hi = Enabled , Med = Enabled
      14. Config Osc = Enabled , Extosc = Disabled , Pllosc = Enabled
      15. Config Sysclock = Pll , Prescalea = 1 , Prescalebc = 1_1 ' configure the systemclock ---> use PLL
      16. Waitms 10
      17. Const Sdcard = 0
      18. Const Ctrl = &H01C '&H031C
      19. Const Horiz = &B00010000_00000000
      20. Const Modus = 2
      21. Const Numersd = 12
      22. Config Submode = New
      23. #if Sdcard = 1
      24. $include "Config_MMC.bas"
      25. $include "Config_AVR-DOS.bas"
      26. #endif
      27. Enable Interrupts
      28. Ddrc = 11111011
      29. Ddrd = 10111111
      30. Config Eeprom = Mapped
      31. Config Spic = Hard , Master = Yes , Mode = 0 , Clockdiv = Clk2 , Data_order = Msb
      32. 'Open "SPIC" For Binary As #4
      33. $include "ILI9225decl.bas"
      34. Vcc Alias Portc.0
      35. Led Alias Portc.1
      36. Lcd_cs Alias Portc.2 'CS
      37. Lcd_dc Alias Portc.3 'RS or DC
      38. Lcd_reset Alias Portc.4 'Reset
      39. Config Lcd_dc = Output
      40. Config Lcd_cs = Output
      41. Config Lcd_reset = Output
      42. Config Adca = Free , Convmode = Unsigned , Resolution = 12bit , Prescaler = 128 , Reference = Intvcc , Event_mode = None , Sweep = Ch01 , _
      43. Ch0_gain = 1 , Ch0_inp = Single_ended , Mux0 = &B00001000 , _
      44. Ch1_gain = 1 , Ch1_inp = Single_ended , Mux1 = &B00010000
      45. Config Pind.2 = Input
      46. Config Portd.3 = Output
      47. Set Portd.3
      48. Dim Sms As String * 200
      49. Dim Cc As Byte
      50. Config Com3 = 2400 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
      51. Waitms 10
      52. Open "com3:" For Binary As #3
      53. Set Led
      54. Set Vcc
      55. Waitms 100
      56. Call Lcd_init()
      57. Waitms 40
      58. Call Lcd_clear(blue)
      59. Config Priority = Roundrobin , Vector = Application , Lo = Enabled , Med = Enabled
      60. Enable Interrupts
      61. Call Lcd_text( "XM256A3B" , 1 , 1 , 2 , White , Blue )
      62. Print #3 , "XM256A3" ; Chr(13) : Wait 1
      63. Do
      64. '
      65. ' For Cc = 1 To 50
      66. Sms = Inkey(#3)
      67. Waitms 500
      68. Call Lcd_text(sms , 1 , 30 , 2 , White , Blue )
      69. Close #3
      70. ' Next
      71. Loop
      72. 'end program
      73. $include "ILI9225kom.bas"
      74. $include "Font\My6_8.font"
      75. $include "Font\Font8x8.font"
      76. $include "Font\Font12x16.font"
      Alles anzeigen
    • You all were right receiver couldnt take all at once, on irq it does woks well. No i gota connect it with GSM Module. Thanx all.

      BASCOM-Quellcode

      1. This is code with also code for test IRQ
      2. $regfile = "xm256a3bdef.dat"
      3. '$lib "xmega.lib"
      4. $hwstack = 128
      5. $swstack = 128
      6. $framesize = 512
      7. '$external _xmegafix_clear
      8. '$external _xmegafix_rol_r1014
      9. Const Xtal = 24000000 'tylko tu wpisujemy wymaganą wartość
      10. Dim Multiplier As Byte
      11. Multiplier = Xtal / 2000000 'mnożnik x 2Mhz wewn pll
      12. $crystal = Xtal
      13. Osc_pllctrl = Multiplier
      14. Config Priority = Static , Vector = Application , Lo = Enabled , Med = Enabled , Hi = Enabled
      15. Enable Interrupts
      16. Config Osc = Enabled , Extosc = Disabled , Pllosc = Enabled
      17. Config Sysclock = Pll , Prescalea = 1 , Prescalebc = 1_1 ' configure the systemclock ---> use PLL
      18. Waitms 10
      19. Const Sdcard = 0
      20. Const Ctrl = &H01C '&H031C
      21. Const Horiz = &B00010000_00000000
      22. Const Modus = 2
      23. Const Numersd = 12
      24. Config Submode = New
      25. '*******************************************************************************
      26. #if Sdcard = 1
      27. $include "Config_MMC.bas"
      28. $include "Config_AVR-DOS.bas"
      29. #endif
      30. Enable Interrupts
      31. Ddrc = 11111011
      32. Ddrd = 10111111
      33. Config Eeprom = Mapped
      34. Config Spic = Hard , Master = Yes , Mode = 0 , Clockdiv = Clk2 , Data_order = Msb
      35. Open "SPIC" For Binary As #4
      36. $include "ILI9225decl.bas"
      37. Vcc Alias Portc.0
      38. Led Alias Portc.1
      39. Lcd_cs Alias Portc.2 'CS
      40. Lcd_dc Alias Portc.3 'RS or DC
      41. Lcd_reset Alias Portc.4 'Reset
      42. Config Lcd_dc = Output
      43. Config Lcd_cs = Output
      44. Config Lcd_reset = Output
      45. Config Adca = Free , Convmode = Unsigned , Resolution = 12bit , Prescaler = 128 , Reference = Intvcc , Event_mode = None , Sweep = Ch01 , _
      46. Ch0_gain = 1 , Ch0_inp = Single_ended , Mux0 = &B00001000 , _
      47. Ch1_gain = 1 , Ch1_inp = Single_ended , Mux1 = &B00010000
      48. 'Config Dma = Enabled , Doublebuf = Disabled , Cpm = Rr ' enable DMA
      49. 'Config Dmach0 = Enabled , Burstlen = 8 , Chanrpt = Enabled , Tci = Off , Eil = Off , Sar = None , Sam = Inc , Dar = Transaction , Dam = Inc , Trigger = 0 , _
      50. 'Btc = 32720 , Repeat = 0 , Sadr = Varptr(adcb_ch0res) , Dadr = Varptr(adcb_ch0res) 'SPIC_DATA
      51. Config Pind.2 = Input
      52. Config Portd.3 = Output
      53. Set Portd.3
      54. Dim Content As String * 200
      55. Dim Sms As String * 200
      56. Dim Cc As Byte
      57. Config Com3 = 9600 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
      58. Open "com3:" For Binary As #3
      59. Config Serialin3 = Buffered , Size = 200
      60. Config Serialout3 = Buffered , Size = 200
      61. On Usartd0_rxc Rxc_isr
      62. Enable Usartd0_rxc , Lo
      63. Set Led
      64. Set Vcc
      65. Waitms 100
      66. Call Lcd_init()
      67. Waitms 40
      68. Call Lcd_clear(blue)
      69. Call Lcd_text( "XM256A3B" , 1 , 1 , 1 , White , Blue )
      70. Print #3 , "Abcdefghi123"
      71. Cc = 1
      72. Do
      73. 'Call Lcd_text( " " , 5 , 20 , 1 , White , Blue )
      74. Call Lcd_text( " " , 1 , 30 , 3 , White , Blue )
      75. ' For Cc = 1 To 50
      76. Waitms 200
      77. Loop
      78. 'end program
      79. $include "ILI9225kom.bas"
      80. $include "Font\My6_8.font"
      81. $include "Font\Font8x8.font"
      82. $include "Font\Font12x16.font"
      83. $include "Font\Digital14x24.font"
      84. $include "Font\Digital20x32.font"
      85. $include "Font\bc12x24.font" 'impact font
      86. Rxc_isr:
      87. ' Sms = Inkey(#4)
      88. Tmp = "IRQ"
      89. Call Lcd_text(tmp , 130 , Cc , 1 , Red , Blue )
      90. Cc = Cc + 10
      91. Sms = Inkey(#3 , 200) ', Noecho
      92. Content = Content + Sms
      93. Call Lcd_text(content , 1 , 30 , 3 , White , Blue )
      94. Return
      Alles anzeigen

      Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von Jackjack ()