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?
Alles anzeigen
How do i read it then?
BASCOM-Quellcode
- $regfile = "xm256a3bdef.dat"
- $lib "xmega.lib"
- $hwstack = 128
- $swstack = 128
- $framesize = 512
- $external _xmegafix_clear
- $external _xmegafix_rol_r1014
- Const Xtal = 24000000 'tylko tu wpisujemy wymaganą wartość
- Dim Multiplier As Byte
- Multiplier = Xtal / 2000000 'mnożnik x 2Mhz wewn pll
- $crystal = Xtal
- Osc_pllctrl = Multiplier
- Config Priority = Roundrobin , Vector = Application , Hi = Enabled , Med = Enabled
- Config Osc = Enabled , Extosc = Disabled , Pllosc = Enabled
- Config Sysclock = Pll , Prescalea = 1 , Prescalebc = 1_1 ' configure the systemclock ---> use PLL
- Waitms 10
- Const Sdcard = 0
- Const Ctrl = &H01C '&H031C
- Const Horiz = &B00010000_00000000
- Const Modus = 2
- Const Numersd = 12
- Config Submode = New
- #if Sdcard = 1
- $include "Config_MMC.bas"
- $include "Config_AVR-DOS.bas"
- #endif
- Enable Interrupts
- Ddrc = 11111011
- Ddrd = 10111111
- Config Eeprom = Mapped
- Config Spic = Hard , Master = Yes , Mode = 0 , Clockdiv = Clk2 , Data_order = Msb
- 'Open "SPIC" For Binary As #4
- $include "ILI9225decl.bas"
- Vcc Alias Portc.0
- Led Alias Portc.1
- Lcd_cs Alias Portc.2 'CS
- Lcd_dc Alias Portc.3 'RS or DC
- Lcd_reset Alias Portc.4 'Reset
- Config Lcd_dc = Output
- Config Lcd_cs = Output
- Config Lcd_reset = Output
- Config Adca = Free , Convmode = Unsigned , Resolution = 12bit , Prescaler = 128 , Reference = Intvcc , Event_mode = None , Sweep = Ch01 , _
- Ch0_gain = 1 , Ch0_inp = Single_ended , Mux0 = &B00001000 , _
- Ch1_gain = 1 , Ch1_inp = Single_ended , Mux1 = &B00010000
- Config Pind.2 = Input
- Config Portd.3 = Output
- Set Portd.3
- Dim Sms As String * 200
- Dim Cc As Byte
- Config Com3 = 2400 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
- Waitms 10
- Open "com3:" For Binary As #3
- Set Led
- Set Vcc
- Waitms 100
- Call Lcd_init()
- Waitms 40
- Call Lcd_clear(blue)
- Config Priority = Roundrobin , Vector = Application , Lo = Enabled , Med = Enabled
- Enable Interrupts
- Call Lcd_text( "XM256A3B" , 1 , 1 , 2 , White , Blue )
- Print #3 , "XM256A3" ; Chr(13) : Wait 1
- Do
- '
- ' For Cc = 1 To 50
- Sms = Inkey(#3)
- Waitms 500
- Call Lcd_text(sms , 1 , 30 , 2 , White , Blue )
- Close #3
- ' Next
- Loop
- 'end program
- $include "ILI9225kom.bas"
- $include "Font\My6_8.font"
- $include "Font\Font8x8.font"
- $include "Font\Font12x16.font"