Shop OBEX P1 Docs P2 Docs Learn Events
TV Problem — Parallax Forums

TV Problem

walterswalters Posts: 2
edited 2013-07-10 03:33 in Propeller 1
Hello everyone!!!

I wonder if anyone can help me with the TV object for the propeller chip.
Working on a little home project where I use XBee to send some serial information to a propeller and show this on a tv.
But it seems after a while the whole application is getting stuck some how.
It seems to happen when I change the color on the cursor.

Made a small test program to send a bunch of random text and changing color and after a little wile the tv object is getting stuck.
I do not know why

Here is the code for the both applications

This is the code for the Tv unit


CON

_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000

XB_Rx = 0 ' XBee DOUT
XB_Tx = 1 ' XBee DIN
XB_Baud = 9600 ' XBee Baud Rate

OBJ

text : "tv_text"
xb : "XBee_Object"
var
long DataIn

PUB start | i

XB.start(XB_Rx, XB_Tx, 0, XB_Baud)
'delay(1000)
'start term
text.start(12)


delay(1000)

main


pub main
repeat
DataIn := XB.RX
if DataIn == "@"
command
if DataIn <> "@"
text.out(DataIn)

pub command
delay(5)
repeat

DataIn := XB.RX

If DataIn == "1" 'clear screen
text.out(0)
Done_cmd
main

if DataIn == "2" 'cursor home
text.out(1)
xb.rxflush
Done_cmd
main

if DataIn == "3"
text.out($C) 'color 0
text.out(0)
xb.rxflush
Done_cmd
main '
if DataIn == "4"
text.out($C) 'color 1
text.out(1)
xb.rxflush
Done_cmd
main
if DataIn == "5"
text.out($C) 'color 2
text.out(2)
xb.rxflush
Done_cmd
main
if DataIn == "6"
text.out($C) 'color 4
text.out(3)
xb.rxflush
Done_cmd
main
if DataIn == "7"
text.out($C) 'color 5
text.out(4)
xb.rxflush
Done_cmd
main
if DataIn == "8"
text.out($C) 'color 6
text.out(5)
xb.rxflush
Done_cmd
main
if DataIn == "9"
text.out($C) 'color 7
text.out(6)
xb.rxflush
Done_cmd
main
if DataIn == "0"
text.out($C) 'color 8
text.out(7)
xb.rxflush
Done_cmd
main
if DataIn == "A"
reboot
main

main

Pub Delay(mS)
'' Delay routing
'' XB.Delay(1000) ' pause 1 second
waitcnt(clkfreq/1000 * mS + cnt)

pub Done_cmd

xb.tx("D")
delay(100)


The sender application is attached

As long as I do not change color on the cursor I can run this for days, but as soon as I start to changing colors and writing text with different colors the system is getting stuck somehow.
Wonder if anyone has any idea why.

Best regards
Mr.Walters

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2013-07-08 16:56
    walters wrote: »
    Made a small test program to send a bunch of random text and changing color and after a little wile the tv object is getting stuck.
    You're simply running out of stack. Calling a method in SPIN means the caller expects the method to return to the point after the call (BASIC GOSUB style). In your code main calls command and command calls main, NG. If you want to return from a method just use return or return value.

    Also, please wrap code in [noparse]
    
    [/noparse] tags, it's easier to read.                        
  • walterswalters Posts: 2
    edited 2013-07-10 03:33
    Thank you for your time and help!

    Made the changes you suggested and now it is working fine.The system has been runing for 24 houes with out getting stuck

    Best Regards

    Mr.Walters
Sign In or Register to comment.