SwingeyP
Member
I want to define the controller pins as variables. Is this possible?
The project is to switch a random output on for a random period of time.
So far I have this ...
I think you'll get the idea. I want to be able to say Pin.random = on blah blah blah ....
Regards - Paul
The project is to switch a random output on for a random period of time.
So far I have this ...
Code:
Dim seed As Long
Dim random As Word
seed = %11000111
start:
random = rand(9)
PORTA.random = 1 'This doesn't work is it possible to address each pin as a variable?
Goto start
End
Function rand(range As Byte) As Word
Dim i As Byte
Dim feed As Bit
Dim temp As Long
For i = 0 To 7
feed = seed.7 Xor seed.2
seed = ShiftLeft(seed, 1)
seed.0 = feed
Next i
temp = seed And 255
temp = temp * range
rand = temp / 256 'To 0 - range
End Function
I think you'll get the idea. I want to be able to say Pin.random = on blah blah blah ....
Regards - Paul