If there is a will there is a way :)
Kye
Posts: 2,200
I was just working on some high speed 8MHz byte wide data transfer code using the prop chip and I ran into a wall for how to grab and mask data quickly enough. Just... how can you grab multiple copies of INA very quickly while aligned to a clock and then store those copies of INA in an array? All hope was almost lost. But then MOVI, MOVD, and MOVS saved the day. Using those three instructions I can pack data into a long from the INA register without having to preform all the shifting and masking operations.
Simply beautiful!
Good thing I used the prop chip for the CMUcam4!
Simply beautiful!
Good thing I used the prop chip for the CMUcam4!
Comments
-Phil
8 MHZ pixel clock coming into the prop chip. The prop chip is at 96 MHz. There is an 8-bit data bus from a camera attached to P0-P7. There is also a HREF and VSYNC line attached to the prop chip.
Each pixel from the camera comes in two sequential bytes. In RGB565 mode the camera will send [r r r r r g g g] and then [g g g b b b b b] where the rgb letters represent RGB565 data from the camera. The camera will send 640 pixels. This means 1280 clock pulses will come each delivering 8 bits of data. The HREF line will only be high during these 1280 pixel clocks at 8MHZ and then will go low again until the next line of video data is sent.
Since the prop chip is not fast enough to handle 640x480 RGB565 data I down sample the data to 160x120 RGB565.
Here is the code:
The data gets stored in a 80 long array.
This code works...
But, I have to support YUV422 now. In this mode the first byte is Y then the next byte is U, then Y again, and the V. The above code will only grab the YU componets for every pixel. So... by using the MOVI/MODD/MOVS instructions I will be able to make the loop more simple.
This is much better now. I have plenty of time during the three lines of video data that I skip to unpack and process the data. Grabbing it is the hard part.
There is only one problem with this code change and it is that my array will now be 160 longs instead of 80 longs.
-Phil
Hush!! Phil doesn't want to talk about it.