Hola Amigos!
Tengo un pequeños problema al Programar los Fuses con Studio4 de Atmel y el programdor STK500 ya que con el Pony programa me va pero con el STK500 no se como activar los Fuse, se que el pony al programar los Fuse lo tiene invertido y trato de hacerlo con el STK500 sin resultados, aqui os dejos el programa de ejemplo para recibir 2 canales DMX.
// Example of dmx_in usage
// 04.06.06
// (c)Hendrik Hölscher
.include "m8515def.inc"
#define SREGbuf R2
#define tempL R16
#define tempH R17
#define DMX_FIELD 0x60 //direcion base dmx array
#define DMX_CHANNELS 2 //numero de canales
#define DMXstate R18 //Registro de Estatuto para DMX-ISR (r16-r31)
#define F_OSC 8000 //frecuencia del oscilador en kHz (tipica 8MHz o 16MHz)
#define USE_DIP //should get start address from DIPs?
/* ****set interrupt-routines */
.org 0
rjmp reset /* reset vector address */
reti /* External Interrupt0 Vector Address */
reti /* External Interrupt1 Vector Address */
reti /* Input Capture1 Interrupt Vector Address */
reti /* Output Compare1A Interrupt Vector Address */
reti /* Output Compare1B Interrupt Vector Address */
reti /* Overflow1 Interrupt Vector Address */
reti /* Overflow0 Interrupt Vector Address */
reti /* SPI Interrupt Vector Address */
rjmp get_byte /* UART Receive Complete Interrupt Vector Address */
reti /* UART Data Register Empty Interrupt Vector Address */
reti /* UART Transmit Complete Interrupt Vector Address */
reti /* Analog Comparator Interrupt Vector Address */
reti /* External Interrupt2 Vector Address */
reti /* Output Compare0 Interrupt Vector Address */
reti /* EEPROM Interrupt Vector Address */
reti /* SPM complete Interrupt Vector Address */
reti /* SPM complete Interrupt Vector Address */
reset:
cli
/* ***** poner los punto stack */
ldi tempL, low(RAMEND)
ldi tempH, high(RAMEND)
out SPL,tempL
out SPH,tempH
/* **** puerto de led */
ser tempL
out DDRE, tempL
out PortE, tempL
/* **** inicial recibiendo DMX */
rcall init_dmx
sei ;permitir interrupciones
main:
rcall eval_dmx ;evaluar data dmx
rjmp main
eval_dmx:
lds tempL, DMX_FIELD ;conseguir primer canal (2do is DMX_FIELD +1)
cpi tempL, 127 ;is temp >127?
brsh led_on
sbi PortE, PE0 ;conmutar LED1 apagado
ret
led_on:
cbi PortE, PE0 ;conmutar LED1 encendido
ret
/* ***** include lib */
;**** A P P L I C A T I O N N O T E ************************************
;*
;* Title : DMX512 reception library
;* Version : v1.3
;* Last updated : 21.04.07
;* Target : Transceiver Rev.3.01 [ATmega8515]
;* Clock : 8MHz, 16MHz
;*
;* written by hendrik hoelscher
;***************************************************************************
; This program is free software; you can redistribute it and/or
; modify it under the terms of the GNU General Public License
; as published by the Free Software Foundation; either version2 of
; the License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
; General Public License for more details.
;
; If you have no copy of the GNU General Public License, write to the
; Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;
; For other license models, please contact the author.
;
;***************************************************************************
/************* Definitions in main source **********************
#define USE_DIP //usamos un DIP-Switch para direcional
#define DMX_FIELD 0x60 //direcion Base del DMX array
#define DMX_CHANNELS 8 //numero de canales
#define DMXstate R18 //estatos del registro para DMX-ISR (r16-r31)
//X-Pointer reserved for DMX ISR!!
#define F_OSC 8000 //frecuencia de Oscilacion en kHz (tipico 8MHz or 16MHz)
**************************************************************/
init_dmx:
;**** PortD
sbi DDRD, PD2
cbi PortD, PD2 ;activamos Recepcion
;**** USART
ldi tempL, ((F_OSC/4000)-1) ;activamos la Usart a 250 kbaud
out UBRRL, tempL
clr tempL
out UBRRH, tempL
ldi tempL, (1<<URSEL)|(3<<UCSZ0)|(1<<USBS)
out UCSRC, tempL
in tempL,UDR
clr tempL
out UCSRA,tempL
sbi UCSRB,RXCIE
sbi UCSRB,RXEN
#ifdef USE_DIP
;**** PortC
clr tempL
out DDRC, tempL
ser tempL
out PortC, tempL ;entrada con PullUp para Dip_Switch
;**** PortE
in tempL, DDRE
cbr tempL, (1<<1)|(1<<2)
out DDRE, tempL
in tempL, PortE
sbr tempL, (1<<1)|(1<<2)
out PortE, tempL ;PE2 & OPCION Pullup
#endif
;**** memory
ldi XH, high(DMX_FIELD)
ldi XL, low(DMX_FIELD)
clr tempL ;ponemos todos los canales a cero
ldi DMXstate, DMX_CHANNELS
write_RxD:
st X+,tempL
dec DMXstate
brne write_RxD
// clr DMXstate ;ponemos DMX estatuto para esperar por Reset
ret
/* ***********************************************************************************************************
* DMX recepcion ISR
************************************************************************************************************/
get_byte:
in SREGbuf, SREG
push tempH
push tempL
in tempL,UCSRA ;conseguimos el estatuto ante de Registrar Data
in tempH,UDR
sbrc tempL,FE ;checkeamos error de frame para ir a Reset
rjmp dmx_frame_error
cpi DMXstate, 1 ;checkeamos for iniciar byte (debe ser 0)
breq dmx_startbyte
cpi DMXstate, 2 ;checkeamos para iniciar direcion
breq dmx_startadr
cpi DMXstate, 3
brsh dmx_handle_byte
dmx_finish:
pop tempL
pop tempH
out SREG, SREGbuf
reti
dmx_startbyte:
tst tempH ;si es Cero-> iniciamos byte
brne dmx_err
inc DMXstate ;sigueinte -> inicio de direcion
#ifdef USE_DIP
in XL, PinC ;conseguimos iniciar direcion
com XL
clr XH
sbis PinE, PE2 ;el Noveno bit
inc XH
#else
rcall get_address
#endif
rjmp dmx_finish
dmx_startadr:
sbiw XH:XL, 1
brne dmx_finish
ldi XH, high(DMX_FIELD)
ldi XL, low(DMX_FIELD)
inc DMXstate ;siguiente-> tratar data
dmx_handle_byte:
st X+, tempH
cpi XL, low(DMX_FIELD +DMX_CHANNELS)
brne dmx_finish
cpi XH, high(DMX_FIELD +DMX_CHANNELS)
brne dmx_finish
clr DMXstate
rjmp dmx_finish
dmx_frame_error:
ldi DMXstate, 1 ;FE detectamos un break
cbi UCSRA,FE ;further framing errors, caused by longer breaks
rjmp dmx_finish
dmx_err:
clr DMXstate ;esperamos por error deframe
rjmp dmx_finish
claro esta que el Oscilador lo uso Externo de 8Mhz y ahi tengo el lio ya que el Studio4 trae un monton de configuracion de Fuses, por eso opino que Atmel me Decepciona muchos

por mas que leo no encuentro el Rollo como configurarlo.