On Thu, Dec 30, 2004 at 07:02:04PM -0500, Nathanial Hendler wrote: > On Thu, Dec 30, 2004 at 10:03:50PM +0100, Jan-Erik Soderholm wrote: > > For the "multipl-LED" case, set up 8 registers (bytes) to hold the > > "image" of what should be seen on the 8x8 LEDs. Then setup > > an timer-interrupt routine to do the regular multiplexing of the > > LEDs. > > > > Finaly add whatever logic you need to update the 8 regs with > > whatever "image" should be displayed on the LEDs. > > > > In that way, you separate the logic to calculate the image from > > the locig that continously updates the LED. Since the update is > > running from an timer-int, it shold be possible to make it > > flicker-less. > > I guess the above is what I was aiming at having; i.e. 8 registers that > represent the image. I can understand how to translate 8 registers to an 8x8 > LED, using TMR0. What my question still is, regards how to manipulate the 8 > registers in the ASM code. Say I have a pixel anywhere on the 'screen'. How > do I light the pixel under it. In other words, how do I turn on LED x,y-1? How > do I setup my registers so that they are addressable in such a manner that I > can do the following... > > bsf 5, ????????? > > ... to set LED 5,3? > > If I'm just being dense here, I'm sorry. Thanks for everyones' help so far. Not dense at all. Let me take a high level walk through with it. Since right now you only have 8 rows and columns let's use 4 bits to represent the row and column. And just to keep it simple let's use W to carry the parameters. So the call would be something like: MOVLW 0x53 call setled To set LED 5,3 Now let's presume you have 8 contiguous registers to store the bitmap as you specified. There are a few keys to making this work: 1. Use a jump table to convert the column to a bit number. 2. Use the FSR/INDF register to set the row. 3. Don't use the BSF and BCF instructions because there's no way to set a variable bit number. In order to use BSF/BCF you'd have to use a second jump table with an entry for each bit. To keep it short I'm going to shortcut and presume that the target is saved in a coord register and in W. The logic is something like: call col2bit ; convert column to bit number. Saved in register column swapf coord,W ; get the row in the lower 4 bits of W andlw 0x0f ; clear the top 4 bits addlw display ; add the display register base movwf FSR ; setup row in FSR mowf column,W ; get the column value iowf INDF,F ; Set the column bit in the specified row. return ; Bye. Hope this gives you some insight. BAJ -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist