Top Banner

of 37

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript

code, circuits, & construction code and fabrication resources for physical computing and networking

Skip to content Home About this site Code Variables Circuits Understanding Electricity Breadboards Motors Controlling DC Motors Stepper Motors Controllers All About Microcontrollers Input & Output Digital Input & Output Analog Input Analog Output Controlling high-current circuits Communication Serial Communication Interpreting Serial Data MIDI Construction Controlling Inkjet Printers from a microcontrollerA Tale of Two Pongs 88 LED matrix control on an Arduino MegaPosted on 31 March 2009 by tigoe Once youve mastered microcontroller programming, you might be tempted to control a lot of LEDs. Lots of people have this desire once they master the basics. Many microcontrollers have a limited number of output pins, however, so you might think that limits how many LEDs you can control. Ive written about a few different methods around this before, in chapter 14 of Physical Computing, and in this tutorial on this the ITP physical computing site.By matrixing your LEDs, you can control many more than the number of pins you have. For example, with the Arduino Duemilanove and earlier models, you had up to 20 digital outputs (13 labeled digital I/O 0 through 13, plus the six analog outputs, which double as digital I/O 14 through 19). With 16 of those, you can control an 88 matrix of LEDs. Thats 64 LEDs. With the Arduino Mega, you have 54 digital I/O pins, so you can control a lot more. This example uses 32 of them to control 2 88 matrices, for a total of 128 LEDs from one controller.To make this example, youll need: Arduino Mega Breadboard or prototyping shield. Im using Smart Projects proto shields, which were designed at the same time as the Mega itself. I love them. 88 LED matrix. I got mine in a surplus shop in China, but you can also get them from most electronics retailers male pin headers female pin headers WiresStep 1: Figure out the LED Matrix pinsThe hardest part of this project was figuring out the arrangement of the LED matrix pins. I didnt have a datasheet for the matrix, only the code on the side of the part, HS-788AS. The only useful Google results I got on it were in Chinese, making them less useful to me personally. So I resorted to the old-fashioned method: I opened a notebook, put my multimeter on the diode check setting, and started touching pins.I knew that the 16 pins of the matrix represented rows and columns, and that there are some pretty standard arrangements of pins, like this one I got from a different LED matrix:

Figure 1. A typical LED matrix schematic. Click on any image to see the large version.My matrix didnt match this pin configuration. But once I got one LED lit up, I knew that my positive meter lead was on a row, and my negative was on a column. Keeping the positive lead in place, I moved the negative lead in order to find the other columns. I found them in fairly quick order from there. Theyre arranged like this:

Figure 2. The pin configurations for my LED matrices (HS-788AS)Caveat: your LED matrix will probably have a different pin arrangement, so read the data sheet, or use the method described above to find them for yourself.Once I knew the pin configuration of the matrix, I connected its pins to the Mega. I had two matrices in hand, and each takes 16 pins, so I figured Id use them both.Step 2: Connect LED to MegaTo control a matrix, you connect both its rows and columns to your microcontroller. The columns are connected to the LEDs anodes (see Figure 1), so a column needs to be high for any of the LEDs in that column to turn on. The rows are connected to the LEDs cathodes, so the row needs to be low for an individual LED to turn on. If the row and the column are both high or both low, no voltage flows through the LED and it doesnt turn on.To control an individual LED, you set its column high and its row low. To control multiple LEDs in a row, you set the rows high, then take the column high, then set the lows row or high as appropriate; a low row will turn the corresponding LED on, and a high row will turn it off.It doesnt matter which pins of the microcontroller you connect the rows and columns to, because you can assign things in software. So I connected the pins in a way that made wiring easiest. The bare prototyping boad looks like this:

Figure 3. Mega prototyping shieldI added two rows of female headers to mount the matrices on, along with male headers to tie the pins on the low-numbered digital I/O pins (pins 2 through 13) to the matrices, since these pins have connections to other holes right next to them on the board. For the higher numbered I/O pins (pins 22 and above) I used female headers with long pins. Those pins have no other connections to the board, so I needed the female connections to add wires, and the long male pins to connect to the board below. This is what my board looked like after soldering:

Figure 4. The proto shield after soldering headers and wires on.Finally, I added the LED matrices, both facing the same way:

