hi guys, sorry about the wait. I work over 1000km away from my home, and don't get many opportunities to be there at the moment.
Here is the code up to and including the first loop where it waits for a button press.
<code>
Include "modedefs.bas"
CMCON=7 'allows you to use pins as digital rather than analog
ADCON1 = %00000111 ' Disable A/D converter
ANSEL=0 'allows you to use pins as digital rather than analog
@ DEVICE PIC16F88, INTRC_OSC_NOCLKOUT, MCLR_OFF, WDT_OFF, LVP_OFF, PWRT_ON, PROTECT_OFF, BOD_OFF
DEFINE OSC 8
OSCCON = %01110000 ' INTRC = 8MHz
'declare inputs and outputs appropriately
TRISA = %00111100 ' a.5 is INPUT only
TRISB = %11100100
'define variables
mscounter var word
secondcounter var word
minutecounter var word
loopvar var word
'INPUTS First Name them by pin
rwire var portb.2
bwire var portb.1
mswitch var portb.0
playmode var porta.2
testmode var porta.3
startbutton var portb.5
'eventually the mode switch it will be a three position switch, and a.4 will be another input.
'OUTPUTS, Name them
solenoid var portb.3
modeled var porta.1
flashingled var porta.0
buzzer var portb.4
'Now perform the initial wait until the start switch is pressed
modeled = 1
solenoid = 0
pause 2000
startloop:
flashingled = 1
pause 50
if startbutton = 1 then goto checkvalues
flashingled = 0
pause 50
if startbutton = 1 then goto checkvalues
goto startloop
</code>
As I've indicated before, the rest of the code works fine, and it eventually leads back to this first loop. On the first execution, it skips this loop, and proceeds to the next section of code. When the program completes it comes back to startloop and then everything runs fine. I just need it to engage this first loop the first time.
I do not have an absolutely clear understanding of the ANSEL and CMCON commands. I've read about them and think I'm using them right.
It's possible I shouldn't even be using the ADCON command. I don't know though.
If anyone has great ideas I'm still very much interested in sorting this out.
Cheers, Mike




Bookmarks