Erratic Operation on removal of download cable?

jadesteffen

New Member
Whenever I remove the download cable, my 18x behaves wierdly. I remember reading somewhere in the manual about using a pull-down resistor on the serin pin, but it's connected thru a 22k, thru a 10k, to GND.
 

premelec

Senior Member
be more specific about 'weirdness' term is about as well defined as 'fuzz' - what functions are not working etc...
 

jadesteffen

New Member
I'm pulsing a LED to comunicate with a Lego Programable Brick, In Visible Light Link code. When the Cable is in, I push a button, and the LED briefly flashes. When the cable is out, I push a button and the LED continues flashing, without stopping.

Also, Semi Related:

The code below is the code I'm using with the above scenario:

main:

button 0,1,200,100,b0,1,sp

Goto main

Sp:

high 4
pause 41
low 4
pause 5
high 4
pause 5
high 4
pause 5
low 4
pause 5
high 4
pause 5
low 4
pause 5
low 4
pause 5
high 4
pause 5
high 4
pause 5
low 4
pause 5
high 4
pause 5
high 4
pause 5
low 4
pause 5
high 4
pause 5
high 4
pause 5
low 4
pause 5
high 4
pause 5
low 4
pause 5
low 4
pause 5
high 4
pause 5
high 4
pause 5
low 4
pause 5
high 4
pause 5
high 4
pause 5
low 4
pause 5
high 4
pause 5
high 4
pause 5
low 4
pause 5
high 4
pause 5
high 4
pause 5
low 4
pause 5
high 4
pause 5
low 4
pause 5
low 4
pause 5
low 4
pause 5

return

Whenever the button is pushed, it flashes the led on out 4 like it should. But, when I push the button a second time, nothin happens. After a reset though, it will work for 1 push.

Edited by - jadesteffen on 17/09/2006 04:38:40
 

wilf_nv

Senior Member
I think I know this one: the button command, when true, does not GOSUB SP but rather does GOTO SP. Therefore SP should not end with a RETURN but, in this case, should end with a GOTO main.
 

BrendanP

Senior Member
Put a 100n capacitor across the supply pins of the picaxe.

Make life easier use a for....next loop rather than all the high and low commands. Look in the basic command part of the manual.
 

jadesteffen

New Member
Ahh. Thanks.

"Make life easier use a for....next loop rather than all the high and low commands. Look in the basic command part of the manual"

If you'll look closely at the highs and lows you'll see that they don't follow any specific pattern, so I'm not sure how a For/Next loop would help.
 

Mycroft2152

Senior Member
The Lego Visible Light link sounds interesting. Do you have a link to the explanation of the code?

I see a reference to using the LED tower to control a Robosapien.

I found a couple of sites, but they were not very helpful.

Myc
 

jadesteffen

New Member
Explanation:

http://www.elecbrick.com/lego/

Codes:

http://www.elecbrick.com/lego/MicroScoutVLL.pdf

