Mam 2 atmegi. Jedna to atmega8 a druga atmega16. Używam Uart programowy i nie wiem dlaczego nie działa.
Poniżej kod programu w bascomie dla nadajnika
Config Adc = Single , Prescaler = Auto , Reference = Internal
Config Pinb.0 = Output
Config Pind.6 = Output
Config Pind.7 = Output
Config Pind.3 = Input
Config Pind.4 = Output
Portd.3 = 1
Open "Comd.3:1200,8,n,1" For Input As #1
Open "Comd.4:1200,8,n,1" For Output As #2
Dim Licznik As Word
Dim Mic As Integer
Dim Tempin As Integer
Dim Tempout As Integer
Start Adc
Do
Incr Licznik
If Licznik = 20000 Then
Licznik = 0
Tempin = Getadc(5)
Mic = Getadc(4)
Tempout = Getadc(3)
Print #2 , Tempin
End If
Loop
End
Dla odbiornika:
Config Portc = &B10001000
Config Portd = &B01110000
Config Lcd = 16 * 2
Config Pina.4 = Input
Config Pina.5 = Output
Porta.4 = 1
Config Adc = Single , Prescaler = Auto , Reference = Off
Open "Coma.4:1200,8,n,1" For Input As #1
Open "Coma.5:1200,8,n,1" For Output As #2
Dim A As Integer
Dim Tempin As Integer
Portc = &B11111111
Portd = &B11001111
Start Adc
Do
waitms 100
Input #1 , Tempin
Cls
Lcd tempin
Loop
End
Co tu jest źle?
Czy ktoś umie mi pomóc??
Poniżej kod programu w bascomie dla nadajnika
Config Adc = Single , Prescaler = Auto , Reference = Internal
Config Pinb.0 = Output
Config Pind.6 = Output
Config Pind.7 = Output
Config Pind.3 = Input
Config Pind.4 = Output
Portd.3 = 1
Open "Comd.3:1200,8,n,1" For Input As #1
Open "Comd.4:1200,8,n,1" For Output As #2
Dim Licznik As Word
Dim Mic As Integer
Dim Tempin As Integer
Dim Tempout As Integer
Start Adc
Do
Incr Licznik
If Licznik = 20000 Then
Licznik = 0
Tempin = Getadc(5)
Mic = Getadc(4)
Tempout = Getadc(3)
Print #2 , Tempin
End If
Loop
End
Dla odbiornika:
Config Portc = &B10001000
Config Portd = &B01110000
Config Lcd = 16 * 2
Config Pina.4 = Input
Config Pina.5 = Output
Porta.4 = 1
Config Adc = Single , Prescaler = Auto , Reference = Off
Open "Coma.4:1200,8,n,1" For Input As #1
Open "Coma.5:1200,8,n,1" For Output As #2
Dim A As Integer
Dim Tempin As Integer
Portc = &B11111111
Portd = &B11001111
Start Adc
Do
waitms 100
Input #1 , Tempin
Cls
Lcd tempin
Loop
End
Co tu jest źle?
Czy ktoś umie mi pomóc??