Basic code bellow (PROBLEM): As soon as it writes to the chip it all comes on, and then starts flashing o.0 even though b1 = 0
high b.1
high b.2
high b.3
high b.4
high b.5
high b.6
high b.7
high c.0
high c.1
high c.2
high c.3
b1 = 0
main: serrxd b1
if b1 = 1 then low b.1 pause 50 high b.1 goto main endif
if b1 = 2 then low b.2 pause 50 high b.2 goto main endif
if b1 = 3 then low b.3 pause 50 high b.3 goto main endif
if b1 = 4 then low b.4 pause 50 high b.4 goto main endif
if b1 = 5 then low b.5 pause 50 high b.5 goto main endif
if b1 = 6 then low b.6 pause 50 high b.6 goto main endif
if b1 = 7 then low b.7 pause 50 high b.7 goto main endif
if b1 = 8 then low c.0 pause 50 high c.0 goto main endif
if b1 = 9 then low c.1 pause 50 high c.1 goto main endif
if b1 = 10 then low c.2 pause 50 high c.2 goto main endif
if b1 = 11 then low c.3 pause 50 high c.3 goto main endif
goto main
'reduce download time
#no_table
#no_data
Can anyone solve this for me? i really need this issue sorted asap :(
I really think it's something to do with the C pins because as soon as i take them out it works fine so how do i change the pins to outputs only?
I changed all the cpins to 11111111 and b pins to 11111111
but the lights leds aint in c pins, only b pins have 7 lights but now when i wait they start flashing, and it gets faster n faster over time?
dirsC
dirC is the variable your looking for.
let dirsC = %00001111 to make C.0 - C.3 outputs
let pinsC = %00001111 switch them on in one statement
let pinsB = %11111111 switch on all 8 pins on port B
But your code allready makes the pins outputs: high C.0 - high C.3 should make those pins output. The code runs OK as it is in the simulator and I see nothing wrong with it.
Explain please what starts flashing: all the lights or just one or only the ones on port C?
Thanks guys, it may be a
Thanks guys, it may be a chip problem though, so i’ve switched over to the 40x2 and i’ve downloaded the data to it, going to test it now, maybe my 28x2 chip is faulty… if it is i’ll deal with it, probably reburn the firmware or something
Current
I think your problem is electrical and not in the program. Perhaps you draw too much current from the chip and it is resetting for some reason. If you connect 12 LEDs with a 330Ohm resistor directly on the output pins running at 5V: you will draw more than the 90mA the chip can deliver when all the LEDs are turned on (20mA per output but max=90mA total)
Show us how the lights are connected. Can you post a picture?
Does it work with less LEDs? for example 2 port C pins and 2 port B pins?
Does it work if you start with all lights off and lighting them one by one depending on the value of b1?
reset test
To test if the picaxe is resetting or running the program. pause the program with every led in the initialisation like this:
high b.1
pause 200
high b.2
pause 200
high b.3
pause 200
etc.etc.etc.
If the picaxe is indeed resetting, the lights will not be flashing but you should see the lights coming on one by one instead of all at the same time.
Okay, so it is the code, Let
Okay, so it is the code, Let me repaste this
symbol varA = b0
let dirsB = %11111111
let dirsC = %00001111
let pinsB = %11111111
let pinsC = %00001111
main: serrxd varA
if varA = 1 then low b.1 pause 100 high b.1 endif
if varA = 2 then low b.2 pause 100 high b.2 endif
if varA = 3 then low b.3 pause 100 high b.3 endif
if varA = 4 then low b.4 pause 100 high b.4 endif
if varA = 5 then low b.5 pause 100 high b.5 endif
if varA = 6 then low b.6 pause 100 high b.6 endif
if varA = 7 then low b.7 pause 100 high b.7 endif
if varA = 8 then low c.0 pause 100 high c.0 endif
if varA = 9 then low c.1 pause 100 high c.1 endif
if varA = 10 then low c.2 pause 100 high c.2 endif
if varA = 11 then low c.3 pause 100 high c.3 endif
#no_table 'reduce download time
#no_data 'reduce download time
Now i think the problem is the if problems, they’re not responding to the b1 variable properly, it does once and then wont do it again to any pin when i send the serial numeric number? this is really starting to irritate me
http://imageshack.us/gal.php?
http://imageshack.us/gal.php?id=sZirktTgx9OplK6W0-GU1unLpA
here are the images, they are all on constantly unless told to flicker by serial input
BTW i’m running the chip at
BTW i’m running the chip at 4.5 volts, because of the added led load
Resistor
What resistors are you using?
Did you try any of the suggestions I mentioned?
Don’t forget to add the “goto main” at the end of the code
I got it working thanks
I got it working thanks guys!! aprechiate the help, especially from mint!
Don’t leave me in suspense!
Can you tell what the solution turned out to be?
Did you get it working on the 28X2?