BusOut's write(int value) method

08 Jun 2011

Hello everyone,

I've recently started debugging an existing project that uses the BusOut class. It was initialized as BusOut CL(p19, p20, p18, p22).

I'm confused when CL = "any number" is called. Especially because it is often called many times in a row without an operation between...(CL =5, Cl = 6, Cl = 7).

Does the write() method write that value to every pin? Does it write that value to each pin in order of how they were declared in the constructor?

Any help would be greatly appreciated!

08 Jun 2011

Every bit in the value you assign corresponds to the pin in the bus. First pin in the constructor's list corresponds to bit 0 (rightmost bit), next one to bit 1 and so on.

Decimal Binary  pins on
======= ======  =======
  0      0000    <none>
  1      0001    p19
  2      0010    p20
  3      0011    p19, p20
  4      0100    p18
  5      0101    p19, p18
  6      0110    p20, p18
  7      0111    p19, p20, p18
  ......................
 15      1111    p19, p20, p18, p22