Hi,
kleiner Tip!
Benutze die Software RS232... als zweite Schnittstelle
Code:
'Microcontroller
'------------------
$regfile = "m32def.dat"
$crystal = 16000000
$baud = 9600
'I2C Pins
'------------------
Config Scl = Portc.0
Config Sda = Portc.1
'I2C LCD-Display
'------------------
Const Pcf8574_lcd = &H70
$lib "Lcd_i2c.lib"
Dim _lcd_e As Byte
_lcd_e = 128
Wait 1
Config Lcd = 16 * 4
Cls
Locate 1 , 1 : Lcd "Start R-RTOS." : Wait 1
Locate 1 , 14 : Lcd "." : Wait 1
Locate 1 , 15 : Lcd "."
'RS232 HW und Soft
'---------------------
Config Serialin = Buffered , Size = 20
Dim Soft_input As String * 1
Dim Hw_input As String * 1
Hw_input = " "
'software UART einstellen und öffnen
Open "comd.2:9600,8,n,1" For Output As #1
Open "comd.3:9600,8,n,1" For Input As #2
On Int1 Soft_uart
Enable Int1
Config Int1 = Falling
Enable Interrupts
Do
gosub Hw_uart
gosub Soft_uart
'Dein Programm
loop
'-------------------------------------------------------------------------------
'***| HW UART mit Buffer |******************************************************
'-------------------------------------------------------------------------------
Hw_uart:
If Ischarwaiting() = 1 Then
Hw_input = Waitkey()
Datenstrom = Datenstrom + Hw_input
End If
Return
'-------------------------------------------------------------------------------
'***| Software UART ISR |*******************************************************
'-------------------------------------------------------------------------------
Soft_uart:
Soft_input = Inkey(#2)
'Print #1 , Soft_input
Return
musst mal bissl rumspielen ich habs nicht getestet müsst aber laufen.
Bye Ulli
Lesezeichen