This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

interfacing a P89C668 microcontroler with a anybus compactcom module

Hello

I'm making a career end project, and i've got to make a succesfull communication between the philips p89c668 microcontroller (8kb xram, 64 kb rom) and an anybus compactcom module to get fieldbus communication between a master and the microcontroller.

With the anybus compactcom module was shipped a generic driver.

My intention is to fit the driver in the host program in order to achieve the communication, but i've got some problems to do this:

1.- the fieldbuses can manage 64 bit data like double longs, double floats... can the uvision manage them? wich typedefs can i use?

2.- if anybody had done a similar implementation, can i have a watch over this?

Thank a lot for your attention, and excuse for my poor english. I can be weird, but I think that it is readable and can be understood.

Parents Reply Children
  • Ok. Firts of all, thanks a lot for your comments.

    I want a 64 bit unsigned integer.
    So the solution can be an array of 8 integers or an array of two unsigned long int (32bit), isn't it?

    And for make a SIGNED 64 bit data? Perhaps a thing like this?

    MSB LSB MSB LSB
    |------------------|---------------------|
    | signed int 32bit | unsigned int 32 bit |
    |------------------|---------------------|

    MSB LSB
    |----------------------------------------|
    | signed int 64 bit |
    |----------------------------------------|

    I think it can be like this because the sign is only allocated on the most significant bit of the data. No sign is needed on the lower long int.

  • "I want a 64 bit unsigned integer."

    Does your code actually need to process this (ie, do arithmetic on it), or just pass it through?

    If you need to do 64-bit arithmetic, you will have to implement that yourself - probably in assembler.

    "the solution can be an array of 8 integers"

    Note that "integer" is just a generic term for any whole number.
    That's why I've been careful to say "byte" where I mean specifically an 8-bit data type.

    Note that you need to use the 'pre' and '/pre' tags (as for posting code) to make the diagram work:

     MSB            LSB MSB               LSB
    |------------------|---------------------|
    | signed int 32bit | unsigned int 32 bit |
    |------------------|---------------------|
    
     MSB                                  LSB
    |----------------------------------------|
    |          signed int 64 bit             |
    |----------------------------------------|
    


    See: http://www.keil.com/forum/tips.asp

    But yes - that's the kind of thing.

  • With the exception of add and subtract, the code to operate on larger numbers than is natively available is often simpler if you work with sign+magnitude, instead of working with two-complement numbers.

    In two-complement form, you often have to negate one or both of the numbers, before they may be used in evaluations.

    An example: A multiply of a number with -2 would require you to multiply the number with 0b1111...1110 in two-complement form. If you just start to multiply, you would get a huge number, before reaching the sign bit and "collapsing" the result. To avoid this, you would first have to detect the sign and negate the value -2 before starting the multiply.

    If performing the multiply using sign+magnitude, you would just multiply your number with 0b10 and then set the final sign to the xor of the two original sign bits.

  • Does your code actually need to process this (ie, do arithmetic on it), or just pass it through?

    No, i don't have to do arithmetic operations with the 64 bit data. This data can be used to make position reference signals, to pass position signals...

    Thanks a lot for all your posting style tips. :)

  • With the exception of add and subtract, the code to operate on larger numbers than is natively available is often simpler if you work with sign+magnitude, instead of working with two-complement numbers.

    I think that i will use sign+magnitude. It doesn't matter a lot, because as i posted before, I don't need to make arithmetic operation. So i can use also one-complement or two-complement.

    Thanks a lot for your attention.