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.

Switch Statement with < or >

Status
Not open for further replies.

ste2006

Advanced Member level 4
Joined
May 1, 2012
Messages
118
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Activity points
2,226
Anyone any ideas if i can use operands in a switch statement such as < or >

I am using MPLAB with some PIC Micros and trying to evaluate stages in temperature

Anyone have any ideas??

Thanks
 

hy ste
you can use switch statement with
void main(void)
{

char a=1,b=1;
trisb=0;//o/p
for(;;)
{
switch(a|b)
{
case 1:
portb.f0=1;
}
}
}
 

I want to evaluate is the ADC value returned between x and y, if not between x1 and y1 etc

So want to ultimately control a fan speed over say 20 levels depending on temperature
 

The value used in a switch() statement should be a variable, the value in a "case:" statement must be a constant. It is hard coded when the program is compiled so it has to be a constant.

Brian.
 

Thanks Brian,

I am just using some If-Else statements now and its fine,

Regards,
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top