(In barcode format, I've developed a VB program that will take a binary VLL code and a pin number and convert it to Picaxe code for you, if you want it, just tell me.)

Edited by - jadesteffen on 18/09/2006 00:24:36
 

Mycroft2152

Senior Member
Thanks, I had never heard of the Lego Scout before. Clever, a 4 bit microprocessor bar code programmable. I see you can still buy it for $10.

I'd like to see the Vb program. If you would like, you can post it to the PICAXE Circuits Yahoo group.<A href='http://tech.groups.yahoo.com/group/PICAXE_circuits/' Target=_Blank>External Web Link</a>
http://tech.groups.yahoo.com/group/PICAXE_circuits/
It is a place where files can be posted that cannot be posted here on the forum.

Are the binary codes ASCII? You might be able to shorten the program by converting them to ASCII then serially outputttng them, just an idea. Have you calculated the Baud rate?

The Scout looks like a very early version of the current Microbric I-bot. You guys down under should be very familiar with it. It is availible in the US at <A href='http://www.sheekgeek.com/MicrobricIbot.html' Target=_Blank>External Web Link</a>
http://www.sheekgeek.com/MicrobricIbot.html

Myc


 
G

Guest

Guest
@Mycroft:

I'll Try to post it up tomorrow.

@wilf_nv:

Thanks a lot! Your suggestion did the trick. But i've still got the erratic operation problem.

@BrendanP:

I'll try that tommorow. What's the n mean? nano farad?

Edited by - on 18/09/2006 04:49:27

Edited by - on 18/09/2006 04:49:49
 

jadesteffen

New Member
I added the cap, still doesn't work right.

When the cable is in, the led flashes once per button push.

When the cable is out, and I push the button, the led continues flashing.
 

Mycroft2152

Senior Member
Thanks. Let's try to solve your problem first, then try to tighten the code. I'm setting up a 18X to try to duplicate your problem. A couple of questions:
Describe your set up. Brreadboard?
What is your power supply?
What size is the resistor on the switch?

Myc



Edited by - mycroft2152 on 19/09/2006 01:13:11
 

jadesteffen

New Member
It's on a breadboard. 6v 4AA battery pack. No resistor on the switch.

See http://wc.out-lawz.com/Picaxe/VLL%20Circuit.bmp for the download circuit.
 

inglewoodpete

Senior Member
Two areas of concern already. First: turn it off urgently!!!

1. 6v is too high for a PICAXE! Unless you are using some on-board voltage regulation Eg 5v 7805 or similar, or a series dropping resistor in the power leg, you risk letting the smoke out. And we all know that electronic devices don't work properly once the smoke escapes ;o)

2. Have thorough read of pages 25, 26 of the interfacing manual. You must use a pullup or pulldown resistor on the input leg. When an input is open circuit its state is indeterminate: neither high (1) or low (0). Due to the input having a high impedance, it is sensitive to static charges and electromagnetic fields (Eg radio waves and mains hum). The resistor pulls the input to the voltage on one rail (one logic level) while pressing the switch will pull the input to the other rail (opposite logic level) - clearly logic levels 0 and 1 (or 1 and 0).

Edited by - inglewoodpete on 19/09/2006 03:37:47
 

Mycroft2152

Senior Member
I'll second that! Shut it down.

I just set up an 18X on a breadboard, running off 3AAA's with a switch set as in the Interface manual. It works the same whether the programming cable is connected or not.

It's very important to read the manual. Rev_ED has done a pretty good job laying out the basics in the manuals.

If you must use the 4AA's, then you can get by with adding a standard 1N4148 diode in line with the the +V. This will drop the voltage by about 0.6 volts and bring it into the safe range.

Also, based on your schematic, you did not connect the gnd pin on the cable to the ground pin on the PICAXE. That is probably why the difference with and without the cable.

Once you add the resistors (10K and 1K) to the switch, connect the grounds and bring the voltage down, let us know how it works.

Myc

Then we can get down to tightening up the code with a little bit banging.

Edited by - mycroft2152 on 19/09/2006 04:00:39

Edited by - mycroft2152 on 19/09/2006 04:05:55
 

jadesteffen

New Member
Thanks guys, got it working!

I did have the SerGND and the PicaxeGND connected, must have missed that on my scheumatic. Replaced one of the cells with a bolt, so now it's 4.5 volts. What did the trick was a 10k pulldown resistor. Thanks alot guys!

EDIT:

I read the manual, what's the point of the 1k resistor down to the input pin? What's that do?

Edited by - jadesteffen on 19/09/2006 04:32:23
 

inglewoodpete

Senior Member
I consider the 1K resistor as optional. I notice that Rev-Ed omitted it on P26.

It could be of benefit to include the 1k resistor in several circumstances:
-If you are using a long lead to the switch.
-Alternatively, in a classroom environment, when leads don't always get connected where you'd expect :).
-Finally, the PICAXE may be programmed incorrectly or have an old programme that sets the pin as an output. (Again, particularly in a classrom environment.) Pressing the switch in this circumstance could overload the ouput transistors.

The resistor would offer a little protection in the way of current limiting.
 

Mycroft2152

Senior Member
Hi J,

Congrats on getting it working!

It may be time to improve the code a bit.

According to the VLL reference, the Scout uses:

35 bars in the code
1 bar start
9 bars as a checksum
21 bars as data
4 bars as stop

The checksum and data are coded in 3 bar groups where 0=LLH and 1=LHH. The data is a number between 0 and 127 while the checksum is a number between 0 and 7.

Your program uses a simple brute force method of 35 HIGH/LOw-PAUSE,HIGH/LOW-PAUSE, etc., to flash the LED. This takes up quite a bit of space. I don't know what your final project is but with the 18X you would be limited to only 3 or 4 bar codes.

There are other possiblities. First you could convert the 35 bars into five 8 bit groups and then sequentially shiftout (bit bang) the bytes to flash the LED.

Or your program could take the data and checksum values (only 2 numbers) and could convert them to bars on the fly, sandwiching them between the start and stop bar. patterns.

I had never looked behind the scenes at bar codes before and this was a fun challenge.

Myc

I posted a spreadsheet on the Yahoo PICAXE Circuits group showing the conversion process.
 
Sometimes if I do not pull down Input 3 with a 10k resistor in any case with a PICAXE 08M, the chip simply does not work. It seems to be sensitive to noise depending on where it is, so make sure you pull down unused inputs.
 

jadesteffen

New Member
Mycroft2152, Sorry, I've been real busy lately. I'll email you when I've looked at your spreadsheet more in detail. Thanks for taking the time to compile it.
 
Top