Raady Here
Full Member level 5
- Joined
- Jun 8, 2013
- Messages
- 242
- Helped
- 26
- Reputation
- 52
- Reaction score
- 26
- Trophy points
- 28
- Location
- India
- Activity points
- 1,571
PIC18f67k22, MPLAB 8.8V
Hi,
I created a union of 48 bits, connected 48 LEDs to the 48 port pins and I am trying to send data to the port pins through function"TOPORT(BYTE cmd)" and trying to shift bits,
but I can observe blinking only from 0 to 31 led, from 32 to 47 doesn't work.
if i change 'cmd' from 'long int' to 'double' then bit shifting also doesn't work and 32 to 47 led doesn't work.
is there any limit for the buffer for these processors as it is 8 bit processor ?
Hi,
I created a union of 48 bits, connected 48 LEDs to the 48 port pins and I am trying to send data to the port pins through function"TOPORT(BYTE cmd)" and trying to shift bits,
but I can observe blinking only from 0 to 31 led, from 32 to 47 doesn't work.
if i change 'cmd' from 'long int' to 'double' then bit shifting also doesn't work and 32 to 47 led doesn't work.
is there any limit for the buffer for these processors as it is 8 bit processor ?
Code:
typedef unsigned long int BYTE;
typedef union _display
{
BYTE PORT;
struct
{
unsigned Z01:1;
unsigned Z02:1;
unsigned Z03:1;
.....
unsigned Z47:1;
unsigned Z48:1;
};
} display_flags;
void TOPORT(BYTE DT)
{
LED_P.PORT = DT;
LED01 = LED_P.Z01;
LED02 = LED_P.Z02;
LED03 = LED_P.Z03;
.......
LED46 = LED_P.Z46;
LED47 = LED_P.Z47;
LED48 = LED_P.Z48;
Delay100TCYx(100);
}
void main()
{
unsigned int ih = 0;
....
while(1)
{
cmd = 0b000000000000000000000000000000000000000000000001;
for(ih = 0;ih<48; ih++)
{
TOPORT(~cmd);
cmd = cmd << 1;
}
}
}