have a look at datasheet: PortB.2 = INT2
so try to use interrupt to get the rs232 chars.
[code:1:e6750a4f4b]
'-------------------------------------------------------------------------------
' INT2 RX INTERRUPT
'-------------------------------------------------------------------------------
Dim Timeout_rx As Word
Dim Rx_ok As Byte
On Int2 Isr_rx Nosave
Config Int2 = Change
Enable Int2
Enable Interrupts
do
....
loop end
'-------------------------------------------------------------------------------
' RX from WIZ on SoftSer
'-------------------------------------------------------------------------------
Isr_rx:
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
Return
[/code:1:e6750a4f4b]
↧