PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Software UART öffnen...



EDatabaseError
09.06.2007, 20:05
Readeeprom Baud_com1 , W1
Incr W1
Incr W1
Readeeprom Baud_com2 , W1
Incr W1
Incr W1
Readeeprom Databits_com1 , W1
Incr W1
Readeeprom Databits_com2 , W1
Incr W1
Readeeprom Parity_com1 , W1
Incr W1
Readeeprom Parity_com2 , W1
Incr W1
Readeeprom Stopbits_com1 , W1
Incr W1
Readeeprom Stopbits_com2 , W1
Incr W1

'--- [ Open Communication ports ] ----------------------------------------------
S1 = "COMD.7:" ; Str(baud_com1) ; "," ; Str(databits_com1) ; "," ; Chr(parity_com1) ; "," ; Str(stopbits_com1)
Open S1 For Output As #1

Damit versuche ich ein Software UART zu öffnen. Leider bekomm ich 3 Feher in den letzten 2 Zeilen.

Invalid datatype[200]
Variable not dimensioned 200->0
Invalid datatype[0]

Warum?!?

Lunarman
09.06.2007, 21:51
wenn das dein ganzer Code ist kann das gar nicht funktionieren. Dim S1 as (weiß nich)??? Würde eventuell helfen.

Und eventuell würd ich auch erwägen W1 erstmal zu dimeln.

Ist überhaupt notwendig, alles ausm eeprom zu lesen? wenn nicht, würd ichs lassen und es hardcoden.

EDatabaseError
09.06.2007, 22:20
'--- [ Dim. Variables ] --------------------------------------------------------
Dim Address As Byte 'Aktuelle Moduladresse
Dim New_address As Byte 'Nach Start eingestellte Moduladresse ! nicht aktuell

Dim Channel As Byte 'Aktueller Kanal
Dim New_channel As Byte 'Nach Start eingestellter Kanal ! nicht aktuell

Dim Baud_com1 As Integer 'Baudrate fuer Com1
Dim Baud_com2 As Integer 'Baudrate fuer Com2
Dim Databits_com1 As Byte 'DataBits fuer Com1
Dim Databits_com2 As Byte 'DataBits fuer Com2
Dim Parity_com1 As Byte 'Parity fuer Com1
Dim Parity_com2 As Byte 'Parity fuer Com2
Dim Stopbits_com1 As Byte 'StopBits fuer Com1
Dim Stopbits_com2 As Byte 'StopBits fuer Com2

Dim Buffer_ps2 As String * 20 'Buffer fuer PS2
Dim Buffer_com1 As String * 20 'Buffer fuer Com1
Dim Buffer_com2 As String * 20 'Buffer fuer Com2
Dim Buffer_radio As String * 20 'Buffer fuer Funkuebertragung

Dim Datatosendbuffer(10) As String * 20 'Buffer fuer Daten welche gesendet werden sollen

'Helping Variables

Dim I1 As Integer
Dim I2 As Integer
Dim B1 As Byte
Dim B2 As Byte
Dim W1 As Byte
Dim W2 As Byte
Dim S1 As String * 20

'--- [ Constants ] -------------------------------------------------------------
Const Radio_begin = "<"
Const Radio_end = ">"

'--- [ Read eeram ] ------------------------------------------------------------
'0: Baud_COM1 Word 0
'1: Baud_COM1 Word 1
'2: Baud_COM2 Word 0
'3: Baud_COM2 Word 1
'4: DataBits_COM1 Byte 0
'5: DataBits_COM2 Byte 0
'6: Parity_COM1 Char/Byte 0
'7: Parity_COM2 Char/Byte 0
'8: StopBits_COM1 Byte 0
'9: StopBits_COM2 Byte 0

W1 = 0
Readeeprom Baud_com1 , W1
Incr W1
Incr W1
Readeeprom Baud_com2 , W1
Incr W1
Incr W1
Readeeprom Databits_com1 , W1
Incr W1
Readeeprom Databits_com2 , W1
Incr W1
Readeeprom Parity_com1 , W1
Incr W1
Readeeprom Parity_com2 , W1
Incr W1
Readeeprom Stopbits_com1 , W1
Incr W1
Readeeprom Stopbits_com2 , W1
Incr W1

'--- [ Open Communication ports ] ----------------------------------------------
'S1 = "COMD.7:" ; Str(baud_com1) ; "," ; Str(databits_com1) ; "," ; Chr(parity_com1) ; "," ; Str(stopbits_com1)
Open "COMD.7:9600,8,n,1" For Output As #1 'SUART2.TXD
Open "COMD.6:9600,8,n,1" For Input As #2 'SUART2.RXD
Open "COMD.5:9600,8,n,1" For Output As #3 'SUART1.TXD
Open "COMD.4:9600,8,n,1" For Input As #4 'SUART1.RXD

Das mit dem Eprom is notwendig

peterfido
10.06.2007, 10:50
Dim W1 As Byte
Dim S1 As String * 16
Dim Baud_com1 As Integer
Dim Baud_com2 As Integer
Dim Databits_com1 As Byte
Dim Databits_com2 As Byte
Dim Parity_com1 As Byte
Dim Parity_com2 As Byte
Dim Stopbits_com1 As Byte
Dim Stopbits_com2 As Byte

Readeeprom Baud_com1 , W1
Incr W1
Incr W1
Readeeprom Baud_com2 , W1
Incr W1
Incr W1
Readeeprom Databits_com1 , W1
Incr W1
Readeeprom Databits_com2 , W1
Incr W1
Readeeprom Parity_com1 , W1
Incr W1
Readeeprom Parity_com2 , W1
Incr W1
Readeeprom Stopbits_com1 , W1
Incr W1
Readeeprom Stopbits_com2 , W1
Incr W1