Figure 5. The finished board, with LED matrices. Note the label on both, facing the same way.Step 3: ProgramIn order to control the rows and columns easily, I set up an array of rows and an array of columns for each matrix. Each array contains the pin number for the rows or columns of that matrix, in order:/*Super Duper Knight Rider for Arduino Mega This example controls two 8x8 LED matrices, lighting one LED at a time, then bouncing back to the beginning. created 29 Mar 2009 by Tom Igoe The matrices used are labeled HS-788AS. They were bought surplus. They are laid out as follows (warning: yours might have different pin configurations): rows are the anodes cols are the cathodes label HS-788AS is on the left side of the chip _________ col 4 ----| |---- row 1 col 2 ----| |---- row 2 row 7 ----| |---- col 7 row 6 ----| |---- row 8 col 1 ----| |---- col 5 row 4 ----| |---- row 3 col 3 ----| |---- row 5 col 6 ----| |---- col 8 --------- Pin numbers: Matrix 1: 2,3,4,5,6,7,8,9,12,11,12,13, 34, 35, 36, 37 Matrix 2: 22,23,24,25,26,27,28,29,30,31,38,39,41,43,45,47,49,51,53 */int row[] = { 22,23,27,49,28,45,43,25};

int col[] = { 47,41,51,39,26,53,24,29};

int row2[] = { 9,8,4,35,3,10,11,6};

int col2[] = { 34,12,36,13,5,37,7,2};

