switch input to output during running of picaxe or tri state output?

professor_jonny

New Member
am I able to use an input to read a binary switch and if the switch is not in any position have it switch to an output to drive to a specific set position depending on the preset selected the picaxe after power up after a set time ?

The problem I see if I have an output connected to an input it will be reading the status of the output of the picaxe which will be opened or closed via the program.
the other option could be if i'm able to tri state the output to floating during the read of the inputs on startup ?
 

inglewoodpete

Senior Member
Perhaps the best answer is "it depends". Yes, it can be done but you have to understand what you're doing. I have to say that your description is a bit vague for a succinct answer.
am I able to use an input to read a binary switch and if the switch is not in any position have it switch to an output to drive to a specific set position depending on the preset selected the picaxe after power up after a set time ?
Q1. A binary switch will be "on" or "off". I assume you mean the switch is 'off' at bootup. The impedance of the circuitry would need to be high enough not to interfere with the device being controlled by the output function.
Q2. What are you driving to a "specific set position"? It sounds like a motor, which need a higher driver capability than a PICAXE output pin.
 

professor_jonny

New Member
sorry by binary i mean binary output eg:

000
001
010
011
etc...

The micro will read the position of the switch and if it is set to binary 000 it will select a per determined binary output based on logic in the picaxe and close the contacts of the switch by swapping the inputs to outputs when needed.

What I don't not know if I alternativly could wire a input to an output pin and have a highz (trystate) output pin connected in parallel with the switch so I could float the output when I'm not driving it low as i don't want to supply
current into the device the switch is connected to.
 

inglewoodpete

Senior Member
OK, I understand the binary input part now.
What I don't not know if I alternativly could wire a input to an output pin and have a highz (trystate) output pin connected in parallel with the switch so I could float the output when I'm not driving it low as i don't want to supply current into the device the switch is connected to.
But wow! You've got me confused now. A circuit diagram would help me (and others) understand what you are actually planning. If you don't have a circuit drawing program, you can draw a (clear) circuit diagram, scan or photograph it and post the picture on the forum.
 

geoff07

Senior Member
Generally, a micro-controller controlled switch will have completely separate actuator and switched circuits. So inputs and outputs would never clash. You should at least specify what this switch is (part number) so it is possible to understand what you mean. inglewoodpete isn't the only one confused!
 

professor_jonny

New Member
This is the diagram of the circuit board I made and avip connector of the classic xbox
The idea is that this quick solder board will fit over the pins of the av connector and will have ipex cables (laptop wifi style RG 316) to bring the signals up to an video converter or plugs fitted on the xbox case.

Untitled1.jpg
xbox avip.jpg

What I wish to do is fit a video converter or output on the xbox either being component, vga, composite or svideo and if no standard xbox av pack is fitted it will select a pre defined pack type

The AV plug has a binary coded combination of three bits inside the plug to set the av pack type.

If i plug in an av pack the video mode will be selected by the plugged in pack type.

If no pack is inserted after a reset or power up it will select a pack type depending on a pin you connect to ground on the picaxe.

There is no switch as such the switch is inside the xbox avip plug which sets a binary code to the video encoder chip setting the output format on the av connector.

As component plugs are becoming hard to find on modern TV's the most common option will be to set is component and a component to hdmi adaptor will be fitted in side the xbox.

yes I could fit a switch to the xbox to select a pack type but if it could be done automatically it makes this an easy install for others to do to their xbox.
 
Last edited:

inglewoodpete

Senior Member
Thanks for the additional information of your project. I have a better understanding of what you are trying to do. This much makes sense.

Your difficulty is that very few forum members have experience with XBoxes (or other game consoles). We do see them posting from time to time and you may 'get lucky' that one sees your post and has the relevant knowledge to help you. You could try gaming forums: occasionally you see PICAXEs mentioned in posts there.

You are going to need an intimate knowledge of the input and output requirements of the Xbox video interfaces in order to simulate then with a PICAXE and other components. This is something that I have no knowledge, even though I have a 20-year old son (who has several Nintendo models but no Xboxes). Good luck with your search.
 

professor_jonny

New Member
I know the binary code of the mode select pins on the avip interface I just don't know how to switch an input to an output during running of the program and I could not find out how to do it from the flow chart programming method.

for example when using an arduino I would use:

