serial input
shmow
Posts: 109
Hello all,
I can send·data using the 912Mhz transceiver.
the basic layout is:
·propeller --> wireless tx --> wireless rx --> bs2
I tried using a prop at the receiving end but I'm a bit over my head on this.
You can see the spin program (for wireless tx) is simple:
·· every 4 seconds the chip sends out 8 bits of data serially
On the other hand,·the spin program (for wireless rx) is pretty bad:
When the data is recieved, each bit is saved in a part of an array.
Then every 4 seconds·this array displays the value.
I even tried to string together the separate parts - see valone.
Does anyone have any suggestions to do this better?
Thanks,
Shmow
I can send·data using the 912Mhz transceiver.
the basic layout is:
·propeller --> wireless tx --> wireless rx --> bs2
I tried using a prop at the receiving end but I'm a bit over my head on this.
You can see the spin program (for wireless tx) is simple:
·· every 4 seconds the chip sends out 8 bits of data serially
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 BaudRate = 9600 TxPin = 4 VAR byte Serial_Value OBJ BS2 : "BS2_Functions" ' Create BS2 Object PUB Wireless_Output dira[noparse][[/noparse]16]~~ Serial_Value := 255 repeat outa[noparse][[/noparse]16]~~ waitcnt(clkfreq*3+cnt) BS2.serout_dec(TxPin,Serial_Value,BaudRate,1,8) outa[noparse][[/noparse]16]~ waitcnt(clkfreq+cnt)
On the other hand,·the spin program (for wireless rx) is pretty bad:
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 TxPin = 1 RxPin = 0 VAR byte DataIn[noparse][[/noparse]10] byte SerDataIn[noparse][[/noparse]10] byte valone long stack[noparse][[/noparse]1000] OBJ SER : "FullDuplexSerial" SIO : "FullDuplexSerial_2" PUB Wireless_Input SER.Start(0,20,0,9600) cognew(7, Hyper_Terminalt, @stack[noparse][[/noparse]100]) repeat SerDataIn[noparse][[/noparse]0] := IN_SIO.rx SerDataIn[noparse][[/noparse]1] := IN_SIO.rx SerDataIn[noparse][[/noparse]2] := IN_SIO.rx SerDataIn[noparse][[/noparse]3] := IN_SIO.rx SerDataIn[noparse][[/noparse]4] := IN_SIO.rx SerDataIn[noparse][[/noparse]5] := IN_SIO.rx SerDataIn[noparse][[/noparse]6] := IN_SIO.rx SerDataIn[noparse][[/noparse]7] := IN_SIO.rx valone := (10*serdatain[noparse][[/noparse]0])+(serdatain[noparse][[/noparse]1]) PUB Hyper_Terminal SIO.start(31, 30, 0, 57600) repeat outa[noparse][[/noparse]16]~~ waitcnt(clkfreq*3+cnt) dataIn[noparse][[/noparse]0] := SerDataIn[noparse][[/noparse]0] dataIn[noparse][[/noparse]1] := SerDataIn[noparse][[/noparse]1] dataIn[noparse][[/noparse]2] := SerDataIn[noparse][[/noparse]2] dataIn[noparse][[/noparse]3] := SerDataIn[noparse][[/noparse]3] dataIn[noparse][[/noparse]4] := SerDataIn[noparse][[/noparse]4] dataIn[noparse][[/noparse]5] := SerDataIn[noparse][[/noparse]5] dataIn[noparse][[/noparse]6] := SerDataIn[noparse][[/noparse]6] dataIn[noparse][[/noparse]7] := SerDataIn[noparse][[/noparse]7] ser.tx(10) 'line feed ser.tx(13) 'carriage return ser.str(string(" Results = ")) 'display decimal value of temp ser.dec(datain[noparse][[/noparse]0]) ser.dec(datain[noparse][[/noparse]1]) ser.dec(datain[noparse][[/noparse]2]) ser.dec(datain[noparse][[/noparse]3]) ser.dec(datain[noparse][[/noparse]4]) ser.dec(datain[noparse][[/noparse]5]) ser.dec(datain[noparse][[/noparse]6]) ser.dec(datain[noparse][[/noparse]7]) ser.tx(13) 'carriage return ser.tx(10) 'line feed ser.str(string(" Binary value is ")) ser.dec(datain[noparse][[/noparse]0]) ser.dec(datain[noparse][[/noparse]1]) ser.dec(datain[noparse][[/noparse]2]) ser.dec(datain[noparse][[/noparse]3]) ser.dec(datain[noparse][[/noparse]4]) ser.dec(datain[noparse][[/noparse]5]) ser.dec(datain[noparse][[/noparse]6]) ser.dec(datain[noparse][[/noparse]7]) ser.tx(13) 'carriage return ser.tx(10) 'line feed outa[noparse][[/noparse]16]~ waitcnt(clkfreq+cnt)
When the data is recieved, each bit is saved in a part of an array.
Then every 4 seconds·this array displays the value.
I even tried to string together the separate parts - see valone.
Does anyone have any suggestions to do this better?
Thanks,
Shmow