prop and velbus
Tumbler
Posts: 323
Hello,
I'm trying to trow some packets on the velbus via rs232
Using the ppdb.
I can receive packets, but sending fails. Seems that the packets not arrived on the bus
Can someone take a look at this example?
Luc
I'm trying to trow some packets on the velbus via rs232
Using the ppdb.
I can receive packets, but sending fails. Seems that the packets not arrived on the bus
Can someone take a look at this example?
Luc
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 Obj Serial : "FullDuplexSerial" pst : "Parallax Serial Terminal" var long temp PUB Main| data, d pst.Start(38_400) Serial.Start(6,7,%0000,38_400) Serial.rxflush 'pst.Str(String("START")) 'repeat ' temp := serial.rx ' pst.char(temp) serial.tx(string("0F F8 20 04 00 08 00 00 CD 04")) waitcnt(clkfreq / 100 + cnt) serial.tx(string("0F FB 20 02 F8 08 D4 04")) waitcnt(clkfreq / 100 + cnt) serial.tx(string("0F FB A0 08 FB 08 00 00 20 00 00 01 2A 0")) waitcnt(clkfreq / 100 + cnt) serial.tx(string("0F F8 20 04 00 00 08 00 CD 04")) waitcnt(clkfreq / 100 + cnt) serial.tx(string("0F FB 20 02 F8 08 D4 04")) waitcnt(clkfreq / 100 + cnt) serial.tx(string("0F FB A0 08 FB 08 00 01 20 00 00 01 29 04")) waitcnt(clkfreq / 100 + cnt) serial.tx(string("0F F8 A0 04 00 08 00 00 4D 04")) waitcnt(clkfreq / 100 + cnt) serial.tx(string("0F FB 20 02 F5 08 D7 04")) waitcnt(clkfreq / 100 + cnt) serial.tx(string("0F FB A0 08 FB 08 00 00 00 00 00 00 4B 04")) serial.tx(string("0F F8 A0 04 00 00 08 00 4D 04")) ' pst.Str(String("next ")) waitcnt(clkfreq / 100 + cnt) ' Serial.Stop
Comments
[ Edit ] I don't think so. I found this document that explains the protocol. It looks like you need to send binary values, that is, you don't need to convert them to (human readable) ASCII.
http://www.hqpower.eu/downloads/Velbus_ProtocolSummary.pdf
Having looked at that document I think you might want to do something like this.
The velbus object handles serial IO (you can use fullduplexserial), dlen is the length of data in the packet, dpntr is the address of a byte array that holds your command and data. I tested the checksum algorithm against the test data in the documentation and it matches.
Sorry for this late reply
I'm searchin for some examples using arrays in spin, but couldn't find some.
The dpntr var is giving me real headache
... to create an array. You can pass the address of any array (any variable, actually) using the @ operator.