Posted: Wed May 03, 2006 9:39 pm Post subject: Serial port interrupt
I have a problem with serial port interrupt. In this code the serial interrupt is always working. I've tried with instruction "Clr scon.0" for clear the interrup but it isn't work. A similar code in Bascom AVR works fine, but i have an application with AT89S8252 for this.
$crystal = 12000000
$baud = 4800
'Ledout Alias P3.7
On Serial Intser
Dim Ini_rx As Bit , Serdata As String * 10
Dim Nuevodato As Bit
'*****************************************************************************
' Programa Principal
Enable Serial
Enable Interrupts
'Lazo de programa principal
Do
If Nuevodato = 1 Then
Print Serdata
Reset Nuevodato
End If
Loop
Intser:
Select Case Sbuf
Case "S":
Ini_rx = 1
Serdata = ""
Case 13:
Ini_rx = 0
Serdata = Serdata + Chr(0)
Set Nuevodato
Case Is > 35:
If Ini_rx = 1 Then
Serdata = Serdata + Chr(sbuf)
End If
End Select
clr scon.0
Return
Joined: 25 May 2004 Posts: 190 Location: Ljubljana, Slovenia
Posted: Fri May 05, 2006 10:59 am Post subject: If
If you communicate with another 8051 like uP who also has 12Mhz crystal, then it si OK,
If you communicate to the device whics sends data at real (not approcsimate) 4800Bdm then your uP does not reads and sends data at 4800 Bd, but approximately 10% faster.
For real 4800 Bd or any other you need cristal with frequency 11059200 Hz!
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum