I must be missing something obvious but can't figure it out. - $50 reward offer
Jack Buffington
Posts: 115
I have really tried to figure this one out but after hours of trying to attack this problem from several angles, I'm at a loss. I'm working on code that grabs pixels from a VGA 640x480x60Hz source. The propeller can only just barely keep up with the signal so I'm reading data from a lookup table for each scan line to tell it what to do. Here is my setup: At each horizontal sync, I read several longs from hub RAM. I have variables to tell it how to capture up to three groups of pixels. Each of the first three longs that I read corresponds to one group of pixels. Specifically, it contains 10 bits telling it how long to wait after the end of the Hsync pulse or the beginning of the previous capture, how many groups of eight pixels to capture (4 bits), and finally, where to write the pixels into hub RAM.
Below is a chunk of code that does some of my scan line routine. For some reason group1numBlocks is getting corrupted but I just can't see how. I have verified that it is seeing the proper numbers of blocks to capture at the proper times using the commented out code below but for some reason the code always just captures one block on scan lines that it is supposed to capture something UNLESS I explicitly tell the program in code like I have in the last line in my sample code. Any ideas? I have been struggling for many hours on this one...
Here is a sample of the lookup table data for one scan line:
The long that I am specifically dealing with is the first one.
17C is how long to wait before capturing the pixels after the horizontal sync
7 is how many groups of eight pixels I want to capture
05B0 represents the offset from the start of the pixel data to save these pixels.
Post Edited (Jack Buffington) : 4/25/2010 3:35:50 AM GMT
Below is a chunk of code that does some of my scan line routine. For some reason group1numBlocks is getting corrupted but I just can't see how. I have verified that it is seeing the proper numbers of blocks to capture at the proper times using the commented out code below but for some reason the code always just captures one block on scan lines that it is supposed to capture something UNLESS I explicitly tell the program in code like I have in the last line in my sample code. Any ideas? I have been struggling for many hours on this one...
' ############################################ ' read four longs from hub RAM and put ' their data into the appropriate variables ' ############################################ rdlong group1wait,hubLookupLocation mov group1hubLoc,group1wait add hubLookupLocation,#4 rdlong group2wait,hubLookupLocation mov group2numBlocks,group2wait add hubLookupLocation,#4 rdlong group3wait,hubLookupLocation mov group3numBlocks,group3wait add hubLookupLocation,#4 rdlong OKtoSend,hubLookupLocation add hubLookupLocation,#4 { Capture Data | 2 bits | 10 bits | 4 bits | 16 bits | |not used|cycles to wait| number | offset from start| | | from end of | of | of pixel data to | | | Hsync pulse | blocks | write this data | } '################################### ' Separate the variables for group1 '################################### shr group1wait,#16 mov group1numBlocks,group1wait shr group1wait,#4 and group1numBlocks,numBlocksMask wz and group1hubLoc,hubLocMask add group1hubLoc,pixelDataStartAddress ' If at this point I can do a compare to see if number of ' blocks is 1,2, or 7 (because those are the values I'm using) ' it correctly detects it and lights the LED at the appropriate ' times { cmp group1numBlocks,#2 wz if_z or outa,LEDmask if_nz andn outa,LEDmask cmp group1numBlocks,#0 wz } ' The very next statement makes use of group1numBlocks but it appears that it ' somehow is forgetting the real value and always uses a value of one. On the other ' hand, if I insert the following statement, it always will use seven as the value. ' What the heck!!! 'mov group1numBlocks,#7
Here is a sample of the lookup table data for one scan line:
long $17C705B0, $F4400030, $30, $2C000000
The long that I am specifically dealing with is the first one.
17C is how long to wait before capturing the pixels after the horizontal sync
7 is how many groups of eight pixels I want to capture
05B0 represents the offset from the start of the pixel data to save these pixels.
Post Edited (Jack Buffington) : 4/25/2010 3:35:50 AM GMT
Comments
·············mov·······group1numBlocks,group1wait
··············rdlong····group1wait,hubLookupLocation
··············mov·······group1hubLoc,group1wait
··············add·······hubLookupLocation,#4
··············rdlong····group2wait,hubLookupLocation
··············mov·······group2numBlocks,group2wait
··············add·······hubLookupLocation,#4
It just doesn't make sense to me that I can light up an LED when the variable is correct but the program won't use that data properly. If on the other hand I explicitly tell it what the variable value is in code and ignore the lookup table variable, it works.
Here is some more code showing what happens afterwards for what it is worth. Pretty much to maximize the speed of execution, I have code for capturing pixels that simply takes ina and copies it to a variable. Each line of code copies to the next variable location. An example would be
I am doing a similar thing with storing the pixels: (i'm dealing with 16-bit color)
My code figures out how many pixels should be captured and then puts a jump to the store routine after the last pixel is captured. The store routine stores the captured pixels in hub RAM and then jumps to a restore routine that restores a backup of the jump point out of the capture code and restores the store routine jump point as well.
I could really use help on this one. I'll order $50 in Parallax products (your choice) to the first person who can point out what the heck I'm doing wrong.
Post Edited (Jack Buffington) : 4/25/2010 3:34:38 AM GMT
You say "The very next statement makes use of group1numBlocks"—what is the very next statement?
You really should post the whole program after you've trimmed it down as much as possible.
Is the last response!!!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
JMH
numBlocksMask long 15
as you have 4 bits set aside for it, in the capture data, but you're doing shr group1wait,#16 to shift the bits into place.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://www.propgfx.co.uk/forum/·home of the PropGFX Lite
·
Post Edited (kuroneko) : 4/25/2010 1:10:06 PM GMT
Thanks!!!