dear friends,
i am new to serial communication in bascom avr i have used the below code & chip atmega 32
$regfile = "m32def.dat"
$crystal = 4000000
$baud = 9600
$hwstack = 32
$swstack = 16
$framesize = 50
Dim A As Byte , A1 As String * 1 , S As String * 32 , I As Byte , Dum As Byte , K As Byte
Open "comd.6:9600" For Output As #1 'p3.1 is normally used for tx so testing is easy
Open "comd.7:9600" For Input As #2 'p3.0 is normally used for RX so testing is easy
S = "communication started " 'assign string
Dum = Len(s) 'get length of string
For I = 1 To Dum 'for all characters from left to right
A1 = Mid(s , I , 1) 'get character
A = Asc(a1)
Put #1 , A
'write it to comport
Next
Do
Print S
S = "communiation1 " 'assign string
Dum = Len(s)
For K = 1 To 16 'get length of string
For I = 1 To Dum 'for all characters from left to right
A1 = Mid(s , I , 1) 'get character
A = Asc(a1)
Put #1 , A
'write it to comport
Next I
Next K
Get #2 , A
'A = " Hello" 'get character from comport
' Get #2 , A Timeout = 1000 'get character from comport
'unmark the line above to get the timeout option
Put #1 , A 'write it back
'Print A
Loop
'now PRINTBIN & INPUTBIN are supported
Printbin #1 , A
Inputbin #2 , A
Close #1 ' finally close device
Close #2
End
it shows some thingh garbage value in hyperterminal
my software version is 1.11.9.0[/code]
[b:a9b7301305][color=red:a9b7301305](BASCOM-AVR version : 2.0.7.6 )[/b:a9b7301305][/color:a9b7301305]
↧