Can 2 cogs display data onto a single VGA simultaneously?
ElectricAye
Posts: 4,561
Hi all,
I was just wondering if two cogs could display data to a single VGA using VGA_Text. Would the different data simply go to its designated location on the screen or would 2 cogs interfere with each other and totally screw up the display?
thanks,
Mark
I was just wondering if two cogs could display data to a single VGA using VGA_Text. Would the different data simply go to its designated location on the screen or would 2 cogs interfere with each other and totally screw up the display?
thanks,
Mark
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
http://www.rayslogic.com/propeller/Programming/6-Bit%20Bitmap%20App/6BitBitmap.htm
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
there is a solution to this which I will describe below.
If you just call the methods the screen will screw up when both cogs try to write at the same time.
the VGA_Text-object uses an array to store the characters and the different methods for writing to the
screen use the variables long col, row, color
Now imagine two independent running cogs change the values of these variables at the same time. This will screw it up.
If you would start two VGA_Text-objects using the same pin this will even screw up the signal.
Now the solution. You have to use a bufferarray
the different cogs write not directly to the display but to a buffer-array
this means the two cogs do NOT use the VGA_text-methods but other methods that write to a bufferarray representing the screen
Then there has to be a third cog (or a repeated called method that reads the bufferarray and writes to the screen.
This method writes always the COMPLETE buffer to the screen.
If the bufferarray-writemethods use a columm and row positioning ALL the time. The screen can only get screwed up
by wrong col-row-offset settings. This means as long as the user takes care of the col-row-offsets in that way
that cog 1 uses f.e. col 0-10 and cog 2 col 11-32 or any other dividing the screen in a cog-1-part and a cog-2-part it will work
best regards
Stefan
Thanks so much for your swift replies. I've been pondering what you've said and the solution sounds like it's above my IQ level to deal with at this point. I suppose a simpler approach to my general problem might be to have a single cog responsible for VGA display of all data and then use HUB RAM to communicate between various cogs. But I guess now I have to deal with the possibility of what happens if the "VGA display cog" tries to read the contents of a HUB RAM address while another "sensor reading" cog is trying to write to that very same HUB RAM address at the very same time.
Hmmm.....
This multi-cog thing is super-cool but it also gets complicated at times like this.
thanks again,
Mark
By golly, kwinn, I think you're right! So I guess I don't have to worry about the "VGA display cog" reading the contents of a HUB RAM address while the "sensor reading" cog is trying to write to that very same HUB RAM address at the very same time.
Thanks for reminding me of that mechanism!
Mark
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Watching the world pass me by, one photon at a time.
I actually not sure what you are trying to achieve. I suggest you download the VGA demos and have a play with them. Ignore the pasm VGA code for now as it only displays the data - try modifying the spin demo section and see instant results
I say cog(s) because think there are actually 2 cogs providing the display interlacing with each other, but I could be wrong. At least that was the way Chip originally intended it anyway.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBladeProp, SixBladeProp, website (Multiple propeller pcbs)
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: Micros eg Altair, and Terminals eg VT100 (Index)
· Search the Propeller forums (via Google)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
It's nothing fancy. I just wanted to have mouse control over a few variables while a few cogs are counting pulses, etc. I got the VGA and mouse incrementer/decrementer working today and got confused about how to display the cursor position and data (pulse counts, time, date, threshold voltages, etc.) all on the same VGA screen. I think I get it now. For this clueless newbie, RAM HUB is my beacon of hope.
thanks, you guys,
Mark