how to loop thru setting port bits?
I have a variable array, now I need to cycle thru it and set PORTB bits based on values in that array, heres my code
Code:
FOR CNT = 0 to 7
IF TEMP[CNT] < 100 then PORTB.CNT = 0
IF TEMP[CNT] >= 100 then PORTB.CNT = 1
NEXT CNT
Now "TEMP[CNT]" works fine, but it throws an error on "PORTB.CNT"
Error is Bad Variable Modifyer ".CNT"
I Changed it to PORTB.(CNT)
New Error, Bad Token "."
Re: how to loop thru setting port bits?
Hi,
Try
Code:
IF TEMP[CNT] < 100 then PORTB.0(CNT) = 0
For more info see Melanies excellent write up and the follow up discussions.
/Henrik.
Re: how to loop thru setting port bits?
ok i didnt get a error on compile but i cant test it yet as Ive got alot more code to finish. but no errors looks good so far.