logo elektroda
logo elektroda
X
logo elektroda
REKLAMA
REKLAMA
Adblock/uBlockOrigin/AdGuard mogą powodować znikanie niektórych postów z powodu nowej reguły.

Atmega8 UART - trudne początki :)

e123 30 Sie 2009 16:22 2036 1
REKLAMA
  • #1 6960965
    e123
    Poziom 10  
    Witam,

    Od wczoraj próbuję uruchomić symulację w Bascom-AVR i nic :(

    Oto mój kod do odbierania danych:

    
    $sim                                                        '----tylko do testu na kompie
    $regfile = "m8def.dat"
    $crystal = 8000000
    $baud = 9600
    
    
    Dim A As String * 1
    
    Config Serialin = Buffered , Size = 20
    
    Enable Interrupts
    
    Print "Start"
    Do
    If Ischarwaiting() = 1 Then
          A = Waitkey()
          Print "Odczytano:"
          Print Chr(a)
       End If
    
       Waitms 100
    Loop
    End
    


    Kompiluje i odpalam w symulatorze. Odpalam też Terminal symulator piszę 'a' i nic się nie dzieje.

    Atmega8 UART - trudne początki :)

    Proszę o jakąś radę co mogę nie tak robić.

    PS nie wiem czy to istotne ale symulacja działa na COM3
  • REKLAMA
  • #2 6961184
    dturczak
    Poziom 19  
    szefie wszystko ok,ale chyba wlaczasz symulator nie tam gdzie trzeba ;)

    Atmega8 UART - trudne początki :)

    Po skompilowaniu programu uruchamiasz symulator z Menu Program->Simulate tak jak na obrazku powyzej.Nastepnie przycisk Play(F5).Symulacja uruchamia sie a Ty mozesz korzystac z emulowanego Uarta ale tylko w TYM oknie...

    dzialajacy kod z obrazka powyzej:

    
    $sim
    $regfile = "m48def.dat"                                     ' specify the used micro
    
    $crystal = 4000000                                          ' used crystal frequency
    
    $baud = 9600                                                ' use baud rate
    
    $hwstack = 32                                               ' default use 32 for the hardware stack
    
    $swstack = 10                                               ' default use 10 for the SW stack
    
    $framesize = 40                                             ' default use 40 for the frame space
    
    
    
    Dim A As Byte , S As String * 2
    
    Do
    
      A = Ischarwaiting()
    
      If A = 1 Then                                             'we got something
    
         A = Waitkey()                                          'get it
    
        Print "ASCII code " ; A ; " from serial"
    
      End If
    
    Loop Until A = 27
    


    ps. na twoim kodzie tez dziala ;)
REKLAMA