Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[General] Bit test function using Hitec

Status
Not open for further replies.

prasad70

Member level 3
Joined
Mar 24, 2011
Messages
67
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,288
Activity points
1,690
Dear all,
can some one please explain how 10 bit varaible can be tested using bit test macro ? I am using Hitech .
My requirement is to toggle the status of pin based on value of each bit. Below is the code I used but it is not working.


Code:
while(Y<9) {
         if(BITTST(Y,9))  HighPulse;
            if(!BITTST(Y,9)) LowPulse;
            if(N<9) Y=Y<<1;
       }

best/regards
 

Try this


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
unsigned int tenBitDataUnderTest = 0, mask = 0x0200, i = 0;
 
 
void main() {
 
 
    while(1) {
 
        tenBitDataUnderTest = 0x00AA;
        mask = 0x0200;
 
        for(i = 0; i < 10; i++) {
    
            if(tenBitDataUnderTest & mask)
                //High Pulse
            else
                //Low Pulse
 
            mask >>= 1;
        }
    }
}

 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top