Ok, I got off on a different project for a while. Now to pick this up again! Lets see if I can get my head around this and remember where I was at.
Ok, I got off on a different project for a while. Now to pick this up again! Lets see if I can get my head around this and remember where I was at.
Yes, this seems to work! I need to check one other thing before I sign this off. But I left some of my notes at work. So I will check the last thing tomorrow morning.
Can someone answer what the .0 is for or how it behaves in the line:
IF relay = 1 THEN CW = Stat.0 ' Process relay#1
IF relay = 2 THEN CCW = Stat.0 ' Process relay#2
I understand the "stat" part, but not seeing what .0 function is.
Thank you
Scott
Stat VAR BYTE 'relay status ON/OFF variable
8 bits in a byte -- 0 to 7
IF relay = 1 THEN CW = Stat.0 ' Process relay#1
Stat.0 is the first bit of byte Stat
From the PBP manual
4.4. Aliases
VAR can also be used to create an alias (another name) for a variable. This is most useful for accessing the innards of a variable.
fido var dog ' fido is another name for dog
b0 var w0.byte0 ' b0 is the first byte of word w0
b1 var w0.byte1 ' b1 is the second byte of word w0
flea var dog.0 ' flea is bit0 of dog
Dave
Always wear safety glasses while programming.
Ok! It is all good. Thanks to all that helped me get a handle on this. Makes sense, and I see why it did not work early on, and understand what I did wrong.
Thanks,
Scott
Bookmarks