Versuche das mal so zB Print "raggy";
ansonsten kommen die steuerzeichen für neue Zeile mit glaube chr(10)
chr(13)
raggy
Versuche das mal so zB Print "raggy";
ansonsten kommen die steuerzeichen für neue Zeile mit glaube chr(10)
chr(13)
raggy
Code:$regfile = "m32def.dat" $crystal = 8000000 $baud = 9600 Config Portc = Output Config Lcdpin = Pin , Db4 = Portb.4 , Db5 = Portb.5 , Db6 = Portb.6 , Db7 = Portb.7 , E = Portb.3 , Rs = Portb.2 Config Lcd = 40 * 2 Dim Test As String * 10 Portc.0 = 0 Cls ' Clear the LCD display Do Inputbin Test Locate 1 , 1 Lcd Test Loopalso oben erst senden, dann Empfang. zum Testen ob der Bus in Ordnung ist! Hab ich auch erst so probiert.Ist zwar nicht schön Programiert aber es muss so klappen.Code:$regfile = "m32def.dat" $crystal = 8000000 $baud = 9600 'Config Lcdpin = Pin , Db4 = Portc.0 , Db5 = Portc.1 , Db6 = Portc.2 , Db7 = Portc.3 , E = Portc.5 , Rs = Portc.4 'Config Lcd = 40 * 2 Config Portc = Output Portc.0 = 1 ' RS485 Treiber auf senden Do Print "AVR-Atmega" ; Wait 1 Loop
Gruß raggy
@raggy:
Du bist mein Retter. es fehlte natürlich das ;
habe noch ne kleine andere Frage. Ich werte einen SRF02 Ultraschall Sensor aus. Den SRF02 lese ich folgendermaßen aus :
ich übertrage ja den integerwert. auf der Empfängerseite wird mir aber nicht die cm angezeigt sondern wieder wirres Zeug. Kann ich denn von Integer nach String wandeln um es zu übertragen ?Code:'------------------------ CPU Config ------------------------- $regfile = "m8def.dat" $crystal = 1000000 $baud = 1200 $framesize = 42 $swstack = 42 $hwstack = 42 '------------------------ Port Config -------------------------- Config Portb = Output Config Portd.2 = Output Config Scl = Portc.5 Config Sda = Portc.4 Const Srf02_slaveid = &HE0 '------------------------ Alias ---------------------------------- Led1 Alias Portb.0 Led2 Alias Portb.1 Led3 Alias Portb.2 Led4 Alias Portb.3 Rs485 Alias Portd.2 '-------------------------- Subs ------------------------------- '--------------------------- RS485 ------------------------------- Rs485 = 0 Enable Interrupts '----------------------------- Dims ------------------------------ Dim Entfernung As Integer Dim V As Byte '----------------------- Funcitons ------------------------- Declare Function Srf02_firmware(byval Slaveid As Byte) As Byte Declare Function Srf02_entfernung(byval Slaveid As Byte) As Integer '------------------------- Boot --------------------------------- Wait 1 I2cinit V = 1 Waitms 100 '---------------------------------- Mainprogramm ------------------ Main: Entfernung = Srf02_entfernung(srf02_slaveid) Waitms 100 Rs485 = 1 Print Entfernung ; Do Loop Until Ucsra.txc = 1 Set Ucsra.txc Rs485 = 0 Wait 2 Goto Main '--------------------------------- SRF_02 ------------------------------------------ Function Srf02_firmware(byval Slaveid As Byte) As Byte Local Firmware As Byte Local Slaveid_read As Byte Slaveid_read = Slaveid + 1 I2cstart I2cwbyte Slaveid I2cwbyte 0 'Leseregister festlegen I2cstop I2cstart I2cwbyte Slaveid_read I2crbyte Firmware , Nack I2cstop Srf02_firmware = Firmware End Function Function Srf02_entfernung(byval Slaveid As Byte) As Integer Local Lob As Byte Local Hib As Byte Local Firmware As Byte Local Temp As Byte Local Slaveid_read As Byte Slaveid_read = Slaveid + 1 'Messvorgang in starten I2cstart I2cwbyte Slaveid I2cwbyte 0 I2cwbyte 81 'in Zentimetern messen I2cstop Warteaufmessung: Waitms 1 Firmware = Srf02_firmware(slaveid) If Firmware = 255 Then Goto Warteaufmessung I2cstart I2cwbyte Slaveid I2cwbyte 2 'Leseregister festlegen I2cstop I2cstart I2cwbyte Slaveid_read I2crbyte Hib , Ack I2crbyte Lob , Nack I2cstop Srf02_entfernung = Makeint(lob , Hib) End Function
mfg Kay
seh mal das Forum hier durch, hab da mal was gelesen.damit habe ich mich noch nicht befast.
gruß raggy viel Glück.
Lesezeichen