Ciao,
sotto il codice in assembler per accendere un led, ma non mi chiedere spiegazioni, perchè programmo solo in Picbasic pro.
;************************************************* ***********************
; *
; Filename: BA_L1-Turn_on_LED.asm *
; Date: 7/9/07 *
; File Version: 1.0 *
; *
; Author: David Meiklejohn *
; Company: Gooligum Electronics *
; *
;************************************************* ***********************
; *
; Architecture: Baseline PIC *
; Processor: 12C508/509 *
; *
;************************************************* ***********************
; *
; Files required: none *
; *
;************************************************* ***********************
; *
; Description: Lesson 1, exercise 1 *
; *
; Turns on LED. LED remains on until power is removed. *
; *
;************************************************* ***********************
; *
; Pin assignments: *
; GP1 - indicator LED *
; *
;************************************************* ***********************
list p=12C509
#include <p12C509.inc>
; ext reset, no code protect, no watchdog, 4Mhz int clock
__CONFIG _MCLRE_ON & _CP_OFF & _WDT_OFF & _IntRC_OSC
;************************************************* *********************
RESET CODE 0x3FF ; processor reset vector
res 1 ; holds movlw with factory RC cal value
MAIN CODE 0x000 ; effective reset vector
movwf OSCCAL ; update OSCCAL with factory cal value
;***** Initialisation
start
movlw b'111101' ; configure GP1 (only) as an output
tris GPIO
movlw b'000010' ; set GP1 high
movwf GPIO
goto $ ; loop forever
END
Saluti