I use Proteus it also cost my bollocks..Any suggestions for other Sims that don't cost both arms and legs that may be quicker.
You can set that value to zero as well....If you are using Oshonsoft you can ditch delays... It runs "kinda" alright if you set
define SIMULATION_WAITMS_VALUE = 1
It will shoot though all delay calls..
If you're trying to test those timing subsystems, the Simulator and Stopwatch in the old MPLAB v8.92 work well for 'cycle counting' on older chips like the 16F628A.Any suggestions for other Sims that don't cost both arms and legs that may be quicker.
I ran the the 1 second delay in Oshonsoft PIC18F simulator, Basic window open and it took about 29 seconds. I think in the PIC16F simulator it would be about the same.As referenced in another post, I use the Oshonsoft sim for doing various bits & pieces of simulation, but sitting there for 30-40 minutes waiting for it to do a simulation of something like a 1 Second delay gets very tiring(I'm running an i5 quad core 2.6GHz PC with Win 10 Pro).
Any suggestions for other Sims that don't cost both arms and legs that may be quicker.
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include <P16F628A.inc>
errorlevel -302 ; suppress bank warnings
list st=off ; suppress symbol table
radix dec ; default radix = decimal
__CONFIG _LVP_OFF & _WDT_OFF & _INTOSC_OSC_NOCLKOUT & _MCLRE_OFF
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; variables ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cblock 0x70 ; common RAM
delayhi ; DelayCy() subsystem variable
endc
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; K8LH DelayCy() subsystem macro generates four instructions ~
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
radix dec
clock equ 20 ; 4, 8, 12, 16, 20 (MHz), etc.
usecs equ clock/4 ; cycles/microsecond multiplier
msecs equ usecs*1000 ; cycles/millisecond multiplier
dloop equ 80 ; loop size (minimum 5)
;
; -- loop -- -- delay range -- -- memory overhead ----------
; 5-cyc loop, 11..327690 cycles, 9 words (+4 each macro call)
; 6-cyc loop, 11..393226 cycles, 10 words (+4 each macro call)
; 7-cyc loop, 11..458762 cycles, 11 words (+4 each macro call)
; 8-cyc loop, 11..524298 cycles, 12 words (+4 each macro call)
;
DelayCy macro cycles ; range, see above
if (cycles<11)|(cycles>(dloop*65536+10))
error " DelayCy range error "
else
movlw high((cycles-11)/dloop)+1
movwf delayhi
movlw low ((cycles-11)/dloop)
; rcall uLoop-(((cycles-11)%dloop)*2) ; (18F version)
call uLoop-((cycles-11)%dloop) ; (16F version)
endif
endm
;******************************************************************
; reset vector *
;******************************************************************
org 0x000
;
swold equ 0x20
count equ 0x21
duration equ 0x22
movlw 7 ; |B0
movwf CMCON ; camparator module off |B0
bsf STATUS,RP0 ; bank 01 |B1
movlw b'00111110' ; make RA0 and output |B1
movwf TRISA ; " |B1
bcf STATUS,RP0 ; bank 00 |B0
movlw 20 ; value for 100-msecs |B0
movwf duration ; " |B0
movwf count ; " |B0
bsf PORTA,RA0 ; |B0 <-- set PC here and
; zero stopwatch
; wreg ____---____-----_____ inverted active lo sample
; swold _____---____-----____ switch state latch
; wreg ____-__-___-____-____ changes, press or release
; wreg ____-______-_________ filter out 'release' bits
;
durtmr
comf PORTA,W ; sample active lo switches |B0
andlw 1<<RA3 ; on RA3 pin only |B0
xorwf swold,W ; changes, press or release |B0
xorwf swold,F ; update switch state latch |B0
andwf swold,W ; filter out 'release' bits |B0
skpz ; new press? no, skip, else |B0
goto nextfx ; branch (exit timer loop) |B0
d1 DelayCy(50*msecs-11) ; 50-ms minus 11 cycle loop time |B0
movlw 1<<RA0 ; RA0 output 'toggle' mask |B0
decfsz count,F ; done? yes, skip, else |B0
goto durtmr ; loop (another 50 msecs) |B0
toggle
xorwf PORTA,F ; toggle RA0 output |B0 <-- breakpoint
movlw 20^180 ; toggle 1-sec & 9-sec timing |B0
xorwf duration,W ; " |B0
movwf duration ; " |B0
movwf count ; setup new timer loop count |B0
nop ; |B0
goto d1 ; |B0
nextfx
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; K8LH DelayCy() subsystem 16-bit uLoop subroutine ~
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a = dloop-1
while a > 0
nop ; (cycles-11)%dloop entry points |
a -= 1
endw
uLoop addlw -1 ; subtract 'dloop' loop time |
skpc ; borrow? no, skip, else |
decfsz delayhi,F ; done? yes, skip, else |
; bra uLoop-dloop*2+10 ; do another loop (18F version) |
goto uLoop-dloop+5 ; do another loop (16F version) |
return ; |
end
; *******************************************************************************
;
radix dec
errorlevel -302 ; Skip 'out of bank' nuisance messages
include <P16F628A.INC>
__config _CP_OFF&_LVP_OFF&_BODEN_ON&_MCLRE_OFF&_PWRTE_ON&_WDT_OFF&_HS_OSC
;
; *******************************************************************************
; * Allocate variables in general purpose register space *
; *******************************************************************************
;
CBLOCK 0x20 ; Start Data Block
pulsetime
CounterA ; for time delay
CounterB ; "
CounterC ; "
ENDC ; End of Data Block
;
; *******************************************************************************
; * The 16F628 resets to 0x00. *
; * The Interrupt vector is at 0x04. *
; *******************************************************************************
;
ORG 0x00
goto start ;
;
ORG 0x04
goto start ;
;
start
clrf PORTA ; Clear PORTA
clrf PORTB ; start with LED off
clrf pulsetime
movlw 0x07 ; Code to turn off the analog comparators
movwf CMCON ;
BANKSEL TRISA ;
movlw B'00001000' ; PORTA,3 input rest all outputs
movwf TRISA ;
clrf TRISB ; PORTB to all outputs
BANKSEL PORTA ;
incrat
;--------------------------------------------------------------------------------
p6 ;*** Overall 1SEC pulse 100mS mark 900mS space ***DONE***
movlw b'00100000'
movwf PORTB
p6a
bsf PORTA,0
;PIC Time Delay = 0.09999980 s with Osc = 20000000 Hz
movlw D'3'
movwf CounterC
movlw D'138'
movwf CounterB
movlw D'84'
movwf CounterA
loop6
decfsz CounterA,1
goto loop6
decfsz CounterB,1
goto loop6
decfsz CounterC,1
goto loop6
NOP
NOP
btfss PORTA,3 ; is switch pressed?
goto incrat
bcf PORTA,0
;PIC Time Delay = 899999.80uS with Osc = 20MHz
movlw D'14'
movwf CounterC
movlw D'183'
movwf CounterB
movlw D'27'
movwf CounterA
loop6a
btfss PORTA,3 ; is switch pressed?
goto incrat
decfsz CounterA,1
goto loop6a
decfsz CounterB,1
goto loop6a
decfsz CounterC,1
goto loop6a
NOP
NOP
NOP
NOP
NOP
NOP
NOP
goto p6a
Are you running just the original Oshonsoft Sim software or the Oshonsoft Basic Compiler with sim?I ran the the 1 second delay in Oshonsoft PIC18F simulator, Basic window open and it took about 29 seconds.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?