RadioLocman.com Electronics ru
Advanced Search +
  
Go Back   RadioLocman Forum > Electronics and ... > Microcontrollers (MCU)

Microcontrollers (MCU) Application and programming of MCUs, Evaluation Kits and Demonstration Boards, Programmers.

Reply
 
Thread Tools Search this Thread
Old 11-07-2013, 02:12 PM   #1
symbol
Senior Member
 
Join Date: Oct 2013
Posts: 131
symbol is on a distinguished road
Default Implementation of the algorithm random on the AVR

Hello. To implement the algorithm of random assembler for selecting a random number
in the range 0-254. Here nashol code but it is not completely correct. Can someone decided similar problems?
Code:
procedure          _RandInt;
asm
{        ->EAX   Range   }
{        <-EAX   Result  }
                PUSH    EBX
{$IFDEF PIC}
                PUSH    EAX
                CALL    GetGOT
                MOV      EBX,EAX
                POP      EAX
                MOV      ECX,[EBX].OFFSET RandSeed
                IMUL    EDX,[ECX],08088405H
                INC      EDX
                MOV      [ECX],EDX
{$ELSE}
                XOR      EBX, EBX
                IMUL    EDX,[EBX].RandSeed,08088405H
                INC      EDX
                MOV      [EBX].RandSeed,EDX
{$ENDIF}
                MUL      EDX
                MOV      EAX,EDX
                POP      EBX
end;
symbol is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Atmega8 the digital filter Anatoly Microcontrollers (MCU) 1 11-12-2013 06:19 PM
Equalizer on the PIC18f452 Ishaq Musa Microcontrollers (MCU) 0 10-25-2013 09:27 PM
Discussion: A Universal RFID Key. Part 3 - The Software, Entering data into our card Radiolocman Robot Microcontrollers (MCU) 2 08-19-2013 07:45 PM
Discussion: The AVR based USB Touchscreen Mouse Radiolocman Robot Microcontrollers (MCU) 5 12-20-2012 09:34 PM
Discussion: The smallest handheld automatic one-chip AVR-based DC voltmeter Radiolocman Robot Microcontrollers (MCU) 3 10-23-2012 09:53 PM

All times are GMT. The time now is 02:24 AM.




Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
PCBA OEM and ODM Factory - MOKO Technology
10% Off for PCB and PCB Assembly Order
Slices ↓
Radiolocman facebook Radiolocman twitter