I know this doesn't answer your question.
But perhaps all you need is ...Code:PORTC = DCD Voltage.HighByte PAUSE 100
I know this doesn't answer your question.
But perhaps all you need is ...Code:PORTC = DCD Voltage.HighByte PAUSE 100
DT
Code:<font color="#000080"><i> </i></font>Temp <font color="#000080"><b>VAR WORD </b></font>Temp = <font color="#FF0000">512 </font>- voltage <font color="#000080"><i>' Voltage </i><b>SELECT CASE </b></font>Temp <font color="#000080"><b>CASE IS </b></font>< <font color="#FF0000">256 </font><font color="#000080"><i>' Voltage is greater than 256. </i><b>END SELECT </b></font>
Last edited by sayzer; - 24th November 2009 at 08:55. Reason: typo
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
bmsherma, Try this...
SELECT CASE VOLTAGE
CASE < 257
PORTC = %0001
CASE < 513
PORTC = %0010
CASE < 769
PORTC = %0100
CASE < 1024
PORTC = %1000
END SELECT
Pause 100
I use this construct when determining groups of numbers. You start with the smallest and move up to the largest.
Dave Purola,
N8NTA
Thanks everyone for the advice.
Dave P, your idea seems to work. However what if I want to isolate the low range OR the high range. I'm essentially trying to put logical operators in my case statement.
Case is < 256 OR is > 768
PORTC = %0001
Case Else
PORTC = %1000
Can I write that first Case statement with the OR term?
Or would I have to do this:
Case is < 256
PORTC = %0001
Case is > 768
PORTC = %0001
Case else
PORTC = %1000
Is there no way to use logical operators in Case Statements in PICBasicPRO??!
bmsherma, The second way you have it is the way I would do the construct..
Dave Purola,
N8NTA
Hi,
With a very, very very little Trickery ... I think it makes it.
AlainCode:IF ( Voltage.8 ^ Voltage.9 ) THEN PORTC = 1 ELSE PORTC = 8 ENDIF
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks