PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Apr 22, 2008 10:08 pm |
|
|
If you have version 4 of the compiler, then you can do arrays of bits.
See the example program below. It displays this as the output:
Code: |
#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
int1 array_of_bits[20] = {0};
//====================================
void main()
{
int8 i;
array_of_bits[0] = 1;
array_of_bits[1] = 0;
array_of_bits[2] = 1;
array_of_bits[3] = 0;
array_of_bits[4] = 1;
array_of_bits[5] = 0;
array_of_bits[6] = 1;
array_of_bits[7] = 0;
for(i = 0; i < 8; i++)
printf("%u", array_of_bits[i]);
while(1);
} |
|
|