PicAxe_Program behaves differently after pull the USB-plug :-(

Loonarrix

New Member
PicAxe_Program behaves differently after pull the USB-plug :-(

I have the PicAxe Starterset AXE002X with 18X with following circuit:

Input Pin 1 , 2 , 6 , 7 on Buttons
Output Pin 1 , 2 ,3 , 4 , 5 , 6 on color LEDs


My iBook is connected about a USB-Serial-Adapter to the PicAxe 18X.
I'll send my Programm with the Mac OSX PowerPC compilers (command line)
and my programm works flawlessly :)

Push Button on Pin1 = red LED lights on Output 5
Push Button on Pin2 = blue LED lights on Output 2
Push Button on Pin6 = white LED lights on Output 1
Push Button on Pin6 = other white LED lights on Output 6

Orange LED on Output 4 flashes independently and fast
Green LED on Output 3 flashes independently and slow

But:

when i quit the connection to the computer or pull the USB-plug
the Program works faulty :-(
precise :
red LED on Output 5 lights and flickers totally uncontrolled nevertheless have
unpressed Button on Pin1.

what is the cause ?
 

Loonarrix

New Member
symbol ein_zaehler = b1
symbol aus_Zaehler = b2

symbol ein_zaehler2 = b4
symbol aus_Zaehler2 = b5

let ein_zaehler = 15
let ein_zaehler2 = 50

let b3 = 1
let b6 = 1



main:

if pin1 = 1 then gosub led_rot_an ; gruener Taster
if pin1 = 0 then gosub led_rot_aus
if pin2 = 1 then gosub led_blau_an ; blauer Taster
if pin2 = 0 then gosub led_blau_aus
if pin6 = 1 then gosub led_weiss1_an ; kippschalter_Y
if pin6 = 0 then gosub led_weiss1_aus
if pin7 = 1 then gosub led_weiss2_an ; kippschalter_X
if pin7 = 0 then gosub led_weiss2_aus

goto blinken_orange
start1:

goto blinken_gruen
start2:

goto main
end




led_rot_an:
high 5
return

led_rot_aus:
low 5
return

led_blau_an:
high 2
return

led_blau_aus:
low 2
return

led_weiss1_an:
high 1
return

led_weiss1_aus:
low 1
return

led_weiss2_an:
high 6
return

led_weiss2_aus:
low 6
return





'*******************************************************************'
blinken_orange:
if b3 = 1 then goto start_an
if b3 = 2 then goto start_aus
end

start_an:
if ein_zaehler > 0 then goto led_orange_an
if ein_zaehler = 0 then goto led_orange_aus
end

start_aus:
if aus_zaehler > 0 then goto led_orange_aus
if aus_zaehler = 0 then goto led_orange_an
end

led_orange_an:
high 4
let ein_zaehler = ein_zaehler - 1
let b3 =1
if aus_zaehler = 0 then gosub aus_zaehler_auffuellen
goto start1

led_orange_aus:
low 4
let aus_zaehler = aus_zaehler -1
let b3 = 2
if ein_zaehler = 0 then gosub ein_zaehler_auffuellen
goto start1

aus_zaehler_auffuellen:
let aus_zaehler = 15
return

ein_zaehler_auffuellen:
let ein_zaehler = 15
return
'*******************************************************************'

'*******************************************************************'
blinken_gruen:
if b6 = 1 then goto start_an2
if b6 = 2 then goto start_aus2
end

start_an2:
if ein_zaehler2 > 0 then goto led_gruen_an
if ein_zaehler2 = 0 then goto led_gruen_aus
end

start_aus2:
if aus_zaehler2 > 0 then goto led_gruen_aus
if aus_zaehler2 = 0 then goto led_gruen_an
end

led_gruen_an:
high 3
let ein_zaehler2 = ein_zaehler2 - 1
let b6 =1
if aus_zaehler2 = 0 then gosub aus_zaehler_auffuellen2
goto start2

led_gruen_aus:
low 3
let aus_zaehler2 = aus_zaehler2 -1
let b6 = 2
if ein_zaehler2 = 0 then gosub ein_zaehler_auffuellen2
goto start2

aus_zaehler_auffuellen2:
let aus_zaehler2 = 50
return

ein_zaehler_auffuellen2:
let ein_zaehler2 = 50
return
'*******************************************************************'







Hello eclectic, her is my Code. Thank you for help me :)
 

BeanieBots

Moderator
Different behaviour with/without the programming lead means a circuit error.
Either, you do not have the correct download circuit or you have missed out the pull-up/down resitors on your button inputs and/or no pull-up on the reset pin.
 

Loonarrix

New Member
Thank you for the tip.

For the Input Pin 1 : I have a 10 k resistor are soldered.
And now the the circuit is working correctly !!!
 
Top