I am running into a frustrating problem in on of my slave pics where it will in turn let the arduino know all of the actions are complete. Currently i am stuck in a do while statement. The code i have built so far goes:
#CONFIG
__CONFIG _CONFIG1, _INTRC_IO & _PWRTE_ON & _MCLR_OFF & _LVP_OFF
#ENDCONFIG
' Set the internal oscillator frequency to 8 MHz
DEFINE OSC 8
OSCCON.4 = 1
OSCCON.5 = 1
OSCCON.6 = 1
stepper var PORTB.0 ' step signal to motor
switch var PORTB.1 ' go signal from arduino
direction var PORTB.2 'Direction of rotation,high= raise, low= lower
corker var PORTB.6 'out
filler var PORTB.7 'out
ready2 var PORTA.4 'out
ready3 var PORTA.3 'out
done1 var PORTA.0 'input
done2 var PORTA.7 'input
i VAR word ' iteration size
low direction 'intiliaze direction signal to low
'
TRISB = %00000010 ' Sets PortB I/O
TRISA = %10000011 'Sets PortA I/O
high ready2
start:
low stepper
do while (switch == 0)
loop
Low ready2
low ready3
gosub steppy
pause 250
high filler
pause 50
high corker
pause 500
Low filler
Low corker
pause 1000
do while (ready3 == 0 or ready2 == 0)
if (done1 == 1) then
high ready2
endif
if (done2 == 1) then
high ready3
endif
loop
goo start
steppy:
for i = 0 to 4027
high stepper
low stepper
PAUSEus 400
next
return
end
I have it wired to buttons to simulate the inputs and leds as outputs signals. As i press done1 button it will not set ready2 high but it done2 will set ready3 high. This leaves the logic stuck in the do while loop. Any help i would greatly appreciate. Thank you. ( i am new to the whole programming)