gpiosetbits(PORTG, (value << 8) & 0xff00); gpioclearbits(PORTG, (~value << 8) & 0xff00);
should do the job then Quoting f_lamme <[EMAIL PROTECTED]>: > But this way I move all the 32 bits. > I need to move only these 8 > PG8-PG15 > > --- In [email protected], John Crispin <[EMAIL PROTECTED]> wrote: >> >> hi >> >> gpiosetbits(PORTG, (value << 8) & 0xffffff00); >> gpioclearbits(PORTG, (~value << 8) & 0xffffff00); >> >> >> although the & 0xffffff00 bit is not really needed, it is just for > sanity >> >> john >> >> > if (value&0x01) >> > gpiosetbits(PORTG, PG8); >> > else >> > gpioclearbits(PORTG, PG8); >> > if (value&0x02) >> > gpiosetbits(PORTG, PG9); >> > else >> > gpioclearbits(PORTG, PG9); >> > if (value&0x04) >> > gpiosetbits(PORTG, PG10); >> > else >> > gpioclearbits(PORTG, PG10); >> > if (value&0x08) >> > gpiosetbits(PORTG, PG11); >> > else >> > gpioclearbits(PORTG, PG11); >> > if (value&0x10) >> > gpiosetbits(PORTG, PG12); >> > else >> > gpioclearbits(PORTG, PG12); >> > if (value&0x20) >> > gpiosetbits(PORTG, PG13); >> > else >> > gpioclearbits(PORTG, PG13); >> > if (value&0x40) >> > gpiosetbits(PORTG, PG14); >> > else >> > gpioclearbits(PORTG, PG14); >> > if (value&0x80) >> > gpiosetbits(PORTG, PG15); >> > else >> > gpioclearbits(PORTG, PG15); >> > // cs e clk >> > gpioclearbits(PORTG, PG1); >> > gpiosetbits(PORTG, PG3); >> > gpioclearbits(PORTG, PG3); >> > if (clk==1) >> > { >> > gpiosetbits(PORTG, PG3); >> > gpioclearbits(PORTG, PG3); >> > } >> > gpiosetbits(PORTG, PG1); >> > >> > } >> > the problem and the slowness with which the byte is sent because the >> > byte is sent bit per bit. >> > Does a way exist to send a whole byte? >> > I excuse but I do not speak English very well >> > >> > >> > > >
