Let's Make Robots!

Picaxe too slow, how to speed up?

Hello guys. I am working on my laser tag project using a picaxe (btw if anyone's interested tell me :=) )

I now have one problem regarding IR transmission of data. Since i am gonna have a picaxe receive data from 3 different "sensor areas" i cannot just leave it on SERIN because this would mean the picaxe is only going to monitor one of the sensor zones at a time. Instead i want it to be ready to receive data from any of these 3 sensor areas as soon as they have something to transmit. Because of this i am making the transmitter of data send a high bit lasting less than a millisecond before the actual data i want to transmit. This way the receiver knows which pin to SERIN. The problem is that after doing some test, i realized that the receiver needs time to switch between this: (which is the checking of the pins)


if pin1 = 0 then 

goto serouting1 

end if

if pin2 = 0 then 

goto serouting2

end if

if pin3 = 0 then 

goto serouting3 

end if 


And this:

 serin 1, T2400 , b0  

 The tests says it needs between 15ms and 20ms.

That's a LOT, especially for my project, where i have to simulate a rifle firing up to 20 bullets per second. "0 bullets/sec means 50ms per data transfer INCLUDING the checking of the pins and switching to SERIN. Unless the SERIN takes 30ms (actually i don't know how it takes and don't know how to measure it), this 20ms for the switching are too much. Do you know a way to resolve this problem? Either by speeding up the picaxe (say 8MHz instead of 4), finding another way of monitoring three different input before going on SERIN, etc...

Thank you! 


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Got to this post from here.

 I guess I have a few questions on this.

How will you handle hits at the same time from all three angles? 2 angles?

how do you handle bad serial data?(moving sensors and targets tend to cause issues not to mention reflected light)

how are you currently hooking this setup up?

how did you come up with the fire rate? is this typical of laster tagish sort of games? I've played single trigger pulses but not autofire.

What do your serouts do in the code that you posted here?

1) The angles will be three. It's something i also thought about and in fact in my original version i had one small MCU per angle which, once it got the "bullet", would wait for the Central Brain (CB) to be ready to receive it, and only then send it. This way you don't get data scrambles.

Though other laser tag system i have seen around don't do this. They have no angles actually, just one input, but they do connect several sensors in parallel to this input, and they say they have never had problems with it. This last thing makes me think of using only one MCU for reception, with interrupts (one for each angle). But still i can't make up my mind, money-saving(1MCU) or accuracy(3MCUs)? 


2) Bad data will be "understood" as a near miss. This also makes the ISD play a sound so the player understand a bullet has passed near him. I have no other idea of how i could treat bad serial data.


3) The setup is actually just an idea. I have made several test: IR sending, IR reception, sound module, ect.. but never hooked them up together. I still need to understand how many MCUs i want to use. Some days i wake up and say i want 4, some others 2....


4) I am making my own laser tag system because i am not satisfied with the other ones i saw around. This is because i am an airsoft player, and since i like airsoft (cept for some flaws that i think laser tag could resolve...in exchange for other ones) i want to make a mil-sim laser tag (military simulation), so i will be using the rate of fire of the real steels, if baud rates let me do this (it seems they do! :D). The system will also have a switch which lets you switch between semi and auto (don't forget you got only 30 bullets in the mag!)


 5) The serout are to transmit data via the IR LED to the other picaxe which has the IR receiver (i am using chips without the irin and irout commands, don't even know the difference about them).