Professional Documents
Culture Documents
Jean-Jacques Aubry,
Ollioules
1. Creating an image in the MCU RAM of the columns where each byte represents a single pixel in
the GLCD RAM column, hence a value of 0 or 1.
uchar xdata Column_Array[(LCD_ROWS + 1) * 8]; // + 1 for 2nd byte of char in last
line
2. Creating a routine to read the display column (in fact the mirror) and write, after converting to
equivalent bits (0 or 1), into Column_Array [].
void GLCD_read_column(uchar col)
{
uchar rows, pix, i, j;
i = 0;
// read column col, byte after byte
for (rows = 0; rows < LCD_ROWS; rows++)
{
pix = GLCD_Array[col][rows];
// write pix, bit after bit
for (j = 0; j < 8; j++)
{
Column_Array[i] = pix & 0x01;
pix >>= 1;
i++;
}
}
}
3. Creating a routine to read the contents of Column_Array[], write to the GLCD RAM, and update
the mirror:
void GLCD_write_column(uchar col)
{
uchar rows, pix, i, j;
i = 0;
// write column col, byte after byte
for (rows = 0; rows < LCD_ROWS; rows++)
{
pix = 0;
// read pix, bit after bit
for (j = 0; j < 8; j++)
{
pix += Column_Array[i] << j;
i++;
}
if (GLCD_Array[col][rows] != pix)
{
Projects
GLCD_set_pos(rows, col);
GLCD_WriteData(pix);
GLCD_Array[col][rows] = pix;
4. Creating a routine to display a defined icon in bitmap. This can be done anywhere, whatever its
size (within the limits of the display!)
void GLCD_show_icon(uchar code *bitmap, uchar width, uchar height, uchar x, uchar
y, uchar mode)
{
uchar tx, ty, pix, hb, i, j, k;
hb = (height - 1) / 8 + 1; // character height in bytes
for (tx = 0; tx < width; tx++) // loop for width columns
{
GLCD_read_column(tx + x);
i = y;
k = 0;
for (ty = 0; ty < hb; ty++) // read hb bytes of icon
{
pix = *(bitmap + ty * width + tx); // read one byte
if (mode == GLCD_PIXEL_OFF)
pix = ~pix;
for (j = 0; j < 8; j++) // write 8 bits of pix to Column_Array
{
if (mode != GLCD_PIXEL_INV)
Column_Array[i] = pix & 0x01;
else
Column_Array[i] ^= pix & 0x01;
pix >>= 1;
if (k == height)
break;
i++;
k++;
}
}
GLCD_write_column(tx + x);
}
}
5. And lastly, creating a write routine for text, which just means writing a succession of icons that
are defined in a font.
void GLCD_draw_text( uchar x, uchar y, uchar *text , uchar mode )
{
uchar i, posx, posy;
uchar *pt;
posy = y - font_height + 1;
for( pt = text, i = 0; *pt; i++, pt++ )
{
posx = x + i * font_width;
if( posx + font_width > LCD_COLS )
{
i = 0;
posx = x;
posy += font_height;
}
GLCD_show_icon( font + (*pt - font_offset) * font_charsize, font_
width, font_height, posx, posy, mode );
}
}
Measurement accuracy
The impedance to be measured can be written:
Zx =
Vp + j Vq
I p + j Iq
Vq I p Vp I q Gi Rsense
Gi Rsense Vp I p + Vq I q
+j
=
I p2 + I q2
Gv
Gv
I p2 + I q2
where Gi and Gv are the current and voltage gains of the amplifier chain, and Rsense is the IU_converter resistor.
RS =
Vp I p + Vq I q
I p2 + I q2
Z = RS + j XS
XS =
Vq I p + Vp I q
I p2 + I q2
If we ignore the digitizing errors, as explained in the We need to keep an eye on the gain paragraph in the first article [1],
then:
We can split the overall error into two main parts:
the error due to the inaccuracy in the PGA103 and DAC8811 gains
the error in the true value of the resistors in the IU_converter (calibration error).
To this will be added an error due to:
the display ( 1 bit in the last digit)
the residual phase error (after phase error compensation)
the fluctuation caused by amplification noise and stray signals picked up by the measuring leads (power line, etc.)
And then the digitizing error will appear in ranges 1 and 8, when the amplitudes of the voltage or current signals become
too different through lack of gain.
10
100
0.005%
0.02%
0.05%
0.02%
0.05%
0.2%
For ranges 36, the PGA103 programmable amplifier always has unity gain and the term
is zero.
For ranges 2 and 7, this term introduces a maximum error of 0.07 % (typically 0.025 %).
For ranges 1 and 8, this term introduces a maximum error of 0.07 % (typically 0.025 %).
Projects
According to the TI documentation for the DAC8811C, its max. relative precision is 1 LSB Hence the maximum gain
error will be 1/N, where N is the code defining the final amplifier gain.
post_Ampli. step
7 500
8 700
10 000
11 600
13 500
15 500
18 000
20 700
post_Ampli. step
24 000
27 600
32 000
36 900
42 600
49 100
56 700
65 500
When the post_amplification_U and post_amplification_I steps are equal, the term
is zero.
Otherwise, it is maximum when one is 0 and the other 1; it then has a value of
1
1
+
7500 8700
i.e. 0.025 %.
(130174)