пока ты не включешь программно альтернативные функции ноги, они работать не будут.
или ты нам не весь код предоставил?
You can use a different SEED value by dimensioning and assigning ___RSEED yourself:
Dim ___rseed as word : ___rseed = 10234
Dim I as word : I = rnd(10)
When your application uses a timer you can assign ___RSEED with the timer value. This will give a better random number.
galex1981 писал(а):В общем задаешь ___rseed или через таймер или по показаниям датчиков
'фусибиты
$prog &HFF , &HE4 , &HD9 , &H00
'камень
$regfile = "m32DEF.dat"
$crystal = 7372800
$baud = 115200
Config Serialin = Buffered , Size = 20
$hwstack = 64
$swstack = 64
$framesize = 64
Dim Tick As Word
Dim I As Byte
Dim T As Word
Dim Cnt As Byte
Declare Sub Swait(byval Secs As Word)
On Ovf0 Timr0
Config Timer0 = Timer , Prescale = 1024
Enable Interrupts
Enable Timer0
' Ниже следует отладочное сообщение в RS-232 порт
Ucsrb.rxen = 0
Print "start tmr"
Ucsrb.rxen = 1
Start Timer0
Cnt = 0
Call Swait(180) ' wait 3 munutes
Ucsrb.rxen = 0
Print "Ok"
Ucsrb.rxen = 1
Do
Loop
Timr0:
' timer 0 overflow occurred
Incr Cnt
If Cnt = 32 Then
Incr Tick
Cnt = 0
End If
Return
Sub Swait(secs As Word)
' do an stand-by wait for the specified number of seconds
Tick = 0
While Secs >= Tick
Gosub Sbymode
Wend
End Sub
Sbymode:
' put the processor into an stand-by mode sleep state for approximately
' one milli second based on 1 MHz clock and 1024 timer 0 prescale
$asm
push r18 ' save current r18
push r19 ' save current r19
in r19,SREG ' get current status reg
in r18,MCUCR ' get current MCU cntl reg
' ori r18,$E0 ' set stand by mode (SE + SM2 + SM1) Мега 88
ori r18,$0B ' set stand by mode (SE + SM2 + SM1) Мега 32
!out MCUCR,r18 ' set MCU cntl reg
sleep ' put MCU into idle mode sleep
'--------waiting to return after timer0 overflow and MCU awake
!out SREG,r19 ' restore status reg
pop r19 ' restore old r19
pop r18 ' restore old r18
$end Asm
Return
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 28