Starting a cog and messing up t.v.
I am trying to start a seperate cog from my main program. Everytime I put cognew my video completely goes haywire. It doesn't make a difference which object is trying to start.
I have tried to put it
··· before the tv start
··· after the tv start
··· inbetween tv start and color setup
I had the same problem with the new graphics.spin.· I am using just using a simple tv driver now.
This only happens when I use the t.v. I always test my programs with propterminal first and never have any problems.
Any ideas?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·······
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
········
I have tried to put it
··· before the tv start
··· after the tv start
··· inbetween tv start and color setup
I had the same problem with the new graphics.spin.· I am using just using a simple tv driver now.
This only happens when I use the t.v. I always test my programs with propterminal first and never have any problems.
Any ideas?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·······
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
········
Comments
t.v. works fine period.
I add cognew anywhere and t.v. outputs nothing.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·······
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
········
You can assume that there are very, very few peculiar things in the Propeller. In 99.99% of all cases it is a tiny misunderstanding or even a typo somewhere in your code that is responsible for any odd behaviour. There are examples in the recent past (one solved, one still unsolved due to missing COMPLETE code of the program) that proves this.
So helping with such issues needs an at least working sub-example of the effect - always.
Maybe loose video output connection ; are you getting all kinds of almost static?
Maybe wrong mode or frequency ; are you using broadcast mode or baseband mode?
Maybe attach a picture of the screen malfunctioning.
Also remember that the first spin cog uses the ram starting from the first unused ram location as stack space. So you'll have to save some free space towards the end of your program in order for it to work. A few of the tv drivers use ram at the end of the memory range for buffer space. You'll surely see weird stuff happening if your code starts messing around with this buffer.
So post your compiled code size and any source code (third party objects, etc) that you can release. Maybe someone will be able to figure out your problem, even without you posting your private code.
Harrison
cognew(obj.start,@stack) screen does nothing no change or flickering·whatsoever. Comment line and everything is good.
Harrison, thanx· a million, that sounds like a good possiblility. Can you recommend a good starting size. The tutorials always used stack[noparse][[/noparse]20] so that's what I use. I will switch it to 200? and go from there.
How do you avoid the conflict with the t.v. in lower memory? Heres the code
timerb:"timerb"
PUB main|i,j cognew(timerb.start,@stack) ' cognew(dummy.start,@info6) waitcnt(clkfreq/10+cnt) 'start TV start(12) 'set up colors colors[noparse][[/noparse]0]:= $05_59_05_59 'NOTE: last color here (LSB) is the overall background colors[noparse][[/noparse]1]:= $05_05_5B_5B colors[noparse][[/noparse]2]:= $BB_06_BB_06 '1: red on white colors[noparse][[/noparse]3]:= $BB_BB_bb_bb 'RED colors[noparse][[/noparse]4]:= $02_06_02_06 '2: black on white colors[noparse][[/noparse]5]:= $02_02_06_06 colors[noparse][[/noparse]6]:= $8E_5B_8E_5B '3: Yellow on Green colors[noparse][[/noparse]7]:= $8E_8E_5B_5B colors[noparse][[/noparse]8]:= $02_04_02_04 '4: black on grey colors[noparse][[/noparse]9]:= $02_02_04_04 'blank card edge color colors[noparse][[/noparse]11]:= $06_02_BB_5B 'NOTE: color 1 on right side (LSB), color 4 on left side (MSB) 'card edge color colors[noparse][[/noparse]12]:= $5B_02_02_06 'red face card colors colors[noparse][[/noparse]13]:= $8E_BB_02_06 'black face card colors colors[noparse][[/noparse]14]:= $8E_02_BB_06 'button colors colors[noparse][[/noparse]15]:=$05_03_04_04 'screen1
All timerb does is turn on a light every second. Still can't turn it off from main.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·······
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
········
go waitcnt(clkfreq/1+cnt) getsettings 'read pub go cognew(timerb.starttt,@stack1)
Changed stack to stack[noparse][[/noparse]50] and added above code. Screen turns on and has a small checkered pattern. Tried a couple different screens. Same thing but progress.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·······
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
Post Edited (mosquito56) : 2/23/2008 6:15:05 AM GMT
Try adding
PUB startTimer timerb.start
And changing
cognew(timerb.start,@stack)
to
cognew(startTimer,@stack)
Have you tried this yet?
start x:=0 repeat x++
i also tried another graphics.spin, no luck. I guess I can try building from ground up again and see where the problem comes in by commenting out until problem disappears. It has to be somewhere in my code.
Thanx for the help and the stacksize, it never occured to me.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·······
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
········
Its possible you've run out of COGs but unless you've started a bunch that is unlikely. Something that caught my eye was your message which had this code in it:
'start TV start(12) 'set up colors colors[noparse][[/noparse]0]:= $05_59_05_59 'NOTE: last color here (LSB) is the overall background ...
The thing that caught my eye is that I would have expected you to write;
'start TV tv.start(12) ...
And up in the OBJ section having a statement like
OBJ TV : "TV"
So there are really three things that can mess up the TV reliably:
1. You can change the output of one of the TV's pins to an input (DIRA := 0 for example)
2. You can overwrite the TV code by loading into the same COG (hard to do from spin directly)
3. Write to one of the pins the TV code is using.
--Chuck
I am totally confused by the t.v. object, I just grabbed one in the object exchange and copied it. I have no idea how it works so I only use the first 4 colors. I will delete all the non used colors and try that.
I have been programming for 40 years now and I never mess with video drivers. I get one that works and modify it as best as possible. I never have more than 4 or 5 colors on the screen since I did alot of business programming before coming to the prop. Ask me about databases and we talking my language.
Thanx, another good idea.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·······
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
········
I posted a response in the other thread as well about using a separate object to manage the LED on/off.
On the TV Object there is a a pretty good demo that comes with it, (if you have the latest Propeller tool download from the Parallax site it is in the Library_Demos folder) I don't know if the one that comes with the prop tool is earlier or later than the one in the Object Exchange here. I used the one with the propeller tool and it worked fine. I've got a second COG that is doing PWM output (see the discussion about high frequency PWM for more details on that)
--Chuck
070 'Get number
071' get second number
051 'add numbers
155 print sum in register
It had a adding maching output, adding machine keyboard.
You bring up an interesting point.We have digressed back to the 80's. Because we don't have megbytes of ram, the operating systems are very rudementary. It's like having a trs-80 the size of a wallet.
·I hate O.T. but since it's my thread what the heck. LOL
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·······
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
········
if there's anything that would know how much stack it really needs, it would be the compiler.
spin stack overflow is the kind of thing that makes me nervous about using the Propeller.
A compiler can perform a worst case call path analysis to find this out. This is far beyond the general features of the SPIN compiler, but can be done by an external tool also. This can include called external Objects as well as nested formulas, loops, ifs, and cases...
Recursion has to stop this analysis principally, but this is a rare usage.
As the call path is generally not a (static) tree, the worst case analysis will be - worst case, which will introduce some overhead, maybe considerable ovrhead...
The third challenge is that the compiler is principally not aware of the size of the "stack" provided by the COGNEW call.
In principle I should suppport your request, but just to roughly and conservatively estimate the stack need is not a great deal. Maybe more guideance is called for...
But I never had a problem when setting it to 20 for shallow call depths...
Post Edited (deSilva) : 2/25/2008 12:42:10 AM GMT
EDIT: deSilva provided a much better explanation then I did... So I removed my slightly extreme example.
Post Edited (Harrison.) : 2/25/2008 12:54:47 AM GMT