Let's Make Robots!

Having problem with basic code :(

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?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Dan M's picture

I just noticed this, sorry. I see it is a month and a half old.  Did you ever get your problem solved?

If not I can probably help you.

 

Oh, nevermind, I just saw the post that says you got it.  Ok. nvm.

 

mintvelt's picture

Can you tell what the solution turned out to be? 

Did you get it working on the 28X2?

Elitism's picture

I got it working thanks guys!! aprechiate the help, especially from mint!

mintvelt's picture
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
Elitism's picture

Elitism's picture

BTW i'm running the chip at 4.5 volts, because of the added led load

Elitism's picture

http://imageshack.us/gal.php?id=sZirktTgx9OplK6W0-GU1unLpA

here are the images, they are all on constantly unless told to flicker by serial input

Elitism's picture

I'll post a pic hang on

Elitism's picture

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 :(
mintvelt's picture

goto main