void setup() { for (int thisPin = 0; thisPin < 8; thisPin++) { // initialize the output pins for matrix 1: pinMode(col[thisPin], OUTPUT); pinMode(row[thisPin], OUTPUT); // take the col pins (i.e. the cathodes) high to ensure that // the LEDS are off: digitalWrite(col[thisPin], HIGH);

// initialize the output pins for matrix 2: pinMode(col2[thisPin], OUTPUT); pinMode(row2[thisPin], OUTPUT);

// take the col pins (i.e. the cathodes) high to ensure that // the LEDS are off: digitalWrite(col2[thisPin], HIGH); }}

void loop() { // light up the first matrix: // iterate over the rows (anodes): for (int thisrow = 0; thisrow < 8; thisrow++) { // take the row pin (anode) high: digitalWrite(row[thisrow], HIGH); // iterate over the cols (cathodes): for (int thiscol = 0; thiscol < 8; thiscol++) { // when the row is high and the col is low, // the LED where they meet turns on: digitalWrite(col[thiscol], LOW); delay(50); // take the col pin (cathode) high to turn the LED off: digitalWrite(col[thiscol], HIGH); } // take the row pin low to turn off the whole row: digitalWrite(row[thisrow], LOW); }

// light up the second matrix:

// iterate over the rows (anodes): for (int thisrow = 0; thisrow < 8; thisrow++) { // take the row pin (anode) high: digitalWrite(row2[thisrow], HIGH); // iterate over the cols (cathodes): for (int thiscol = 0; thiscol < 8; thiscol++) { // when the row is high and the col is low, // the LED where they meet turns on: digitalWrite(col2[thiscol], LOW); delay(50); // take the col pin (cathode) high to turn the LED off: digitalWrite(col2[thiscol], HIGH); } // take the row pin low to turn off the whole row: digitalWrite(row2[thisrow], LOW); }

// do the same to go backwards, counting backwards:

// second matrix in reverse: for (int thisrow = 7; thisrow > 0; thisrow--) { digitalWrite(row2[thisrow], HIGH); for (int thiscol = 7; thiscol >0; thiscol--) { digitalWrite(col2[thiscol], LOW); delay(50); digitalWrite(col2[thiscol], HIGH); } digitalWrite(row2[thisrow], LOW); } // first matrix in reverse: for (int thisrow = 7; thisrow > 0; thisrow--) { digitalWrite(row[thisrow], HIGH); for (int thiscol = 7; thiscol >0; thiscol--) { digitalWrite(col[thiscol], LOW); delay(50); digitalWrite(col[thiscol], HIGH); } digitalWrite(row[thisrow], LOW); }}

The first program I wrote was very simple; it just turned on all the LEDs, like so:void setup() { for (int thisPin = 0; thisPin < 8; thisPin++) { // initialize the output pins for matrix 1: pinMode(row[thisPin], OUTPUT); pinMode(col[thisPin], OUTPUT);

// initialize the output pins for matrix 2: pinMode(row2[thisPin], OUTPUT); pinMode(col2[thisPin], OUTPUT); }}

void loop() { for (int thisPin = 0; thisPin < 8; thisPin++) { // turn on matrix 1: digitalWrite(row[thisPin], HIGH); digitalWrite(col[thisPin], LOW); // turn on matrix 2: digitalWrite(row2[thisPin], HIGH); digitalWrite(col2[thisPin], LOW); }}The second program is a bit more complex. It uses two nested for loops, one to scan over the columns and one to scan the rows for each column. It turns on each LED, pauses, then turns it off:/*Super Duper Knight Rider for Arduino Mega This example controls two 8x8 LED matrices, lighting one LED at a time, then bouncing back to the beginning. created 29 Mar 2009 by Tom Igoe The matrices used are labeled HS-788AS. They were bought surplus. They are laid out as follows (warning: yours might have different pin configurations): rows are the anodes cols are the cathodes label HS-788AS is on the left side of the chip _________ col 4 ----| |---- row 1 col 2 ----| |---- row 2 row 7 ----| |---- col 7 row 6 ----| |---- row 8 col 1 ----| |---- col 5 row 4 ----| |---- row 3 col 3 ----| |---- row 5 col 6 ----| |---- col 8 --------- Pin numbers: Matrix 1: 2,3,4,5,6,7,8,9,12,11,12,13, 34, 35, 36, 37 Matrix 2: 22,23,24,25,26,27,28,29,30,31,38,39,41,43,45,47,49,51,53 */int row[] = { 22,23,27,49,28,45,43,25};

int col[] = { 47,41,51,39,26,53,24,29};

int row2[] = { 9,8,4,35,3,10,11,6};

int col2[] = { 34,12,36,13,5,37,7,2};

void setup() { for (int thisPin = 0; thisPin < 8; thisPin++) { // initialize the output pins for matrix 1: pinMode(col[thisPin], OUTPUT); pinMode(row[thisPin], OUTPUT); // take the col pins (i.e. the cathodes) high to ensure that // the LEDS are off: digitalWrite(col[thisPin], HIGH);

// initialize the output pins for matrix 2: pinMode(col2[thisPin], OUTPUT); pinMode(row2[thisPin], OUTPUT);

// take the col pins (i.e. the cathodes) high to ensure that // the LEDS are off: digitalWrite(col2[thisPin], HIGH); }}

void loop() { // light up the first matrix: // iterate over the rows (anodes): for (int thisrow = 0; thisrow < 8; thisrow++) { // take the row pin (anode) high: digitalWrite(row[thisrow], HIGH); // iterate over the cols (cathodes): for (int thiscol = 0; thiscol < 8; thiscol++) { // when the row is high and the col is low, // the LED where they meet turns on: digitalWrite(col[thiscol], LOW); delay(50); // take the col pin (cathode) high to turn the LED off: digitalWrite(col[thiscol], HIGH); } // take the row pin low to turn off the whole row: digitalWrite(row[thisrow], LOW); }

// light up the second matrix:

// iterate over the rows (anodes): for (int thisrow = 0; thisrow < 8; thisrow++) { // take the row pin (anode) high: digitalWrite(row2[thisrow], HIGH); // iterate over the cols (cathodes): for (int thiscol = 0; thiscol < 8; thiscol++) { // when the row is high and the col is low, // the LED where they meet turns on: digitalWrite(col2[thiscol], LOW); delay(50); // take the col pin (cathode) high to turn the LED off: digitalWrite(col2[thiscol], HIGH); } // take the row pin low to turn off the whole row: digitalWrite(row2[thisrow], LOW); }

// do the same to go backwards, counting backwards:

// second matrix in reverse: for (int thisrow = 7; thisrow > 0; thisrow--) { digitalWrite(row2[thisrow], HIGH); for (int thiscol = 7; thiscol >0; thiscol--) { digitalWrite(col2[thiscol], LOW); delay(50); digitalWrite(col2[thiscol], HIGH); } digitalWrite(row2[thisrow], LOW); } // first matrix in reverse: for (int thisrow = 7; thisrow > 0; thisrow--) { digitalWrite(row[thisrow], HIGH); for (int thiscol = 7; thiscol >0; thiscol--) { digitalWrite(col[thiscol], LOW); delay(50); digitalWrite(col[thiscol], HIGH); } digitalWrite(row[thisrow], LOW); }}

Thats the basic idea, and now youve got Knight Rider for 128 LEDs with no extra parts! Enjoy. Heres the whole sketch.Once you have that working, try attaching potentiometers to analog inputs 0 and 1 and run this sketch.Thanks to the good folks at Eyebeam for giving me a comfy place to work while I am on sabbatical!This entry was posted in arduino/wiring, AVR, circuits and tagged arduino mega, LED matrix. Bookmark the permalink. Controlling Inkjet Printers from a microcontrollerA Tale of Two Pongs 6 Responses to 88 LED matrix control on an Arduino Mega1. Pingback: Arduino Blog Blog Archive2. Pingback: Daily Research Shared Items - April 1, 20093. Pingback: Mega Knight Rider Example | SquareCows4. Pingback: Controlling two 88 LEDs matrix with Arduino Mega at ArduinoShow.com5. Pingback: Arduino Mega example | www.gisvold.co.uk6. Pingback: Th!nk Again Knight Rider effect based on Arduino Categories arduino/wiring AVR BX-24 circuits code construction electronics Flash/ActionScript iPhone java Lantronix Lingo Max/MSP misc OSX pBasic (Basic stamp) Perl PHP PIC PicBasic Pro Processing XBee Principio del formularioSearch for: Final del formulario Meta Log in Entries RSS Comments RSS WordPress.orgcode, circuits, & construction Proudly powered by WordPress.

Cartel de Leds en ASMPosted on 14 Septiembre, 2010 by Suky Aqu voy a mostrar una forma sencilla de hacer un cartel de leds en asm que tendr algunas limitaciones, pero entendiendo como es el funcionamiento y el esfuerzo de ustedes podrn romper esas barreras! Para mostrar un ejemplo sencillo vamos a usar una tabla para guardar el mensaje a mostrar y una sola variable (8 bits) para indicar el largo y control de la posicin a enviar. Por ello el largo del mensaje estar restringido a 255 bytes que se reducen en 6 por la posicin de la tabla en la memoria de programa.-La forma de guardar cada letra del mensaje ser la siguiente:Cada byte indica una columna de la letra, donde un 0 es led apagado y 1 led encendido.Nota: Es una forma de hacerlo, la cual la aprend del amigo BrunoF en uno de sus tantos aportes Luego el mensaje puede ser mayor al cartel utilizado para mostrarlo as que es necesario efectuar un desplazamiento del mensaje sobre el cartel o lo que es lo mismo desplazar el cartel sobre el mensaje.Para ello se utilizar una variable que indica la posicin inicial dentro del mensaje, en la cual comienza a mostrarse en el cartel. Como deseamos que el mensaje sea rotativo el problema se presenta en las ltimas posiciones donde se debe mostrar la parte final del mensaje y empezar a mostrar el inicio Lo que hacemos es dividir en 2 la forma de mostrar el mensaje, cuando Posicin Inicial + Largo del Cartel sea menor a Largo del mensaje y cuando sea mayor:

Bueno, ms o menos se ha explicado como vamos a trabajar con el mensaje, ahora se debe entender como va a funcionar el multiplexo de los leds. Vamos a realizar la multiplexacin por filas, sea que vamos a seleccionar una fila y vamos a actualizar sus valores por medio de registros de desplazamientos. El tiempo de actualizacin no debe superar los 20ms!Para actualizar usaremos una variable que indique que fila ha de actualizarse, por ejemplo para actualizar la fila uno la variable FilaActual ser 00000001. Ahora para saber que valores tenemos que mandar a los registros de desplazamiento iremos tomando cada una de las columnas (PosicionEnviar) a actualizar, aremos un AND con FilaActual y determinaremos si enviar un 1 o un 0.-( PosicionEnviar (AND) FilaActual ) = FilaActual?Si -> Enviamos un 1No-> Enviamos un 0Hardware para simulacin:

; CARTEL DE LEDS. de 32x8. ; Si las letras son de 8x8, maxima cantidad de letras en el mensaje 31.-

; **** Encabezado ****list p=16F628A ; Microcontrolador utilizado.-#include P16F628A.inc ; Definicion de registros SFR.-__CONFIG _HS_OSC & _PWRTE_ON & _WDT_OFF & _CP_OFF & _MCLRE_ON & _BOREN_OFF & _LVP_OFF & _DATA_CP_OFF;**** Definicion de Variables ****CBLOCK 0x20 ; En esta posicion se declaran los registros de usuario (GPR) STATUS_Temp ; Registro para guardar temporalmete STATUS W_Temp ; Registro para guardar temporalmete W Banderas ; Registro para almacenar banderas.- FilaActual ; Fila Actual a refrescar.- PosicionInicial ; Posicion inicial dentro del mensaje a visualizar en el cartel.- (Entre 0 y LargoMsj-1) PosicionEnviar ; Posicion del registro a enviar.- CuentaRefrescos ; Cuenta la cantidad de refrescos realizados. LargoCartel ; Guarda largo del cartel.- 32 LargoMsj ; largo del mesaje a visualizar-> Max 249 Bytes.-Para aumentar modificar manejo de tabla.- TempH ; Temporal para guardar calculos matemticos.- TempL ; Temporal... VelMovimiento ; Para fijar velocidad de movimiento.-ENDCVelocidad equ d'4' ; Para fijar velocidad de desplazamiento.-kbhit_tiempo equ 0 ; Bandera que indica que han pasado 2ms.-kbhit_cuadro equ 1BData equ 0BClock equ 1Strobe equ 2

;**** Inicio del Microcontrolador ****Reset org 0x00 goto Inicio ; Salto a inicio del programa.-;**** Vector de Interrupcion **** org 0x04 goto Inicio_ISR ; Atiendo Interrupcion.-;**** Mensaje a Mostrar ***** org 0x05Mensaje addwf PCL,1 ; Se incrementa el contador del programa.- DT 0x38, 0x7C, 0xFE, 0x82, 0x82, 0x82, 0x44, 0x00 ; C DT 0x60, 0xF4, 0x94, 0x94, 0xFC, 0xF8, 0x00, 0x00 ; a DT 0xFC, 0xFC, 0x08, 0x04, 0x04, 0x00, 0x00, 0x00 ; r DT 0x04, 0xFE, 0xFE, 0x84, 0x40, 0x00, 0x00, 0x00 ; t DT 0x78, 0xFC, 0x94, 0x9C, 0x58, 0x00, 0x00, 0x00 ; e DT 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ; l DT 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ; Espacio DT 0x78, 0xFC, 0x84, 0x48, 0xFE, 0xFE, 0x00, 0x00 ; d DT 0x78, 0xFC, 0x94, 0x9C, 0x58, 0x00, 0x00, 0x00 ; e DT 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ; Espacio DT 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ; l DT 0x78, 0xFC, 0x94, 0x9C, 0x58, 0x00, 0x00, 0x00 ; e DT 0x78, 0xFC, 0x84, 0x48, 0xFE, 0xFE, 0x00, 0x00 ; d DT 0x88, 0x9C, 0x94, 0xF4, 0x64, 0x00, 0x00, 0x00 ; s DT 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ; Espacio DT 0x8C, 0x9E, 0xFE, 0xFA, 0x62, 0x00, 0x00, 0x00 ; S DT 0x7C, 0xFC, 0x80, 0x80, 0xFC, 0xFC, 0x00, 0x00 ; u DT 0xFE, 0xFE, 0x10, 0x38, 0x64, 0xC4, 0x80, 0x00 ; k DT 0x04, 0x8C, 0xB8, 0x70, 0x30, 0x08, 0x04, 0x00 ; y DT 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ; Espacio DT 0x82, 0xC1, 0xA1, 0x91, 0xCE, 0x00, 0x00, 0x00 ; 2 DT 0x80, 0x86, 0x85, 0x89, 0x71, 0x00, 0x00, 0x00 ; 5 DT 0xC0, 0x3C, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00 ; / DT 0x81, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00 ; 1 DT 0x7E, 0x81, 0x81, 0x81, 0x7E, 0x00, 0x00, 0x00 ; 0 DT 0xC0, 0x3C, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00 ; / DT 0x7E, 0x81, 0x81, 0x81, 0x7E, 0x00, 0x00, 0x00 ; 0 DT 0x8E, 0x91, 0x51, 0x71, 0x1E, 0x00, 0x00, 0x00 ; 9 DT 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ; Espacio;**** Programa principal ****Inicio;---- Configuraciones ---- bsf STATUS,RP0 ; Banco 1.- movlw 0xF8 movwf TRISA ;eeeeesss movlw 0x00 movwf TRISB ;ssssssss movlw 0xDF movwf OPTION_REG ; Pull-Up deshabiltado, , Timer0|interno, 1:1 bcf STATUS,RP0 ; Banco 0.- movlw 0x07 ; Configuro Comparador Analogico movwf CMCON ; V1in-=GND, V1in+=GND, C1out=Off| V2in-=GND, V2in+=GND, C2out=Off clrf PORTA clrf PORTB movlw 0x4D movwf T2CON ; Timer2: Pre=1:4, Post=1:10

movlw Velocidad ; Cargamos velocidad de desplazamiento.- movwf VelMovimiento movlw d'32' ; Cargamos largo del cartel.- movwf LargoCartel movlw d'232' ; Cargamos largo del mensaje.- movwf LargoMsj clrf PosicionInicial clrf Banderas movlw 0x01 movwf FilaActual movlw 0x08 movwf CuentaRefrescos

clrf PIR1 ; Limpiamos Banderas bsf STATUS,RP0 ; Banco 1.- bsf PIE1,TMR2IE ; Habilitamos interrupcion por Timer2 bcf STATUS,RP0 ; Banco 0.- bsf INTCON,GIE ; Habilitacion general de interrupciones bsf INTCON,PEIE ; Habilitacion de interrupciones Perifericas

Bucle btfss Banderas,kbhit_tiempo ; Se espera a que pasen 2 ms.- goto $-1 bcf Banderas,kbhit_tiempo call ActualizarCartel ; Se actuliza fila del cartel.- goto Bucle

;**************************************************************************;**** Rutina de servicio de Interrupcion ****Inicio_ISR;---- Guardado de registro W y STATUS ---- movwf W_Temp ; Copiamos W a un registro Temporario swapf STATUS,W ; Invertimos nibles de STATUS movwf STATUS_Temp ; Guardamos STATUS en un registro temporal;---- Interrupciones ---- btfsc PIR1,TMR2IF ; Interrupcion por Timer2? goto ISR_TIMER2 ; Si, se trata interrupcion;.............................Fin_ISR;---- Restauramos los valores de W y STATUS ---- swapf STATUS_Temp,W movwf STATUS swapf W_Temp,f swapf W_Temp,W retfie;.......................ISR_TIMER2; Tratamiento de Interrupcion decfsz CuentaRefrescos,1 ; Se refrescaron las 8 filas (Momento adecuado para realizar algun cambio.-) goto SetBandera ; No, seguimos.. decfsz VelMovimiento,1 ; Si, ya pasaron 16ms x VelMovimiento? goto RecargarData ; No, seguimos... movlw Velocidad ; Recargamos Velocidad movwf VelMovimiento incf PosicionInicial ; Si, incrementamos PosicionInicial para efectuar "movimiento" movfw LargoMsj ; Verificamos si ya se llego al final del Mensaje.- subwf PosicionInicial,0 btfss STATUS,Z goto RecargarData ; No, seguimos.. clrf PosicionInicial ; Si, reseteamos PosicionInicial.-RecargarData movlw 0x01 movwf FilaActual movlw 0x08 movwf CuentaRefrescosSetBandera bsf Banderas,kbhit_tiempo ; Indicamos que han pasado 2 ms, y es necesario actualizar.- bcf PIR1,TMR2IF ; Borramos bandera goto Fin_ISR;.......................;*************************************************************************ActualizarCartel; Es (PosicionInicial + LargoCartel