I'm trying to write a program that will keep a count going using variables, but have discovered something about my code causes the variable to return to the original set value when a jump occurs. I'm using a variable because I couldn't get the if statements to work with a memory location variable.
The loop part of my code looks like:
and the Cu command is a macro containing:
I'm stuck as to how I can accomplish the if statement using a method that doesn't reset upon the goto command at the end of the time sequence. I would use a table for the project, but it will be a different number of commands for each loop that I want carried out, and the only way I could fill them would be nop's -- which I feel would be a waste of memory for a long table.
Does anybody have any suggestions how how I can get such code to work without being a HUGE waste of memory in the PIC?
Thanks,
Joe
The loop part of my code looks like:
Code:
NXTCue ;Start the show
call Time ; Get delay time
TDelay ; Delay for time called for in Time table
Cu ; Set pins to advance firing
movlw d'5' ; Hold the pin high for
TDelay ; WREG x 100ms
clrout ; Clear Outputs
CN set CN+1 ; increment Cue number by 1
goto NXTCue ; Return to start and do it again
and the Cu command is a macro containing:
Code:
Cu MACRO
if CN == 1
bsf S1
bsf S3
endif
if CN == 2
bsf S7
bsf S18
endif
if CN == 3
bsf S9
endif
endm
I'm stuck as to how I can accomplish the if statement using a method that doesn't reset upon the goto command at the end of the time sequence. I would use a table for the project, but it will be a different number of commands for each loop that I want carried out, and the only way I could fill them would be nop's -- which I feel would be a waste of memory for a long table.
Does anybody have any suggestions how how I can get such code to work without being a HUGE waste of memory in the PIC?
Thanks,
Joe