Write a C program to send out the value 44H serially one bit at a time via P1.0. The LSB should go out first.

By

Write a C program to send out the value 44H serially one bit at a time via P1.0. The LSB should go out first.

Solution:



#include <reg51.h>

sbit P1b0 = P1^0;

sbit regALSB = ACC^0;

void main(void) {

  unsigned char conbyte = 0x44;

  unsigned char x;

  ACC = conbyte;

  for (x=0; x<8; x++) {

    P1b0 = regALSB;

    ACC = ACC >> 1; }


}

1 comment:

If you have any questions or droughts feel free to ask here.