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.
======================================================= Pub T outa[noparse][[/noparse]15]~~ 'Pin7 set SHOULD not be needed? '7 <----------------------------------------------- serialT.start(0, 15, 9600) 'Pin0 not in use repeat repeat sent from 0 to 10 SerialT.dec(sent) 'Now .dec <----------------------------------------------- Waitcnt(50_000_000 + cnt) ======================================================= Pub R outa[noparse][[/noparse]07]~~ 'No Pin15 set SHOULD not be needed? '15 <----------------------------------------------- serialR.start(7, 1, 9600) 'Pin1 not in use repeat Info := SerialR.rxSending 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.
CON _clkmode = xtal1 + pll16x ' use crystal x 16 _xinfreq = 5_000_000 ' 5 MHz cyrstal (sys clock = 80 MHz) Obj SerialT : "RS232" 'Tx Only SerialR : "RS232" 'Rx Only SerialD : "RS232" 'Tx Only for Debug Var Long TStack[noparse][[/noparse]900], RStack[noparse][[/noparse]900], DStack[noparse][[/noparse]900] 'Stacks should be enough now Byte Sent, Got 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 serialT.start(0, 15, 9600) 'Pin0 not in use Sent := 10 repeat SerialT.dec(sent) Waitcnt(50_000_000 + cnt) Pub R serialR.start(7, 1, 9600) 'Pin1 not in use repeat repeat while (got := SerialR.rxcheck) == -1 'repeat till it gets a byte waitcnt(100_000 + cnt) 'Gave debug a load of time to 'read/print befor next check/update Pub D | tmp 'This is all just PST.exe and it all works fine serialD.start(31, 30, 57600) SerialD.tx(0) 'Clear old Debug scr repeat if got <> tmp 'Only update pst tmp := got 'with new info SerialD.str(string("sent ")) SerialD.dec2(sent) SerialD.str(string(" got ")) SerialD.dec(got) SerialD.tx(13) 'CRsent 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?···
CON _clkmode = xtal1 + pll16x ' use crystal x 16 _xinfreq = 5_000_000 ' 5 MHz cyrstal (sys clock = 80 MHz) Obj SerialT : "RS232" 'Tx Only SerialR : "RS232" 'Rx Only SerialD : "RS232" 'Tx Only for Debug Var Long TStack[noparse][[/noparse]900], RStack[noparse][[/noparse]900], DStack[noparse][[/noparse]900] 'Stacks should be enough now Byte Sent, Got, Got1 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 serialT.start(0, 15, 9600) 'Pin0 not in use Sent := 10 repeat SerialT.dec(sent) '<----------check all formats at the end Waitcnt(50_000_000 + cnt) Pub R serialR.start(7, 1, 9600) 'Pin1 not in use repeat repeat while(got := SerialR.rx) == -1 '<----------rxcheck to rx got1 := got '<----------Got1 added waitcnt(100_000 + cnt) <<<<<<<<<<<================================== output with/wo line added Pub D | tmp 'This is all just PST.exe and it all works fine serialD.start(31, 30, 57600) SerialD.tx(0) 'Clear old Debug scr repeat if got1 <> tmp 'Only update pst <----------Got to Got1 tmp := got 'with new info SerialD.str(string("sent ")) SerialD.dec2(sent) SerialD.str(string(" got ")) SerialD.dec(got1) '<----------Got to Got1 SerialD.tx(13) 'CR { SerialT.tx(sent) This was [b][u]WITHOUT[/u][/b] the added [u]waitcnt[/u] in R after "got1 := got" sent 10 got 128 sent 10 got 128 sent 10 got 255 sent 10 got 255 sent 10 got 255 sent 10 got 255 SerialT.tx(sent) This was [u][b]WITH[/b][/u] the added [u]waitcnt[/u] in R after "got1 := got" sent 10 got 199 sent 10 got 199 sent 10 got 0 sent 10 got 255 sent 10 got 0 sent 10 got 255 sent 10 got 0 sent 10 got 255 }its needs worked out still but it is WORKING NOW!
CON _clkmode = xtal1 + pll16x ' use crystal x 16 _xinfreq = 5_000_000 ' 5 MHz cyrstal (sys clock = 80 MHz) Obj SerialT : "RS232" 'Tx Only SerialR : "RS232" 'Rx Only SerialD : "RS232" 'Tx Only for Debug Var Long TStack[noparse][[/noparse]900], RStack[noparse][[/noparse]900], DStack[noparse][[/noparse]900] 'Stacks should be enough now Byte Sent, Got, Got1 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 serialT.start(0, 15, 9600) 'Pin0 not in use outa[noparse][[/noparse]15]~~ repeat dira[noparse][[/noparse]15] := 1 '<---------Added the key was this dumb amount of time waitcnt(1_000 + cnt) '<---------Added AND the UUU!. this was tested before dira[noparse][[/noparse]15] := 0 '<---------Added this time I messed around with how long repeat Sent from 10 to 100 '<---------Added it was being help HIGH SerialT.str(string("UUUU!")) '<---------Added SerialT.tx(sent) Waitcnt(50_000_000 + cnt) Pub R serialR.start(7, 1, 9600) 'Pin1 not in use repeat repeat while SerialR.rx <> "!" got := SerialR.rx 'waitcnt(1_000 + cnt) Pub D | tmp 'This is all just PST.exe and it all works fine serialD.start(31, 30, 57600) SerialD.tx(0) 'Clear old Debug scr repeat if got <> tmp 'Only update pst tmp := got 'with new info SerialD.str(string("sent ")) SerialD.dec2(sent) SerialD.str(string(" got ")) SerialD.dec(got) SerialD.tx(13) 'CRsent 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!!!!!!!!!!!
·