Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 15th April 2004, 11:02 AM   #1
Default led flasher

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
Attached Files
File Type: zip complate_flasher.zip (2.1 KB, 56 views)
besho741 is offline  
Old 16th April 2004, 01:39 AM   #2
Default

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).
__________________
"Having to do with Motion Control"
motion is offline  
Old 17th April 2004, 08:11 AM   #3
Default

so what can i do to solve this problem and how i can know startting of table
besho741 is offline  
Old 17th April 2004, 09:14 AM   #4
Default

Quote:
Originally Posted by besho741
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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 17th April 2004, 03:27 PM   #5
Default

Quote:
Originally Posted by besho741
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
__________________
"Having to do with Motion Control"
motion is offline  
Reply

Tags
flasher, led

Thread Tools
Display Modes




All times are GMT. The time now is 02:04 PM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker