hi everybody=20
i have problem to connect two ic atmega8535 by using usart=20
i using basic lang=20
the problem is=A0first ic measure temperature then send=A0it to the second =
ic i use command
(print var) in the first ic
i use command (input var) in the second ic then=A0the second ic send data t=
o pc
then=A0the program is repeated again=A0
at the first time command -----(input var)=A0received the data correctly bu=
t when the program repeated this command received the data=A0incorrectly=20
data =3D 0 at second and third and fourth and etc....
i can't find the problem can anyone help me please
i attach the two codes
=A0
=A0
=20=20=20=20=20=20
----------
'****************************=0D
'* controller IC *=0D
'* *=0D
'* written by : *=0D
'* mahmoud ahmed hafez ali *=0D
'****************************=0D
=0D
Dim Q As Single=0D
Config Pind.2 =3D Input=0D
Config Pind.3 =3D Output=0D
'**************************************************************************=
****=0D
Prog:=0D
Wait 2=0D
Set Portd.3=0D
Do=0D
Debounce Pind.2 , 1 , Received , Sub=0D
Loop=0D
Main:=0D
Cls=0D
Goto Prog=0D
End 'end program=0D
'**************************************************************************=
****=0D
Received:=0D
Input Q=0D
Reset Portd.3=0D
Wait 1=0D
Lcd "value =3D" ; Q=0D
Wait 2=0D
Print "temperature =3D" ; Q=0D
Goto Main=0D
Return=0D
'**************************************************************************=
****
----------
'****************************=0D
'* Temperature Sensor *=0D
'* *=0D
'* Written By : *=0D
'* Mahmoud Ahmed Hafez Ali *=0D
'****************************=0D
=0D
=0D
=0D
=0D
=0D
=0D
Dim Digital As Long=0D
Dim Anlog As Single=0D
Config Debounce =3D 30=0D
Config Adc =3D Single , Prescaler =3D Auto , Reference =3D Internal=0D
Config Pind.3 =3D Input=0D
Config Pind.2 =3D Output=0D
'**************************************************************************=
****=0D
C1:=0D
Cls=0D
Locate 1 , 6=0D
Lcd "PROJECT"=0D
Lowerline=0D
Lcd " WEATHER STATION "=0D
Wait 2=0D
'**************************************************************************=
****=0D
C2:=0D
Do=0D
Debounce Pind.3 , 1 , Temp , Sub=0D
Loop=0D
'**************************************************************************=
*****=0D
End=0D
Temp:=0D
Cls=0D
Start Adc=0D
Wait 1=0D
Digital =3D Getadc(0)=0D
Wait 1=0D
Anlog =3D 2.5 * Digital 'temperature =
sensor=0D
Anlog =3D Anlog / 1024=0D
Anlog =3D Anlog / 0.01=0D
Cls=0D
Locate 1 , 1=0D
Lcd "temperature:"=0D
Wait 1=0D
Locate 2 , 1=0D
Lcd Anlog ; "'C"=0D
Wait 2=0D
Set Portd.2=0D
Wait 1=0D
Print Anlog=0D
Reset Portd.2=0D
Goto C2=0D
Return=0D
'**************************************************************************=
****
[Non-text portions of this message have been removed]
------------------------------------

(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )
Well, I for one would have not used BASIC as the language for pogramming.
Where are your subroutines for WAIT and DEBOUNCE?
Do you have an oscilloscope? Have you verified that the correct data is
being sent?
Maybe rewrite the program to make it work with a serial port on a computer
before trying to get another AVR to receive it. A known good serial port can
reveal what the problem might be.
Zack
On Wed, Jun 17, 2009 at 8:24 AM, mahmoud ahmed
wrote:
> hi everybody
> i have problem to connect two ic atmega8535 by using usart
> i using basic lang
> the problem is first ic measure temperature then send it to the second ic i
> use command
> (print var) in the first ic
> i use command (input var) in the second ic then the second ic send data to
> pc
> then the program is repeated again
> at the first time command -----(input var) received the data correctly but
> when the program repeated this command received the data incorrectly
> data = 0 at second and third and fourth and etc....
> i can't find the problem can anyone help me please
> i attach the two codes
>
> ----------
>
> '****************************
> '* controller IC *
> '* *
> '* written by : *
> '* mahmoud ahmed hafez ali *
> '****************************
>
> Dim Q As Single
> Config Pind.2 = Input
> Config Pind.3 = Output
> '******************************************************************************
>
> Prog:
> Wait 2
> Set Portd.3
> Do
> Debounce Pind.2 , 1 , Received , Sub
> Loop
> Main:
> Cls
> Goto Prog
> End 'end program
> '******************************************************************************
>
> Received:
> Input Q
> Reset Portd.3
> Wait 1
> Lcd "value =" ; Q
> Wait 2
> Print "temperature =" ; Q
> Goto Main
> Return
>
> '******************************************************************************
> ----------
>
> '****************************
> '* Temperature Sensor *
> '* *
> '* Written By : *
> '* Mahmoud Ahmed Hafez Ali *
> '****************************
> Dim Digital As Long
> Dim Anlog As Single
> Config Debounce = 30
> Config Adc = Single , Prescaler = Auto , Reference = Internal
> Config Pind.3 = Input
> Config Pind.2 = Output
> '******************************************************************************
>
> C1:
> Cls
> Locate 1 , 6
> Lcd "PROJECT"
> Lowerline
> Lcd " WEATHER STATION "
> Wait 2
> '******************************************************************************
>
> C2:
> Do
> Debounce Pind.3 , 1 , Temp , Sub
> Loop
> '*******************************************************************************
>
> End
> Temp:
> Cls
> Start Adc
> Wait 1
> Digital = Getadc(0)
> Wait 1
> Anlog = 2.5 * Digital 'temperature sensor
> Anlog = Anlog / 1024
> Anlog = Anlog / 0.01
> Cls
> Locate 1 , 1
> Lcd "temperature:"
> Wait 1
> Locate 2 , 1
> Lcd Anlog ; "'C"
> Wait 2
> Set Portd.2
> Wait 1
> Print Anlog
> Reset Portd.2
> Goto C2
> Return
>
> '******************************************************************************
>
> [Non-text portions of this message have been removed]
>
>
>
[Non-text portions of this message have been removed]
------------------------------------
______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.

(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )