I m a third year universtity studying biomed, eng.

Can anyone help me find an encoder for 7 segment (4bit) the seven segment must d isplay 0 if non of the 4 inputs is high display 1 if the first input is high display 2 if the first and second inputs are high display 3 if the first the sencond and the third inputs are high ... display 4 if all inputs are high .include "m8535def.inc" .org $000 RJMP inicio ... inicio: LDI R16, 0x5F OUT SPL, R16 LDI R16, 0x02 OUT SPH, R16; SP=0x025F CLR R16 OUT DDRA, R16; PA=input (ADC) LDI R16, 0xFF OUT DDRB, R16; PB=output (LEDs) ;////////////// configuración USART //////////////////// LDI R16, 0x0C OUT UBRRL, R16; BR=4800bps LDI R16, 0b00011000 OUT UCSRB, R16; TXEN=1, RXEN=1 LDI R16, 0b10000110 OUT UCSRC, R16; URSEL=1, modo asíncrono, no paridad, 1 stop bit, 8 data bits ; ///////////////////////// ADC ////////////////////// ; ADC 7 proceso: LDI R16, 0b01000111 OUT ADMUX, R16; REFS=AVCC, ajuste derecho, ADC_7 RCALL digitalizacion RCALL enviar ; limpiar OUT ADMUX, R16 RJMP proceso digitalizacion: LDI R16, 0xC3 OUT ADCSRA, R16; ADEN=1, start conversion, prescaler Fclk/8=(1x10e6)/8=125kHz IN R17, ADCH; ADCH---> R17 CLR R16 OUT ADCSRA, R16; limpiar ADCSRA RET enviar: OUT PORTB, R17 OUT UDR, R17 RCALL sdelay RET sdelay: RET

Sign up to vote on this title
UsefulNot useful