Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

ISR Code Optimize - Assembly

Status
Not open for further replies.
Hi Mike-K8LH

I'm going to use your upper part code (which is very compact), but not the bottom macro which takes lots of program memory. I need more programming space to code my patterns. Here is the one I'm going to use.

Code:
isrproc
            pushisr                 ; save context
            movlw    .29
              movwf    Col_Counter
            incf    row,F           ; bump 'row' counter
            bcf     row,4           ; 0..15, inclusive
            movf    row,W           ;
            addwf   PCL,F           ;
            goto    row00           ;
            goto    row01           ;
            goto    row02           ;
            goto    row03           ;
            goto    row04           ;
            goto    row05           ;
            goto    row06           ;
            goto    row07           ;
            goto    row08           ;
            goto    row09           ;
            goto    row10           ;
            goto    row11           ;
            goto    row12           ;
            goto    row13           ;
            goto    row14           ;
            goto    row15           ;      

row00        movlw    68h                ; 1
            movwf    FSR                ; 1
            movlw   .2              ; 1
row00_Loop
            bcf     SR_Data         ; 1
            btfss   INDF,7          ; 1
            bsf     SR_Data         ; 1
            bsf     SR_Clock        ; 1
            bcf     SR_Clock        ; 1
            subwf   FSR,F            ; 1
            decfsz  Col_Counter,F   ; 1
            goto    row00_Loop      ; 2
            goto    Make_Latch  
      
      
row01        movlw    68h                ; 1
            movwf    FSR                ; 1
            movlw   .2              ; 1
row01_Loop
            bcf     SR_Data         ; 1
            btfss   INDF,6          ; 1
            bsf     SR_Data         ; 1
            bsf     SR_Clock        ; 1
            bcf     SR_Clock        ; 1
            subwf   FSR,F            ; 1
            decfsz  Col_Counter,F   ; 1
            goto    row01_Loop      ; 2
            goto    Make_Latch
      
row02        ---
row03        ---
row04        ---
row05        ---
row06        ---
row07        ---
row08        ---
row09        ---
row10        ---
row11        ---
row12        ---
row13        ---
row14        ---
row15        ---      
      
Make_Latch    bsf     SR_Latch
            nop
            bsf     SR_Latch
          
Exit_ISR    pullisr                 ; restore context
            retfie
 
Why don't you move the loading of FSR with 68h to above the calculated jump (after pushisr) and save 30 locations.

Mike.
 
Sorry for jumping in here again.. Re-reading this thread it would appear that you have a 29 x 16 array of LED's
You have all the rows connected to two pic ports and all the columns connected to 4 74hc595's..

I'm trying to understand why you are bit testing.... If you configure your 29 registers correctly, you can just out put the complete byte...

Are you trying to light the led's one by one? If so.. Take a look at the nokia 5110 ( LCD ) this uses column addressing, it will make your application easier to do..
 
Why don't you move the loading of FSR with 68h to above the calculated jump (after pushisr) and save 30 locations.

Mike.

Hi Mike

See the attached RAM locations I have placed (In my Post 10).For the 1st eight rows the last RAM location is 68h. From Row 9 to 16 the last RAM location is 69h. My CBLOCK starting from 30h. Below is how LEDs arrangement to RAM locations.

Code:
31 33 35 37 39 3B 3D 3F 41 43 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D 5F 61 63 65 67 69
30 32 34 36 38 3A 3C 3E 40 42 44 46 48 4A 4C 4E 50 52 54 56 58 5A 5C 5E 60 62 64 66 68
 

Attachments

  • Register Map (1).jpg
    Register Map (1).jpg
    49 KB · Views: 192
You can still preload it and increment W in the relevant sections. Won't save as much but still 22 locations.

Mike.
 
I'll wait for a proper schematic before adding any additional comments/suggestions.

Good luck on your project.

Cheerful regards, Mike
 
Hi Mike,

I have a brightness problem with my 16X29 LED matrix. Here how I fixed my LED's. Green & blue needs 3.2V to make it to light up brightly compared to Red & Yellow.

Row 1 - Row 4 = Green LEDs (Per row 29 LEDs)
Row 5 - Row 8 = Blue LEDs (Per row 29 LEDs)
Row 9 - Row 12 = Red LEDs (Per row 29 LEDs)
Row 13 - Row 16= Yellow LEDs (Per row 29 LEDs)

Attached drawing is the blue colour LED driving stage (Row 5 - Row 8), The drawing shows only a single column to easier understand.

Planning to use 6V to feed row drivers instead of 5V. Because with a 5V anode rows the blue LEDs won't lit.(I guess that due to saturation voltages + resistor drops it cannot supply 3.2 to blue LEDs).

I short circuit the series row resisters & checked, now the blue LEDs lights up but its bit of dim.
Is there any way to light up BLUE rows with the same 5V power supply with a descent brightness? Or do I need to make my VDD to 6V?

Note that: I cannot find any high current column drivers & anode FETs. So this must use with BJT's, ULN2803 & 74HC595 stuff :)
 

Attachments

  • B562.JPG
    B562.JPG
    55.1 KB · Views: 192
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top