INFO - FAQ - CC2-Forum - CCPro-Forum |
> Thank's Manfred > > De sender is allso a M-unit2 > This is only a sender with a freq. van 2 Hz.(8 BYTE) Why is your start code =50? Is it an error? Do you mean the code "start of text" = 2 in ASCII code? It is easier to test with a PC as transmitter and indicate with terminal program. The receiver is the c-control. For testing with PC you can take key s, because ASCII =2 is not possible. Another testing is the c-control as transmitter with indicate on the PC. If both programs are ready, you test the c-controls together. > The reciever > I did make a new test progr. > with your idea's > The first loop is good(all byte's not higher then 40) > but after 2 or 3 loop's then all byte's have a value 255 > When I change all row's (if RXD and Var1=255 then GET Var1) in (GET Var1) Why this change? That is not your target. > Then it work's great > What's going wrong. > > > > #INIT > BAUD R1200 > > PRINT"#ON_LCD#";"#INIT#";"#CLR#";"#OFF#"; 'Initialize the LCD > PUT 0 > Led1=ON > Led2=ON > > #Start > second=0 > Var1=255 > Var2=255 > Var3=255 > Var4=255 > Var5=255 > Var6=255 > Var7=255 > > #Ontvang > IF SECOND>2 THEN GOTO GeenOntvangst > TOG Led2 'rood > IF NOT RXD THEN GOTO Verder > GET VarX This is the same mistake like your last program. Look at my program. All received bytes you take in VarX. What is doing the next byte after code = 50 in the following row? > IF VarX=50 THEN GOTO OntvangXXX 'Start code > #Verder > GOTO Ontvang > > #OntvangXXX > TOG Led1 'groen > if RXD and Var1=255 then GET Var1 > if RXD and Var2=255 then GET Var2 > if RXD and Var3=255 then GET Var3 > if RXD and Var4=255 then GET Var4 > if RXD and Var5=255 then GET Var5 > if RXD and Var6=255 then GET Var6 > if RXD and Var7=255 then GET Var7 > > pause 10 > > 'IF Var7<>91 THEN GOTO Start 'Laatste Var is stop bit Var7 has 255 and this is >< 91. The program has to start always. Look at my program. > AanTal=AanTal+1 > IF Aantal=1000 Then Maal=Maal+1 > IF Aantal=1000 THEN Aantal=0 > > print"#ON_LCD#"; > print"#CLR#"; > print"#L101#"; > PRINT "1=";Var1;" G2=";Var2;" G3=";Var3; 'Regel 1 Pos.1 > print"#L201#"; > PRINT "G4=";Var4;" 5=";Var5;" G6=";Var6; 'Regel 2 Pos.1 > print"#L121#"; 'Regel 3 Pos.1 > PRINT "Ontvangen ";Aantal; > print"#L221#"; 'Regel 4,Pos.1 > PRINT "x1000 ";Maal; > print"#OFF#"; > > GOTO start > > #GeenOntvangst > print"#ON_LCD#"; > print"#CLR#"; > print"#L101#"; > print "* Geen ontvangst *"; > print"#OFF#"; > > GOTO Start > > > Hallo, > > first steps of a solution > > now the further steps in your old program > > > > > > > > > #Start > > > > > second=0 > > > > > PRINT"#OFF#"; > > Var1 = 255 > > Var2 = 255 > > Var... = 255 ' all Var until Var7 > > > > > > > > > > #Ontvangen > > > > > IF SECOND>3 THEN GOTO GeenOntvangst > > > > > IF NOT RXD THEN GOTO Verder > > > > IF Var1=50 THEN GOTO OntvangXXX 'Start code received? yes GET Var1 > > > > > > > > > #Verder > > > > > GOTO Ontvangen > > > > > > > > > > #OntvangXXX > > > > 'Óntvangen van de 48 BITS in 6 Byte's > > if RXD and Var2 = 255 then GET Var2 > > if RXD and Var3 = 255 then GET Var3 > > if RXD and Var4 = 255 then GET Var4 > > ........ > > if RXD and Var7 = 255 then GET Var7 if Var7 = 255 then goto ??? ' wait of receive Var7 IF Var7 <> 91 THEN GOTO Start 'Laatste Var is stop code ? no, is not stop code ...' yes, Var7 is stop code 91 Another start is also possible: #Ontvangen IF SECOND>3 THEN GOTO GeenOntvangst IF VarX=50 THEN GOTO OntvangXXX 'Start code was received? yes IF RXD THEN GET VarX GOTO Ontvangen #OntvangXXX MfG ManfredW Meine Homepage: http://manfred.wilzeck.de |
Antwort schreiben |