send 2 bytes as bit by bit (sreial)

General discussion on mikroBasic PRO for AVR.
Post Reply
Author
Message
SPOTLIGHT81
Posts: 9
Joined: 29 Jan 2022 10:25

send 2 bytes as bit by bit (sreial)

#1 Post by SPOTLIGHT81 » 16 Jun 2022 21:32

hi all
i need some help to drive 2 74595 and 4 digits 7 segment
the high byte for digit data and low byte to active one digit of 7 segment


Code: Select all

unsigned test;

void SendTowBytes (unsigned int TowBytes)
{
unsigned short stb;
RCLK = 0;
for (stb = 0; stb < 16; stb++)
        {
        SCLK = 0;
        if (TowBytes & 0x8000) DIO = 1;
        else DIO = 0;
        SCLK = 1;
        TowBytes <<= 1;
        }
RCLK = 1; /// to active outputs
}

void main (void)
{
while (1)
	{
	test = ("high byte here" << 8) + "low byte here";
	SendTowBytes (test);
	}
}


Post Reply

Return to “mikroBasic PRO for AVR General”