Hi Dave,
Another gap in my knowledge base I'm afraid, I didn't know you could 'print' the value
Sure, the value returned by Random is just as any other variable stored in WORD size variable.
That should work. Obviously you'd have to change Pause 500 to Pause Y. Another small note, there's really no need for the Y variable in this case, it's perfectly OK to do:
Code:
TRISA.2 = 0
Random X
SEROUT 2 PORTC.3, 16780, [DEC X, 13, 10] 'Send value out
X = X / 22 'Scale down, no need for the Y variable.
PortA.2 = 1
Pause X
PortA.2 = 0
I remember reading that RANDOM in reality is far from that. Being given a certain seed it returns the same "random" number, in the same order every time the program is run, or something like that. Search the forum a bit and I believe you'll find some info regarding that.
/Henrik.
Bookmarks