I have written a program in C on a freescale 8 bit micro.
The code is:
Pins 4,5,6,7 are inputs pulled high
the rows are outputs pins 0,1,2,3 and polled.
Now, the 4th column works perfect. The first three dont. When I put an o-scope up to the pull up resistors, I get a voltage drop of around 0.5V, so the votlage is dropping, but not from 5-0V. I have NO IDEA why this is happening. ALl the code seems the same to me, why does column 4 work and not 1,2 or 3??
Any help would be great.
The code is:
Rich (BB code):
while (column==1)
{
PTBD = 0xFE;
if (PTBD == 0xEE)
{
PTDD = 0x01;
lcd_delay(2000000);
PTDD = 0x00;
}
if (PTBD == 0xDE)
{
PTDD = 0x02;
lcd_delay(2000000);
PTDD = 0x00;
}
if (PTBD == 0xBE)
{
PTDD = 0x03;
lcd_delay(2000000);
PTDD = 0x00;
}
if (PTBD == (0x7E))
{
PTDD = 0x04;
lcd_delay(2000000);
PTDD = 0x00;
}
else column = 2;
}
while (column==2)
{
PTBD = 0xFD;
if (PTBD == 0xED)
{
PTDD = 0x05;
lcd_delay(2000000);
PTDD = 0x00;
}
if (PTBD == 0xDD)
{
PTDD = 0x06;
lcd_delay(2000000);
PTDD = 0x00;
}
if (PTBD == 0xBD)
{
PTDD = 0x07;
lcd_delay(2000000);
PTDD = 0x00;
}
if (PTBD == (0x7D))
{
PTDD = 0x08;
lcd_delay(2000000);
PTDD = 0x00;
}
else column = 3;
}
while (column==3)
{
PTBD = 0xFB;
if (PTBD == 0xEB)
{
PTDD = 0x09;
lcd_delay(2000000);
PTDD = 0x00;
}
if (PTBD == 0xDB)
{
PTDD = 0x0A;
lcd_delay(2000000);
PTDD = 0x00;
}
if (PTBD == 0xBB)
{
PTDD = 0x0B;
lcd_delay(2000000);
PTDD = 0x00;
}
if (PTBD == (0x7B))
{
PTDD = 0x0C;
lcd_delay(2000000);
PTDD = 0x00;
}
else column = 4;
}
while (column==4)
{
PTBD = 0xF7;
if (PTBD == 0xE7)
{
PTDD = 0x0D;
lcd_delay(2000000);
PTDD = 0x00;
}
if (PTBD == 0xD7)
{
PTDD = 0x0E;
lcd_delay(2000000);
PTDD = 0x00;
}
if (PTBD == 0xB7)
{
PTDD = 0x0F;
lcd_delay(2000000);
PTDD = 0x00;
}
if (PTBD == (0x77))
{
PTDD = 0x10;
lcd_delay(2000000);
PTDD = 0x00;
}
else column = 1;
}
the rows are outputs pins 0,1,2,3 and polled.
Now, the 4th column works perfect. The first three dont. When I put an o-scope up to the pull up resistors, I get a voltage drop of around 0.5V, so the votlage is dropping, but not from 5-0V. I have NO IDEA why this is happening. ALl the code seems the same to me, why does column 4 work and not 1,2 or 3??
Any help would be great.
Last edited by a moderator: