1 - pay more attention and you won't have attention deficit.
2. Use lower case - it is more professional
3. Just do the scan routine I suggested. You will then add things to it later.
4. My delay has 2 less instructions and assumes the register will enter the delay with 00 - which it WILL so why load it?
It's just another clever thing to remember.
5. Put tables in the first 256 bytes of memory where you put all your coding..
Put tables like this:
orig 000
setUp
goto Main
Then put tables:
table1 addwf PCL,F ;02h,1 add W to program counter
retlw .10 ;etc
retlw .50 ;etc
table2 addwf PCL,F ;02h,1 add W to program counter
retlw .10 ;etc
retlw .50 ;etc
then goto table1 so that the value in table1 will return you to the sub-routine: Main
You can also add the LEDs and illuminate them.
To do this you will need a file called LEDs_1
The values in this file will be output during the 4th part of the scan.
Clear the file and make sure the LEDs are off - it depends on the way the LEDs are illuminated.
Then load the file with a value and see if the correct LEDs illuminate.
You will be flashing the LEDs later.
Then name a file keys_on and another keys_off
These will be the flag files to detect when a key is pressed for the first time and when the scan routine has performed another scan and the key is not pressed. This is called debouncing.
You are gradually working up a full scan routine by adding theses items one-at-a-time and getting it to work.
Before . . . . . you created everything at once and it did not work. That's the wrong way to go about it. You must do one thing at a time and get it to work. But you must also know how to create a framework or scan routine that can be added to. Once you understand the concept of a scan routine, you can add things during the time when the displays are illuminated and this will not detract from the brightness of the display.
In your program above you should turn off one display just before turning on the next. You have some few microseconds of program between one and the other and this does not matter at this stage, but when you are desperate for illumination, all the timing matters.
2. Use lower case - it is more professional
3. Just do the scan routine I suggested. You will then add things to it later.
4. My delay has 2 less instructions and assumes the register will enter the delay with 00 - which it WILL so why load it?
It's just another clever thing to remember.
5. Put tables in the first 256 bytes of memory where you put all your coding..
Put tables like this:
orig 000
setUp
goto Main
Then put tables:
table1 addwf PCL,F ;02h,1 add W to program counter
retlw .10 ;etc
retlw .50 ;etc
table2 addwf PCL,F ;02h,1 add W to program counter
retlw .10 ;etc
retlw .50 ;etc
then goto table1 so that the value in table1 will return you to the sub-routine: Main
You can also add the LEDs and illuminate them.
To do this you will need a file called LEDs_1
The values in this file will be output during the 4th part of the scan.
Clear the file and make sure the LEDs are off - it depends on the way the LEDs are illuminated.
Then load the file with a value and see if the correct LEDs illuminate.
You will be flashing the LEDs later.
Then name a file keys_on and another keys_off
These will be the flag files to detect when a key is pressed for the first time and when the scan routine has performed another scan and the key is not pressed. This is called debouncing.
You are gradually working up a full scan routine by adding theses items one-at-a-time and getting it to work.
Before . . . . . you created everything at once and it did not work. That's the wrong way to go about it. You must do one thing at a time and get it to work. But you must also know how to create a framework or scan routine that can be added to. Once you understand the concept of a scan routine, you can add things during the time when the displays are illuminated and this will not detract from the brightness of the display.
In your program above you should turn off one display just before turning on the next. You have some few microseconds of program between one and the other and this does not matter at this stage, but when you are desperate for illumination, all the timing matters.
Last edited: