Replicating commands from ar***no

oracacle

Senior Member
Someone has asked me to produce a small circuit. The thing already exists based on Arduino, it uses 3 ADC and input/output switching its gong to take a little bit of work to get it to go over to 08m2 but I think it entirely possible. However there are some constructs in the code that I don't think can be replicated in a single command with the picaxe environment.

Code:
if (analogRead(L3) < 50 && analogRead(R3) < 50)
this would seem to need two read ADC and a if/and statement. I suspect that this would be compiled into three commands at the time of compiling so should not make mush difference really.

here is the video that person found as an idea for me to replicate, but please be warned that the fellow uses what some would consider vulgar/strong language.
Admins, if I break some sort of rule for this, I apologise in advance and expect to be reprimanded in accordance with any rules that I have breached.

Currently I am thinking that if this goes all according to plan and transfers over the 08m2, then I would just solder the few components needed to the legs of the IC (or IC socket) and forgo the PCB as I suspect that space is going to be very limited. I am not 100% sure what I will be working with and some testing will happen when I get controller in front of me, I suspect that not as many ADCs are needed, but time will tell.
 

hippy

Technical Support
Staff member
if (analogRead(L3) < 50 && analogRead(R3) < 50)

this would seem to need two read ADC and a if/and statement. I suspect that this would be compiled into three commands at the time of compiling so should not make mush difference really.
Exactly that. Something like -
Code:
ReadAdc adcL3, b0
ReadAdc adcR3, b1
If b0 < 50 And b1 < 50 Then ...
One could also use MIN which actually delivers the highest of two values so will only be less than 50 if both are -
Code:
ReadAdc adcL3, b0
ReadAdc adcR3, b1
b2 = b0 Min b1
If b2 < 50 Then ...
The AXE231 is the board you need if you need a small 08M2 in something like a console controller -

http://www.picaxe.com/Hardware/PICAXE-Chips/PICAXE-08M2-Module/
 

oracacle

Senior Member
I have done a bit more work and looked at the older stuff on the forum. But here comes the problem. The new controllers work differently. Its not longer a just a case of detecting a button press with an if statement. I am not sure if it is using a multiplexed system or if its some sort of attempt at anti-modding. A pulse is sent to the triggers hall affect every 46.7ms, which lasts 1.35ms. The hall effect puts reduces the signal level an analogue fashion, however due to the pulsed nature of the signal reading the ADC produces a lot of readings of 0. pulsin works, to a point. Using a 14M2 @32mhz results in the time out being nearly double to the signal time - ideally I need to get it to as close as possible. I have tried a bit of count as well but, again a little slow on the uptake

The devices used in to video above have just literally arrived, so can do some testing with them to ensure that my interpretation of the code is correct.

Although I have just had a thought as I was typing that. I could take a signal from both before and after the half affect and is an If/and statement to see if the trigger5 has been activated.
Alas, more testing will have to wait until tomorrow as a need to go an take care of my friends weird cat.

I will try and post an image of the oscilloscope traces soon too.
 
Top