gnupic: real vs simulated for 16f88
Subject:
real vs simulated for 16f88
From:
"Maxim Wexler" ####@####.####
Date:
18 Dec 2006 19:36:05 +0000
Message-Id: <a0811460612181135j1badd295xe31842ed49d1f79a@mail.gmail.com>
Hello group,
This file compiles nicely and runs in gpsim and the hex file awaits
execution(I hope!) in the chip itself now that .pkprc has been sorted:
***************blink0.asm********************************
list p=16f88
include <p16F88.inc>
errorlevel -302 ;Suppress bank warning
;*****Set up the Constants****
OSCCON equ 0x8F
TRISA equ 0x85
COUNT1 equ 0x20 ;First counter for our delay loops
COUNT2 equ 0x21 ;Second counter for our delay loops
;****Set up the port****
movlw 0x7E ;Set internal oscillator to 8 MHz
movwf OSCCON
bsf STATUS, 5 ;Switch to Bank 1
movlw 0x00 ;Set the Port A pins
movwf TRISA ;to output.
bcf STATUS, 5 ;Switch back to Bank 0
;****Turn the LED on****
Start movlw 0xff ;Turn the LED on by first putting
movwf PORTA ;it into the w register and then
;on the port
;****Pause****
call Delay
;****Delay finished, now turn the LED off****
movlw 0x00 ;Turn the LED off by first putting
movwf PORTA ;it into the w register and then on
;the port
;****Pause****
call Delay
;****Now go back to the start of the program
goto Start ;go back to Start and turn LED
;on again
;****Delay Routine****
Delay ;This delay counts down from
;255 to zero, 255 times
movlw 0x10
movwf COUNT1
movlw 0x10
movwf COUNT2
Loop decfsz COUNT1, 1 ;Subtract 1 from 255
goto Loop ;If COUNT is zero, carry on.
decfsz COUNT2, 1 ;Subtract 1 from 255
goto Loop ;Go back to the start of our loop.
return
;****End of the program****
end ;Needed by some compilers,
;and also just in case we miss
;the goto instruction.
However in gpsim only RA0 to RA5 become active outputs. Why not RA6 and RA7?
Furthermore, RA5, according to the PDF, can never be an output and doubles
as MCLR.
Also another questions arises: How do I activate it safely if the code
expects to see an output where I plan to insert a reset button to start the
thing?
Maxim