2011/3/27 mattschinkel <[email protected]>

> > > MSSP2 will require a separate SPI library, or a constant in the
> > > current lib to choose between 1 and 2.
> >
> > OK. I guess this is the same for serial hardware with RX1/TX2 and
> RX2/TX2.
> > Preprocessor to the rescue ?
>
> Someday we all need to decide on either using the same library twice,
> or create a 2nd library. A preprocessor doesn't seem like the right
> solution. Again, pointers would be nice.
>
>

I even do need it now.
Not only to decide which module, registers, i need to use seperate ports for
two different
devices simultaneously.

My need for now is to select different two similar (better equivalent) i2c
devices.
I use software I2C, my work is to be easier in this way, but it isn't. Or i
haven't enough knowledge about JAL.

..........................
.....

var byte I2C_PortIndex = 1

.............................


---
//==============================================================================
--- //Initializes the ports for I2C interface
---
//==============================================================================
procedure i2c_initialize() is
---
//==============================================================================

if (I2C_PortIndex == 1) then
  i2c_SHT21_sda_direction = low;                // Set port as output for
configuration
  i2c_SHT21_scl_direction = low;                // Set port as output for
configuration

  i2c_SHT21_sda = low;           // Set SDA level as low for output mode
  i2c_SHT21_scl = low;           // Set SCL level as low for output mode

  i2c_SHT21_sda_direction = high;               // I2C-bus idle mode SDA
released (input)
  i2c_SHT21_scl_direction = high;               // I2C-bus idle mode SCL
released (input)
end if

if ( I2C_PortIndex == 2 )  then
  i2c_SHT21_sda_direction_2 = low;                // Set port as output for
configuration
  i2c_SHT21_scl_direction_2 = low;                // Set port as output for
configuration

  i2c_SHT21_sda_2 = low;           // Set SDA level as low for output mode
  i2c_SHT21_scl_2 = low;           // Set SCL level as low for output mode

  i2c_SHT21_sda_direction_2 = high;               // I2C-bus idle mode SDA
released (input)
  i2c_SHT21_scl_direction_2 = high;               // I2C-bus idle mode SCL
released (input)
end if

end procedure


.....

....

This is only the shortest procedure.

This perspective is not tested OK yet, but i haven't be able to find another
way.
And all procedures are multiplied like this by the sensor count  (and also
the code size is multiplied).

If i could be able to dynamically change the alias to point another
register, this would never be a problem.




> Maybe you can ask William if you can add a optional constant for
> choosing what SPI port to use (after you test with ENC28J60 of
> course).
>
> Matt.
>
> --
> You received this message because you are subscribed to the Google Groups
> "jallib" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/jallib?hl=en.
>
>


-- 
*Serdar KIZILTOPRAK
Intelligence **Technology Systems
[email protected]
http://www.its3k.com
+90(216) 518 15 00*
 **

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to