Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20615

BASCOM-AVR : Random output pin toggling : REPLY

$
0
0
Plenty of ideas, but nothing you cannot get by just looking in the Help at the RND function, plus how to set a port for output and set a bit within the port. Suppose you want to use portX, bit Y as output. Then something like this would work: [code:1:fa35351150] config portX.Y as output 'set port line for output dim wrandom as word 'define a word variable dim btemp as byte 'and a byte do 'loop forever wrandom = rnd(256) 'generate random number in range 0-255 portX.Y = wrandom.0 'assign bit 0 from number to port pin loop [/code:1:fa35351150]

Viewing all articles
Browse latest Browse all 20615

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>