For Programmers: Free Programming Magazines  


Home > Archive > Matlab > April 2005 > PCI_6025E digital output interface









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author PCI_6025E digital output interface
ahsan

2005-04-01, 4:03 pm

How can I send an 8-bit value to the digital output of the PCI_6025E
from a decimal value in simulink, using the XPC digital output block?
Gordon Weast

2005-04-06, 12:54 pm

Ahsan,

Since the block wasn't built to directly take an 8 bit value and output
it, you have to determine the value of each bit and feed that to the
corresponding input to the block. Set it up for all 8 bits (channels),
then take your input number and use a data type conversion to change
it to a uint8. Feed the output of that to 8 AND blocks, one for each
bit, input & 1, input & 2, input & 4, input & 8, etc. The outputs of
the AND blocks go to the DO block. You might have to use another
data type conversion back to double after each of the AND blocks.

I know it's a bit clumsy, but that is how you will have to do it
unless you want to write your own digital out S function.
The AND blocks are inlined so they are quite efficient.

Gordon Weast
xPC Target Development
The Mathworks

ahsan wrote:

> How can I send an 8-bit value to the digital output of the PCI_6025E
> from a decimal value in simulink, using the XPC digital output block?

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com