• PicŪ Basic


  • Random Generator with no external components

    The code works only on devices with some spare EEPROM (2 bytes) space. It consecutively uses seed values. Between runs, the seed is increased each time the PICŪ is startup. This way, each time the PICŪ is started a new value is entered as a seed and a new range of random numbers will be generated.

    BE CAREFULL: Only call this function on "startup" of the PICŪ to avoid wearing the EEPROM.

    It still is not a "real" random number but it is a quite good solution for those with no external resources able to generate a random number.

    Code:
    SYMBOL SEED_POSITION = 0
     
    DIM tmp_seed as WORD
     
    'INITIALIZATION
    '===========
     
    tmp_seed.lowbyte = EREAD SEED_POSITION
    tmp_seed.highbyte = EREAD SEED_POSITION + 1
     
    SEED tmp_seed
    INC tmp_seed
     
    EWRITE SEED_POSITION, [tmp_seed]
    contributed by Tom Van den Eede.
  • Recent Activity

    teo-16018

    Microsoft security essentials blues

    Thread Starter: shantanu@india

    Hi, A strange thing happened just now.My Windows 7 Micrsoft Sercurity Essentials suddenly gave a warning that prplus.exe(Compiler) is a potential...

    teo Today, 19:23 Go to last post
    David Barker-251

    UMC bootloader 18F46K22

    Thread Starter: shunt010

    Hi all. I am trying to build a UMC bootloader file for the 18F46K22, and it doesn't appear to work. It returns (in the error log) Error ...

    David Barker Today, 11:20 Go to last post
    barak-1433

    SPI mssp

    Thread Starter: picprotonguy

    Just ordered Digital to Analog IC MCP4822 with SPI interface and immediately opened proton manual. I'm very disappointed, it looks like Proton...

    barak Today, 16:06 Go to last post