'--- [ Open Communication ports ] ----------------------------------------------
S1 = "COMD.7:" + Str(baud_com1) + "," + Str(databits_com1) + "," + Chr(parity_com1) + "," + Str(stopbits_com1)
'Open S1 For Output As #1



Besonders die Zeile:


S1 = "COMD.7:" + Str(baud_com1) + "," + Str(databits_com1) + "," + Chr(parity_com1) + "," + Str(stopbits_com1)
[/code]

EDatabaseError
10.06.2007, 12:19
S1 = "COMD.7:" + Str(baud_com1) + "," + Str(databits_com1) + "," + Chr(parity_com1) + "," + Str(stopbits_com1)
Open S1 For Output As #2 'SUART2.TXD

Hab ich nun überarbeitet.
Nun bekomme ich vom Compiler 2 mal
External routine not found
und 2 mal
Label not found

Bei beiden handelt sich es um
_FILEOPEN_OUTPUT
_FILECLOSE

Schaft das der Compiler etwa nicht?!?

peterfido
10.06.2007, 21:47
Kann ich so nicht nachvollziehen. Dazu brauche ich mehr Code

EDatabaseError
10.06.2007, 23:26
:wall:

Compiliers doch selber mal:


'--- [ Init. Compiler ] --------------------------------------------------------
$regfile = "m32def.dat" 'Chip Mega32
$crystal = 16000000 '16 MHz
$baud = 9600 'Baudrate UART0 / Funk

'--- [ Init. Devices ] ---------------------------------------------------------
'--- [ Dim. Variables ] --------------------------------------------------------
Dim Baud_com1 As Integer 'Baudrate fuer Com1
Dim Baud_com2 As Integer 'Baudrate fuer Com2
Dim Databits_com1 As Byte 'DataBits fuer Com1
Dim Databits_com2 As Byte 'DataBits fuer Com2
Dim Parity_com1 As Byte 'Parity fuer Com1
Dim Parity_com2 As Byte 'Parity fuer Com2
Dim Stopbits_com1 As Byte 'StopBits fuer Com1
Dim Stopbits_com2 As Byte 'StopBits fuer Com2

Dim Buffer_ps2 As String * 20 'Buffer fuer PS2
Dim Buffer_com1 As String * 20 'Buffer fuer Com1
Dim Buffer_com2 As String * 20 'Buffer fuer Com2
Dim Buffer_radio As String * 20 'Buffer fuer Funkuebertragung

Dim Datatosendbuffer(10) As String * 20 'Buffer fuer Daten welche gesendet werden sollen

Dim Online As Bit 'Is module connected to server
Online = 0 'not connected yet
Dim Error As Byte 'error?
Error = 0 'set module -> no error
Dim Voltage As Word 'Betriebsspannung
Dim Rssi_adc As Word 'RSSI
Dim Rssi_percent As Byte 'RSSI

'Helping Variables

Dim I1 As Integer
Dim I2 As Integer
Dim B1 As Byte
Dim B2 As Byte
Dim W1 As Byte
Dim W2 As Byte
Dim S1 As String * 20

'--- [ Constants ] -------------------------------------------------------------
Const Radio_begin = "<"
Const Radio_end = ">"

'--- [ Read eeram ] ------------------------------------------------------------
'0: Baud_COM1 Word 0
'1: Baud_COM1 Word 1
'2: Baud_COM2 Word 0
'3: Baud_COM2 Word 1
'4: DataBits_COM1 Byte 0
'5: DataBits_COM2 Byte 0
'6: Parity_COM1 Char/Byte 0
'7: Parity_COM2 Char/Byte 0
'8: StopBits_COM1 Byte 0
'9: StopBits_COM2 Byte 0

W1 = 0
Readeeprom Baud_com1 , W1
Incr W1
Incr W1
Readeeprom Baud_com2 , W1
Incr W1
Incr W1
Readeeprom Databits_com1 , W1
Incr W1
Readeeprom Databits_com2 , W1
Incr W1
Readeeprom Parity_com1 , W1
Incr W1
Readeeprom Parity_com2 , W1
Incr W1
Readeeprom Stopbits_com1 , W1
Incr W1
Readeeprom Stopbits_com2 , W1
Incr W1

'--- [ Open Communication ports ] ----------------------------------------------
S1 = "COMD.7:" + Str(baud_com1) + "," + Str(databits_com1) + "," + Chr(parity_com1) + "," + Str(stopbits_com1)
Open S1 For Output As #2 'SUART2.TXD
Open "COMD.6:9600,8,n,1" For Input As #3 'SUART2.RXD
Open "COMD.5:9600,8,n,1" For Output As #4 'SUART1.TXD
Open "COMD.4:9600,8,n,1" For Input As #5 'SUART1.RXD

peterfido
11.06.2007, 20:24
Der Compiler scheint da keine Variablen zu aktzeptieren. Wieso musst du die Werte aus dem EEPROM lesen? ansonsten nimm doch vorgefertigte und je nach dem gespeicherten Wert im EEPROM werden diese dann geöffnet

EDatabaseError
11.06.2007, 20:27
Es ist notwendig weil es sich dabei um ein Gerät handelt welche diese funktion unterstützen muss.
Zu zweiterem:
Das wäre unprofessionel...müsste aber vom compiler unterstützt werden. Ich werde MCS kontaktieren.