Here is the place for ASM and C.
http://www.piclist.com/techref/piclist/index.htm
Start with the "Beginners Checklist" link.
Your project would be fun to have around here but cost is cost.
In ASM for Micros symols are not used.
Here is an example to blink one LED with PBP
Code:
DEFINE OSC 20
@ __config _HS_OSC & _WDT_ON & _LVP_OFF & _CP_OFF
START:
HIGH PORTD.1
PAUSE 250
LOW PORTD.1
PAUSE 250
GOTO START
Here is an example to blink one LED in ASM.
Code:
; processor 16f876a
#include <p16f876a.inc>
ERRORLEVEL -224
; Configuration bits
__CONFIG _HS_OSC & _WDT_OFF & _PWRTE_ON & _BODEN_OFF & _LVP_OFF & _CPD_OFF & _WRT_OFF & _DEBUG_OFF & _CP_OFF
CBLOCK 0x20 ; RAM starts at address 20h
d1
d2
ENDC
org 0x0000 ; start address = 0000h
movlw B'00000000'
tris PORTA
movlw B'00000000'
tris PORTB
movlw B'00000000'
tris PORTC
movlw B'00000111'
movwf CMCON
movwf ADCON1
clrf PORTA
clrf PORTB
clrf PORTC
movlw B'00000111'
option
loop:
bsf PORTC,3
call Delay
bcf PORTC,3
call Delay
goto loop
; Delay = 0.1 seconds
; Clock frequency = 4 MHz
; Actual delay = 0.1 seconds = 100000 cycles
; Error = 0 %
Delay ;99993 cycles
movlw 0x1E
movwf d1
movlw 0x4F
movwf d2
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto Delay_0 ;3 cycles
goto $+1
nop ;4 cycles (including call)
return
end
Bookmarks