LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

device card

Well, when setting / clearin individual bits I usually prepare some useful macros to be used in order to avoid unnecessary calculations all over the code.

 

   // Macro to set individual bits
   #define RST_BIT7 0x7f
   #define RST_BIT6 0xbf
   #define RST_BIT5 0xdf
   #define RST_BIT4 0xef
   #define RST_BIT3 0xf7
   #define RST_BIT2 0xfb
   #define RST_BIT1 0xfd
   #define RST_BIT0 0xfe

 

   // Macro to reset individual bits
   #define SET_BIT7 0x80
   #define SET_BIT6 0x40
   #define SET_BIT5 0x20
   #define SET_BIT4 0x10
   #define SET_BIT3 0x08
   #define SET_BIT2 0x04
   #define SET_BIT1 0x02
   #define SET_BIT0 0x01

 

To set bits I do the following:

   data[0] |= SET_BIT1;
   data[0] |= SET_BIT2;

And to reset individual bits:

   data[0] &= RST_BIT1;
   data[0] &= RST_BIT2;



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 71 of 80
(2,909 Views)

roberto can you explain your logic behind what you are doing?

 

 

 

also we got the card to working, we also did use the same card. i forgot what the engineer said he had to change on the card

 

but it work after he made the necessary changes. Thank You Jesus. Im home free lolololol. tomorrow we are going to test the LED's, he got to hook the box back up with LED's

 

 

0 Kudos
Message 72 of 80
(2,900 Views)

you there roberto lolololol? I will check my email in probably two hours , im getting ready to get off work.

 

 

if you can can you explain your logic of what you code is doing, more so your execution.

0 Kudos
Message 73 of 80
(2,899 Views)

Hi darnell,

 

Why don't you spend some of your time on the code (and on the very first pages of a C textbook) before asking other people to spend their time to explain you even the simplest C coding.

 

If you are really doing so much "second-thinking" on your projects, why don't you do the same -also- on the posts you are sending.

You could save all the hard-workers (like Roberto, Al, etc) of the forum from some trouble.

 

Kudos to you guys... This community owes you so much. 

S. Eren BALCI
IMESTEK
Message 74 of 80
(2,894 Views)

ok my task is done, so the extra stuff i ask about doesnt have nothing to do with my task at all, he came up with an ideal of his logic, so i just said explain his logic.my logic is already done. my device is working.

 

 

0 Kudos
Message 75 of 80
(2,892 Views)

@darnell: it's simply a bitwise ANDing or ORing of byte variables, using predefined masks (e.g. 0xEF which is binary 1110 1111) to avoid calculating the mask every time I need it. Test with the corresponding boolean truth table on some value and you will see how it's used to raise or lower individual bits.

 

 

@ebalci: I saw the terribles news about the floods that hit your country these days: I hope that it will end very soon and that you can restore all damages in a very short time. My prayers for the victims of the disaster.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 76 of 80
(2,874 Views)

darnell has finished with his task ? at last...

 

i will follow ebalci on this: we owe BIG kudos to Al and Roberto for their patience and determination in answering all those questions while always staying calm, nice and polite. congratulations, you are the zen masters of this forum.

0 Kudos
Message 77 of 80
(2,867 Views)

Im cool you guys, I understood where he's coming from. I really dont like sending messages. i would rather call and ask my questions.

 

because sometimes people really can get me confuse through sending messages. i have learn alot of my weakness through you guys.

 

i really appreciate  everyone that contributed. Im really a math guy . but i have been programming for the last three years. But some of the questions

 

I ask could have  been avoided if had just a lil more confidence. 90% of the time i have completed what you guys would already suggest  that i do,

 

then when i couldnt get no response from the device then i would go asking all the stupid questions i just perform just to get an confirmation.

 

school now and days need start from the basic C, and then break out into C++. my opinion starting from C++ , you kind of miss alot of old unique tricks.

 

"but to each is own" !!!!!!!

 

may i ask y do you want to reset the bits in your logic.

0 Kudos
Message 78 of 80
(2,841 Views)

Hi All,

 

I wanted to say a special thank you to all those involved in this forum post! It is users like you that make the LabWindows/CVI community so unique. National Instruments truly appreciates and values your involvement and dedication in the discussion forums. 

 

 

Thanks again,

 

-Adri Kruger

LabWindows/CVI Product Manager

Adri Kruger
National Instruments
LabVIEW Product Marketing
0 Kudos
Message 79 of 80
(2,830 Views)

Roberto, yes we are passing through some hard times here.

Thank you very much for your sincere wishes.

 

What happened was a result of an ecologically disturbed earth and corrupt administration combined together.

People hardly learn from their mistakes, unfortunately.

All we can do is to hope and to pray that rest of the fall and winter does not bring similar pains to us or other people around the world.

S. Eren BALCI
IMESTEK
0 Kudos
Message 80 of 80
(2,772 Views)