A couple of very good tutorials have been mentioned already. I am relatively new at Assembly too. When I just began, however, I found some of the tutorials a bit overwhelming. For example, one introduced the symbol "$-1" without explaining it. That was a tough search on my PC. Googligum does similar things. Least I be misunderstood, at this point in my education, Googligum is still my favorite. But why, in its discussion of tables (See: Midrange Assembler, Lesson 12, page 6), does the author suddenly introduce "retlw 0" to a table that never before had one? "retlw" should be self explanatory in a table.
When I just began flashing led's, I found the following very helpful and could recommend either one:
**broken link removed**
Elmer 160 -* Course Lessons
My advice is to pick just one tutorial ( I happen to like Elmer) until you get that first LED flashing. Then fill out your knowledge with the others.
John
So many choices for you... are you doing it purely as a hobby or looking to make future use of it in college or professionally ?
Code ASM - [expand] 1 2 3 4 5 6 7 8 9 10 ;Tutorial 1.1 - Nigel Goodwin 2002 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 ;turn comparators off (make it like a 16F84)
;==========================================================================
;
; Configuration Bits
;
; NAME Address
; CONFIG 2007h
;
;==========================================================================
; The following is an assignment of address values for all of the
; configuration registers for the purpose of table reads
_CONFIG EQU H'2007'
;----- CONFIG Options --------------------------------------------------
_LP_OSC EQU H'3FF8' ; LP oscillator: Low-power crystal on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN
_XT_OSC EQU H'3FF9' ; XT oscillator: Crystal/resonator on RA4/OSC2/CLKOUT and RA5/OSC1/CLKINT
_HS_OSC EQU H'3FFA' ; HS oscillator: High-speed crystal/resonator on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN
_EC_OSC EQU H'3FFB' ; EC: I/O function on RA4/OSC2/CLKOUT pin, CLKIN on RA5/OSC1/CLKIN
_INTOSCIO EQU H'3FFC' ; INTOSCIO oscillator: I/O function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN
_INTRC_OSC_NOCLKOUT EQU H'3FFC' ; INTOSCIO oscillator: I/O function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN
_INTOSC EQU H'3FFD' ; INTOSC oscillator: CLKOUT function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN
_INTRC_OSC_CLKOUT EQU H'3FFD' ; INTOSC oscillator: CLKOUT function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN
_EXTRCIO EQU H'3FFE' ; EXTRCIO oscillator: External RC on RA5/OSC1/CLKIN, I/O function on RA4/OSC2/CLKOUT pin
_EXTRC_OSC_NOCLKOUT EQU H'3FFE' ; EXTRCIO oscillator: External RC on RA5/OSC1/CLKIN, I/O function on RA4/OSC2/CLKOUT pin
_EXTRC EQU H'3FFF' ; EXTRC oscillator: External RC on RA5/OSC1/CLKIN, CLKOUT function on RA4/OSC2/CLKOUT pin
_EXTRC_OSC_CLKOUT EQU H'3FFF' ; EXTRC oscillator: External RC on RA5/OSC1/CLKIN, CLKOUT function on RA4/OSC2/CLKOUT pin
_WDT_OFF EQU H'3FF7' ; WDT disabled
_WDT_ON EQU H'3FFF' ; WDT enabled
_PWRTE_ON EQU H'3FEF' ; PWRT enabled
_PWRTE_OFF EQU H'3FFF' ; PWRT disabled
_MCLRE_OFF EQU H'3FDF' ; MCLR pin function is digital input, MCLR internally tied to VDD
_MCLRE_ON EQU H'3FFF' ; MCLR pin function is MCLR
_CP_ON EQU H'3FBF' ; Program memory code protection is enabled
_CP_OFF EQU H'3FFF' ; Program memory code protection is disabled
_CPD_ON EQU H'3F7F' ; Data memory code protection is enabled
_CPD_OFF EQU H'3FFF' ; Data memory code protection is disabled
_BOD_OFF EQU H'3CFF' ; BOR disabled
_BOR_OFF EQU H'3CFF' ; BOR disabled
_BOD_SBODEN EQU H'3DFF' ; BOR controlled by SBOREN bit of the PCON register
_BOR_SBODEN EQU H'3DFF' ; BOR controlled by SBOREN bit of the PCON register
_BOD_NSLEEP EQU H'3EFF' ; BOR enabled during operation and disabled in Sleep
_BOR_NSLEEP EQU H'3EFF' ; BOR enabled during operation and disabled in Sleep
_BOD_ON EQU H'3FFF' ; BOR enabled
_BOR_ON EQU H'3FFF' ; BOR enabled
_IESO_OFF EQU H'3BFF' ; Internal External Switchover mode is disabled
_IESO_ON EQU H'3FFF' ; Internal External Switchover mode is enabled
_FCMEN_OFF EQU H'37FF' ; Fail-Safe Clock Monitor is disabled
_FCMEN_ON EQU H'3FFF' ; Fail-Safe Clock Monitor is enabled
; Set configuration bits using definitions from the include file, p16f688.inc
__config _HS_OSC & _WDT_OFF & _PWRTE_OFF & _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOR_OFF & _FCMEN_OFF
I want to use my 688 chip and not the 628 chip so I'd like to know how to set the config and can't really figure that out from any tutorials thus far.
I also would like a better explanation of the comparators being turned off by taking the work register which has 7 in it and putting it into the CMCON register.
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?