Why clear the High Green nibble?

This forum is used for discussing hardware, software, and technical details of the AVRcam embedded system.

Why clear the High Green nibble?

Postby catalin_cluj » Wed Feb 21, 2007 11:38 pm

Hi John,
In "CamInterfaceAsm.s", why do you clear the high green nibble (line 243):
>>>
_acquirePixelBlock:

in ZL,RB_PORT ; sample the red value (PINB)
in YL,G_PORT ; sample the green value (PINC)
andi YL,0x0F ; clear the high nibble --------------------------------<<<HERE
ldd color,Z+RED_MEM_OFFSET ; lookup the red membership
in ZL,RB_PORT ; sample the blue value (PINB)
ldd greenData,Y+GREEN_MEM_OFFSET; lookup green membership
ldd blueData,Z+BLUE_MEM_OFFSET; lookup the blue membership
and color,greenData ; mask memberships together
and color,blueData ; to produce the final color
brts _cleanUpTrackingLine ; ...
<<<
I thought the high nibble has most info that we care about... what am I missing, please?
Did you somewhere swap the nibbles?


Thanks,

Cat
catalin_cluj
 
Posts: 11
Joined: Sat Feb 10, 2007 4:00 pm

Postby johno » Thu Feb 22, 2007 7:30 am

It is the high-nibble of each pixel data bus we care about. If you check out the schematic, you'll see that the upper four bits of the OV6620's pixel data bus are connected to the lower four bits of the mega8's input port (this applies to both the Y and the UV data busses coming off the OV6620). The only reason that it is necessary to do the clearing of the upper nibble here is because the upper two bits on port C actually are utilized as part of the I2C bus. Port C on the mega8 is only a 6-bit bus.

So its ok to do a read of the entire 8-bit bus on the mega8 (and thus the "in YL,GPORT" instruction), but the upper four bits, which don't contain any pixel/color info, need to be cleared, so that just the lower four-bits serve as the index into the colorMap.

Make sense?
-John O
Site Admin
johno
 
Posts: 51
Joined: Thu Mar 16, 2006 2:29 pm

Postby catalin_cluj » Thu Feb 22, 2007 7:03 pm

Ahaaaaa....

It would have been too much for me to look at both schematics and code at the same time :roll:

I suppose port B gets it's high nibble cleared somehow too... even if I don't see it...

Thanks.

Cat
catalin_cluj
 
Posts: 11
Joined: Sat Feb 10, 2007 4:00 pm

Postby johno » Fri Feb 23, 2007 11:58 am

Not exactly...the high-nibble of PORT B (in reality, only 2 bits of the nibble, since PORTB is only a 6-bit port) is unused when the system is operating. The upper two bits (4 and 5) ARE used during in-system reprogramming, but if a programmer isn't connected they are not connected to anything (and pulled low internal to the mega8, IIRC).
-John O
Site Admin
johno
 
Posts: 51
Joined: Thu Mar 16, 2006 2:29 pm


Return to AVRcam Embedded System

Who is online

Users browsing this forum: No registered users and 20 guests

cron