There are 3 i/o ports which is connected directly to the IC to be tested. For each IC pin diagram will be different. That is we have to configure those 24 pins as input port or output port as per the IC number. This can be divided into three categories, DDR (data direction register in atmega32), data out and data in. We are using only one port to communicate with computer. Therefore we have got at max 8 pins. In that one nibble is used for data transfer only and the other nibble for determining the following things
· Of which port is the data in the most significant nibble of porta. That is portb lowest nibble, portb highest nibble, portc lowest nibble, portc highest nibble, portd lowest nibble or portd highest nibble.
· What kind of data is in the least significant nibble. That is value to be stored in DDR (data direction register of atmega32), PORTA/B/C (value to be outputted to data register of PORTB/C/D) or PINB/C/D (value to be inputted from pins of PORTB/C/D).
Now its clear that there are three combinations for what kind of data is available in most significant nibble. Also 6 nibbles are to be controlled. So total we need 18 different kind of data to be transferred through most significant nibble. Remaining number of bits to control this is only four. With four using usual convention only 16 combinations can be made. For this, the strategy we implemented is as follows,
D0-D3 of PORTA is first four the least significant bits, ie least significant nibble. Now, initially we will set this to 0000. The first bit which becomes high will decide what kind of data is in the bits D4-D7 of PORTA. Suppose first D3 becomes high, then the data in the bits D4-d7 of PORTA is DDR. Suppose first D2 becomes high, then the data in the bits D4-d7 of PORTA is PORTB/C/D. Suppose first D1 becomes high, then the data in the bits D4-d7 of PORTA is PINB/C/D. After this what we want to know is, of which nibble should the data in the bits D4-D7. This is determined by the remaining bits, ie suppose first D1 becomes high, then the remaining bitw D3,D2,D0 will determine that. If D3,D2,D0 is 010, it means data in the bits D4-D7 belongs to most significant nibble of PORTB, ie D4-D7 of PORTB. And since first D1 becomes high it implies PINB/C/D. So the value in D4-D7 of PORTA is the value from D4-D7 of PORTB. In this way we can get and write values to all 24 pins.
SOFTWARE AND HARDWARE
AVRDUDE programmer, Avrstudio4.0