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.

led flasher

Status
Not open for further replies.

besho741

New Member
hi every one
this modefied flasher program
you can select four paterns
and four speed with only two inputs
can any one check it and tell me if itis ok or not
 

Attachments

  • complate_flasher.zip
    2.1 KB · Views: 243
I noticed you used computed goto ("addwf pc,f") to obtain data from a look-up table. Unfortunately, "tabl2" crosses a page boundary and so the program will jump to the wrong "retlw k" position.

That is, tabl2 begins at 0DAh and ends at 10Ch. You can't allow the look-up table to cross the 0FFh-100h boundary, because instead of jumping to 100h, the program will end up at 000h (reset vector).
 
besho741 said:
so what can i do to solve this problem and how i can know startting of table

The easiest way is to move the table to near the start of memory, probably about 0x005 or so, so you avoid the interrupt and reset vectors. This avoids any paging problems, another option is to move it to the last 256 bytes, and set the paging bits accordingly when calling it.
 
besho741 said:
so what can i do to solve this problem and how i can know startting of table

To solve it, you have to locate the table to the start of a page to ensure it fits within a page. Use the ORG statement to move the table to location 100h.

Since the table is no longer at page 0, you have to initialize the PCLATH register to the right page. The value of the label "tabl2" will give its start position.

Code:
         movlw     high tabl2
         movwf     pclath

         movf      count,0
         call      tabl2

         ORG       100h

tabl2: 
         addwf     pcl,1
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top