Code:
digitalWrite( pinNumber, LOW );
pinMode( pinNumber, OUTPUT );  // now we're sourcing current, i.e. GND
pinMode( pinNumber, INPUT ); // now we're tri-stated
pinMode( pinNumber, OUTPUT );  // and back again
can I do the same with a picaxe?
 

geoff07

Senior Member
You probably don't need to do anything except use the high or low commands, as they switch the mode as required.

C is all very well but Picaxe Basic (which isn't basic at all) is so much easier and simpler to code, at the expense of some runtime speed.
 

professor_jonny

New Member
This is what I come up with.

I'm not to sure on the pull up part on port c but I think it is ok I guessed the mask

Code:
'XBOX AVIP selector:
'By professor_jonny
'program to automatically set a  default av pack type if no av pack
'is plugged into the xbox at boot up.

{ ;Symbols
symbol varA = b0
symbol varB = b1
symbol varC = b2
symbol varD = b3
symbol varE = b4
symbol varF = b5
symbol varG = b6
symbol varH = b7
symbol varI = b8
symbol varJ = b9
symbol varK = b10
symbol varL = b11
symbol varM = b12
symbol varN = b13
symbol varO = b14
symbol varP = b15
symbol varQ = b16
symbol varR = b17
symbol varS = b18
symbol varT = b19
symbol varU = b20
symbol varV = b21
symbol varTEMPBYTE1 = b22
symbol varTEMPBYTE2 = b23
symbol varTEMPBYTE3 = b24
symbol varTEMPBYTE4 = b25
symbol varTEMPBYTE5 = b26
symbol varTEMPBYTE6 = b27
symbol varTEMPWORD1 = w11
symbol varTEMPWORD2 = w12
symbol varTEMPWORD3 = w13
}


main:
Start:
	
	pullup %00000111						'enable internal pullup resistors
									'on port c pins
	input B.1, B.2, B.3 					'Set mode select pins as inputs
	
	pause 200							'wait .2 sec before checking
	if pinB.3=0 AND pinB.4=0 AND pinB.5=0 then 	'if no AV pack is plugged in

		goto AVpack_not_detected
	end if

	goto Xbox_reset_Check					'Pack detected wait for Xbox reset
									'to check for new pack

AVpack_not_detected:						'Check mode select jumpers 
									'and set aproprate pack type
	
	output B.1, B.2, B.3					'Set mode select terminals
									'as outputs
									
	if pinC.0=1 AND pinC.1=1 AND pinC.2=0 then	'Mode 110 standard AV jumper select

		goto Set_standard_AV_pack
	end if
	if pinC.0=1 AND pinC.1=0 AND pinC.2=0 then	'Mode 100 advanced AV jumper select

		goto Set_advanced_AV_pack
	end if
	if pinC.0=0 AND pinC.1=0 AND pinC.2=1 then	'Mode 001 component AV jumper select

		goto Set_component_AV_pack
	end if
	if  pinC.0=1 AND pinC.1=1 AND pinC.2=0 then	'Mode 010 VGA AV jumper select

		goto Set_VGA_AV_pack
	end if
	if pinC.0=0 AND pinC.1=0 AND pinC.2=0 then	'Mode 000 RGB AV jumper select

		goto Set_RGB_AV_pack
	end if
	goto Set_component_AV_pack				'if no jumper is selected select
									'Mode 110 component AV 

Set_standard_AV_pack:						'Set mode 110 standard AV
	
	high B.1, B.2
	low B.3

	goto Xbox_reset_Check

	
Set_advanced_AV_pack:						'Set mode 100 Advanced AV
	
	high B.1
	low B.2, B.3

	goto Xbox_reset_Check


Set_component_AV_pack:						''Set mode 001 component AV

	high B.3
	low B.1, B.2

	goto Xbox_reset_Check



Set_VGA_AV_pack:							'Set mode 010 VGA AV

		
	high B.2
	low B.1, B.3

	goto Xbox_reset_Check


Set_RGB_AV_pack:							'Set mode 000 RGB AV
	
	low B.1, B.2, B.3
	
	goto Xbox_reset_Check
	
	
Xbox_reset_Check:
	if pinC.3=1 then						'If Xbox is reset restart pack check

		goto Start
	end if

	goto Xbox_reset_Check


#no_data	'reduce download time
 
Top