"<>0" is the equivalent of "= 1" for a hi low read.
Norm
"<>0" is the equivalent of "= 1" for a hi low read.
Norm
Right.... while pin 2 is at a high state shouldn't the program stay in the while/wend loop until it goes low and then jump out and turn on the LED?
this is the code..
Trisa = 1
Trisb = %00100000
portb = 0
while portb.5 = 1
wend
high portb.4
Try adding some debugs to see if you can find where the breakdown occurs:
NormCode:Trisa = 1 Trisb = %00100000 portb = 0 if portb.5 = 1 then SerOut2 cSEROUT_PIN,cBAUD,["PRE HI",13] else SerOut2 cSEROUT_PIN,cBAUD,["PRE LOW",13] endif while portb.5 = 1 if portb.5 = 1 then SerOut2 cSEROUT_PIN,cBAUD,["LOOP HI",13] else SerOut2 cSEROUT_PIN,cBAUD,["LOOP LOW",13] endif wend if portb.5 = 1 then SerOut2 cSEROUT_PIN,cBAUD,["AFT HI",13] else SerOut2 cSEROUT_PIN,cBAUD,["AFT LOW",13] endif high portb.4
What PIC MCU are you using?
Should you be using LATB register instead of PORTB register for your High and Low statements?
Read modify write may be an issue.
Regards,
TABSoft
I am using an 18f2550.....
Norm...I don't think I am experienced enough to use that debug code...
I have looked back at some other code I have written and have used while/wend the same way.. should I use a pullup on portb.5 to ensure it is high?...I will try that but I think I have already..
Thanks for helping me figure this out...
I guess that was it...the pullup resistor on the input...apparently it was floating...
Bookmarks