FREE TIME to kill with a dumb question?
KC8DKT
Posts: 76
FREE TIME·project.· Not really needed but I thought it was ODD AS [url=mailto:#@$%]#@$%[/url] it did not work
A friend ask me if the prop was fast enough to relay do this,· YES but I guess I missed something when setting it up.
Can 2 cogs "1 Prop" talk over the rf433 kit?· I said yes.
The units sink up "signal return" jumps up after the 1st byte is sent.
All that gets sent to PST is 255 "no input" though.·· Is it the code or did I miss somthing?
all 3 RS232 is the stock download with no edits.· Just did a rename so i could use 3 at the same time.
Sry for the bad english and dumb question but I thought I could get atleast a 75% return with this just for kicks.
love them 10min projects that will not work and you just can not walk away from till you find out why
A friend ask me if the prop was fast enough to relay do this,· YES but I guess I missed something when setting it up.
Can 2 cogs "1 Prop" talk over the rf433 kit?· I said yes.
The units sink up "signal return" jumps up after the 1st byte is sent.
All that gets sent to PST is 255 "no input" though.·· Is it the code or did I miss somthing?
all 3 RS232 is the stock download with no edits.· Just did a rename so i could use 3 at the same time.
Sry for the bad english and dumb question but I thought I could get atleast a 75% return with this just for kicks.
love them 10min projects that will not work and you just can not walk away from till you find out why
CON _clkmode = xtal1 + pll16x ' use crystal x 16 _xinfreq = 5_000_000 ' 5 MHz cyrstal (sys clock = 80 MHz) ---------------------------------------------------------------------------------------- Obj SerialT : "RS232T" 'Tx Only SerialR : "RS232R" 'Rx Only SerialD : "RS232D" 'Tx Only for Debug ---------------------------------------------------------------------------------------- Var Long TStack[noparse][[/noparse]30], RStack[noparse][[/noparse]30], DStack[noparse][[/noparse]30] Byte Info ---------------------------------------------------------------------------------------- Pub Start cognew(T, @TStack) cognew(R, @RStack) cognew(D, @DStack) outa[noparse][[/noparse]18]~~ repeat !dira[noparse][[/noparse]18] 'Just a LED flashing so I do not for get its turned on Waitcnt(50_000_000 + cnt) ---------------------------------------------------------------------------------------- Pub T | tmp outa[noparse][[/noparse]15]~~ 'Pin7 set SHOULD not be needed? serialT.start(7, 15, 9600) repeat repeat tmp from 0 to 255 SerialT.tx(tmp) Waitcnt(50_000_000 + cnt) ---------------------------------------------------------------------------------------- Pub R outa[noparse][[/noparse]07]~~ 'No Pin15 set SHOULD not be needed? serialR.start(7, 15, 9600) repeat Info := SerialR.rx ----------------------------------------------------------------------------------------- Pub D 'This is all just PST.exe and it all works fine outa[noparse][[/noparse]31]~~ outa[noparse][[/noparse]30]~~ serialD.start(31, 30, 9600) repeat if info <> 255 '99% of the time all it returns is 255 the last 1% is just rf/sinc Smile SerialD.dec(Info) 'This works fine if you replace Info with a static # other wise it returns 255 "no input" SerialD.tx(13) 'CRLF works fine as well
Comments
In terms of how many serial ports I saw 7 serial ports at 115000 baud, on 1 prop. 3 tx to 3 rx plus the debug port.
Sending 0 got 255
Sending 1 got 255
Sending 2 got 255
Sending 3 got 255
Sending 4 got 255
Sending 5 got 255
Sending 6 got 255
Sending 7 got 255
Sending 8 got 255
Sending 9 got 255
Sending 10 got 255
Full code with·edit·uploaded.··· This is going to drive me nuts!!!
1. Copying a file doesn't make it a new copy of the object unless it compiles differently so your copys rs232d, etc will still be recognized as the same object. This doesn't make any difference to the code just something to understand.
2. the outa in T, R and D are not needed and shouldn't do anything since the pin isn't an output pin in those cogs. The serial port driver starts another cog and that cog sets the output pins.
3. Pin 15 and 7 should be connected with a wire - I assume this but just to state the obvious.
4. Indent is important, the indent in routine T should be fixed - the 1st repeat and following lines
5. I would increase the stack size until its working - change [noparse][[/noparse]30] to [noparse][[/noparse]300] for the 3 stacks
6. The 255 is because rx is calling rxcheck which returns 255 until a char is received. It is possible that a char is being received but the R repeat is going round calling rx again which calls rxcheck which writes into Info with 255 before you print it out in the D routine.
Try adding a Info1 variable, copy Info into Info1 when rx returns and print Info1 in D routine. Then the rx routine will not overwrite it with 255. It can still overwrite it with the next char received but you will be able to see that happening.
sent 10 got 32
sent 10 got 255
sent 10 got 255
sent 10 got 32
sent 10 got 255
sent 10 got 255
sent 100 got 32
sent 100 got 96
sent 100 got 255
sent 100 got 32
sent 100 got 96
sent 100 got 255
I would do 2 things
1. Change SerialT.dec(sent) to SerialT.tx(sent) then the send/rec will match
2. Change
Byte Sent, Got
to
Byte Sent, Got, got1
repeat while (got := SerialR.rxcheck) == -1 'repeat till it gets a byte
waitcnt(100_000 + cnt) 'Gave debug a load of time
to
got := SerialR.rx
got1 := got
and
SerialD.dec(got)
to
SerialD.dec(got1)
this should remove the prints of 255. Its a better way to may sure rxcheck doesn't overwrite before displaying.
with·the same hookup
same but new parts
code but remmed out T on pcb and R/D on proto·"Proto sending to pcb" and its a 100% match.· wrong info but·matching pst·output
A more·idea·be for I put·this out·the window?··· · THIS SHOULD BE WORKING, roflmao
its needs worked out still but it is WORKING NOW!
sent 61 got 50
sent 62 got 51
sent 63 got 52
sent 64 got 53
sent 65 got 54
sent 66 got 55
sent 67 got 56
sent 68 got 57
sent 69 got 58
sent 70 got 59
sent 71 got 60
sent 72 got 61
sent 73 got 62
sent 74 got 63
sent 75 got 64
I know its off but its more then enough sign of life to get it worked out now.· THANKS AGAIN ALL!!!!!!!!!!!
·