Hi,
I'm managing the serial comunizazione between ATMEGA32 and a wifi module (WIZFi210) ...
I found the attached code, and I'm adjusting to a micro ATmega32 ...
It gives me an error on this statement: "Eifr.intf1 = 1" ... why?
The rest of the code is good for ATmega32??
[code:1:853c4a45fb]'$regfile = "m1280def.dat"
' $crystal = 16000000
' $baud = 115200
$regfile = "m32def.dat" '"m644def.dat"
$crystal = 16000000
$baud = 115200
$hwstack = 80
$swstack = 80
$framesize = 90
Config Graphlcd = 240 * 64 , Dataport = Porta , Controlport = Portc , Ce = 4 , Cd = 3 , Wr = 6 , Rd = 5 , Reset = 2 , Fs = 2 , Mode = 6
Config Portd.2 = Output 'BUZZER
Buzzer Alias Portd.2
Declare Sub Bip
'Poweroff Alias Portj.1
'Config Poweroff = Output
Dim Connect As Byte
'put power on the shield
'Set Poweroff
'Wait 5
'Reset Poweroff
'PD.0 = TX
Open "comd.0:115200,8,n,1" For Output As #10
'PD.1 = RX
Open "comd.1:115200,8,n,1" For Input As #11
'-------------------------------------------------------------------------------
' HARDWARE SERIAL
'-------------------------------------------------------------------------------
Config Serialin = Buffered , Size = 60 , Bytematch = 13
Open "com1:" For Binary As #1
Dim Incoming_data As String * 60
Print #1 , "Start programma"
'-------------------------------------------------------------------------------
' INT0 RX INTERRUPT
'-------------------------------------------------------------------------------
Dim Timeout_rx As Word
Dim Rx_ok As Byte
On Int1 Isr_rx Nosave
Config Int1 = Change
Enable Int1
Enable Interrupts
'-------------------------------------------------------------------------------
' VARIABLES
'-------------------------------------------------------------------------------
Dim B As Byte
Dim Pos As Byte
Const Max_rx = 100
Dim Incoming_str As String * 150
Dim Incoming(max_rx) As Byte At Incoming_str Overlay
'-------------------------------------------------------------------------------
' START PROGRAM
'-------------------------------------------------------------------------------
Cursor Off
Cls
Bip
Locate 1 , 1
Lcd "Test Wizfi210 "
Print #1 , "TEST WIZFI210"
Do
Connect = Instr(incoming_str , "[CONNECT 0]")
If Connect = 3 Then
Print #1 , "Connected"
Exit Do
End If
Waitms 10
Loop
Do
Wait 1
Print #10 , "abcdefg"
Loop
End
'-------------------------------------------------------------------------------
' send USB RX to WIZ
'-------------------------------------------------------------------------------
Serial0charmatch:
' send command from USB to WIZ610
Input Incoming_data Noecho
'Print #10 , Incoming_data
Return
'-------------------------------------------------------------------------------
' RX from WIZ on SoftSer
'-------------------------------------------------------------------------------
Isr_rx:
Disable Int1
Timeout_rx = 0
Incoming_str = ""
Pos = 1
Do
B = Inkey(#11)
If B > 0 Then
If Pos < 120 Then
Incoming(pos) = B
Incr Pos
End If
Timeout_rx = 0
Else
Incr Timeout_rx
End If
Loop Until Timeout_rx = &H1FFF
'set string end position!
Incoming(pos) = 0
Print #1 , Incoming_str
Print #1 , "-"
Rx_ok = 1
'clear INT0 Int Flag, because int can be flaged in meantime!
Eifr.intf1 = 1
Enable Int1
Return
Sub Bip
Buzzer = 0
Waitms 20
Buzzer = 1
End Sub[/code:1:853c4a45fb]
[b:853c4a45fb][color=red:853c4a45fb](BASCOM-AVR version : 2.0.7.6 )[/b:853c4a45fb][/color:853c4a45fb]
↧