#include <reg51.h>
/* 0xc0 = NOP 0xd0 = Addr 0xe0 = Write 0xf0 = Read
*/
/* outputs */
sbit STROBE = P1^6; /* clock pin is P1.6 */
sbit DATA3 = P1^3; /* data3 pin is P1.3 */
sbit DATA2 = P1^2; /* data2 pin is P1.2 */
sbit DATA1 = P1^1; /* data1 pin is P1.1 */
sbit DATA0 = P1^0; /* data0 pin is P1.0 */
/* I don't think this is necessary since I only care about 5 of the
pins
from P1 but it can't hurt - GWL */
#define WRITECOM 0x20
/* macro definitions
/* Send the low order nibble first and then the high order nibble */
#define SendNibl0(value)\
P1 = (0x00 | WRITECOM | (value & 0xf));\
STROBE = 1; STROBE = 0; /* clock it */
#define SendNibl1(value) \
P1 =(0x00 | WRITECOM | ((value>>4) & 0xf)); \
STROBE = 1; STROBE = 0; /* clock it */
void uConSend(unsigned char value)
{
/* Send the data; first the low order and then the high order
nibble */
SendNibl0(value);
SendNibl1(value);
}