In which case you probably didn't save it as a plain text file?, which is another reason you added the .TXT to the end of it.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
I was assuming Windows XP. Maybe you're running Win98?wmmullaney said:futz, there is no "Folder Options" in my "Tools" menu, Nigel, I did not save it with that extension, it appeared everywhere to be BLINK.ASM
EDIT: Oh, I found it in the View menu.
Nice PIC16F84 Tutorial here.
https://www.hobbyprojects.com/pic_tut...tutorial1.html
LIST p=16F628 ;tell assembler what chip we are using
include "P16F628.inc" ;include the defaults for the chip
__config 0x3D18 ;sets the configuration settings
;(oscillator type etc.)
org 0x0000 ;org sets the origin, 0x0000 for the 16F628,
;this is where the program starts running
movlw 0x07
movwf CMCON
;*****Set up the Constants****
STATUS equ 03h ;Address of the STATUS register
TRISA equ 85h ;Address of the tristate register for port A
PORTA equ 05h ;Address of Port A
COUNT1 equ 08h ;First counter for our delay loops
COUNT2 equ 09h ;Second counter for our delay loops
;****Set up the port****
bsf STATUS,5 ;Switch to Bank 1
movlw 00h ;Set the Port A pins
movwf TRISA ;to output.
bcf STATUS,5 ;Switch back to Bank 0
;****Turn the LED on****
Start movlw 02h ;Turn the LED on by first putting
movwf PORTA ;it into the w register and then ;on the port
;****Start of the delay loop 1****
Loop1 decfsz COUNT1,1 ;Subtract 1 from 255
goto Loop1 ;If COUNT is zero, carry on.
decfsz COUNT2,1 ;Subtract 1 from 255
goto Loop1 ;Go back to the start of our loop. ;This delay counts down from ;255 to zero, 255 times
;****Delay finished, now turn the LED off****
movlw 00h ;Turn the LED off by first putting
movwf PORTA ;it into the w register and then on ;the port
;****Add another delay****
Loop2 decfsz COUNT1,1 ;This second loop keeps the
goto Loop2 ;LED turned off long enough for
decfsz COUNT2,1 ;us to see it turned off
goto Loop2 ;
;****Now go back to the start of the program
goto Start ;go back to Start and turn LED ;on again
;****End of the program****
end ;Needed by some compilers,
;and also just in case we miss ;the goto instruction.
LIST p=16F628 ; tell assembler what chip we are using
include "P16F628.inc" ; include the defaults for the chip
__config 0x3D18 ; internal OSC, WDT off
org 0x000 ; reset vector
movlw 0x07
movwf CMCON
;*****Set up the Variables ****
COUNT1 equ 20h ; First counter for our delay loops
COUNT2 equ 21h ; Second counter for our delay loops
;****Set up the port****
bsf STATUS,RP0 ;Bank 1
clrf TRISA ; PORTA all outputs.
bcf STATUS,RP0 ;Bank 0
;****Turn the LED on****
Start bsf PORTA.1 ; RA1 = 1 (LED on)
;****Start of the delay loop 1****
Loop1 decfsz COUNT1,f ; subtract 1 from 255
goto Loop1 ; count1 > zero, repeat
decfsz COUNT2,f ;Subtract 1 from 255
goto Loop1 ;Go back to the start of our loop.
;****Delay finished, now turn the LED off****
bcf PORTA.1 ; RA1 = 0 (LED off)
;****Add another delay****
Loop2 decfsz COUNT1,f ;This second loop keeps the
goto Loop2 ;LED turned off long enough for
decfsz COUNT2,f ;us to see it turned off
goto Loop2 ;
goto Start ;go back to Start and turn LED
end
I prefer tabs over spaces (faster editing cursor movement), but MPLAB seems hard coded to use 4 space tabs (at least I haven't found the settings for it yet). Since it uses 4 space tabs you have to use two almost everywhere.blueroomelectronics said:Ok I've yet to get rid of tabs in MPLAB, makes this look like a mess
list p=16F886
include <p16F886.inc>
__CONFIG _CONFIG1, _DEBUG_ON & _WDT_OFF & _LVP_OFF & _INTOSCIO
; errorlevel -302,-305
cblock 0x20
d1,d2,d3
endc
org 0
init
banksel OSCCON
movlw b'01110001'
movwf OSCCON
banksel ANSEL
clrf ANSEL
banksel TRISA
clrf TRISA
clrf TRISB
clrf TRISC
clrf PORTA
clrf PORTB
clrf PORTC
bcf STATUS, RP0
main bsf PORTA,5
call delay
bcf PORTA,5
call delay
goto main
delay movlw 0x07
movwf d1
movlw 0x2F
movwf d2
movlw 0x03
movwf d3
delay_0 decfsz d1, f
goto $+2
decfsz d2, f
goto $+2
decfsz d3, f
goto delay_0
return
end
If you have the line, 'include "P16F628a.inc"' at the top of your code you already have all the proper equates included. Navigate to 'Program Files/Microchip/MPASM Suite' and open P16F628a.inc and have a look. Get in the habit of using those equate symbols in your code instead of the hex addresses. Makes things so much more readable and easily understood.wmmullaney said:Doesn't the line "PORTA equ 05h" need to be added?
Try it and see.wmmullaney said:Thanks, it makes sense. Will my code work on 16f628a?