Has anyone heard of something like this?

booski

Senior Member
I've had an idea for a potential project for my college work and I'd like to stick to using just an 08M if I can (cause its all I've got apart from an 18M2)

Potentially, I wish to control 4+ relays for mains switching however, I Want to use as few pins on an 08M as possible, so what im essentially requesting is:

Is there a chip which, using a serial interface of some sort has selectable, latchable outputs?

i.e. picaxe tells chip using some sort of interface bus, to select output 1 to 'on' and it latches that way.

Thoughts?
 

Haku

Senior Member
Yes, shift registers such as the 74HC595, but they usually require the use of 3 connections from a Picaxe to work.

How many inputs & outputs does your project need?

edit: BTW the 08m doesn't have i2c so can't use those port expanders
 
Last edited:

booski

Senior Member
Well, I need an input for IR, outputs to a counter for a 7 segment display, and outputs to a relay selection so potentially 6+ outputs and 1 input if I don't include button control.
 

booski

Senior Member
A two to four line decoder will get you four outputs out of two:
http://en.wikipedia.org/wiki/Decoder
Wouldn't work because the outputs would have to be individually selectable and not rely on and/or gates, so you can have output 1 and 3 on, or 1 2 3 and 4, or just 4 etc.

EDIT:

Following on from the port expander, come across this:

http://www.maxim-ic.com/datasheet/index.mvp/id/3376

Looks pretty interesting and only 2 wire, so can be done using the shiftout command (I think)
 
Last edited:

MFB

Senior Member
If you want to safely control a number of high voltage channels, why not use the 08M to send IR commands to a low cost remote control mains block?
 

booski

Senior Member
because that is the project ;)

The project idea is to build a mains block with individually selectable switchable sockets.
 

Haku

Senior Member
eclectic has the right idea, you could drive the 7 segment LED display directly from the 18m2, simplifying the circuit and the code.

Plus you'd have enough pins leftover to incorporate 4 buttons for control of the relays if you don't have the remote control to hand.
 

booski

Senior Member
been looking into this a little more, with regards to the relay driver.

got some (hopefully) TPIC6C595 and TPIC6B595N and ULN2803AN transistor arrays coming as free samples from TI.

I'm hoping to use the 18m2 to control the 8 bit shift registers for around 4+ relays and at the same time, possibly use the transistor arrays to sink the relay current.

Good idea perhaps?
 

SAborn

Senior Member
In many ways he is going about this backwards as by the time he adds all the extra components to expand the I/O's he would be far cheaper and simpler to just buy a 20x2 with all the bells and whistles and use that.
 

westaust55

Moderator
Notwithstanding the validity of SAborns comments,
Another option is the MCP23017 i2c IO expander with two 8-bit bidirectional ports so a total of 16 IO for just 2 PICAXE pins.
Others have posted some bit bang 08M i2c code.
 

booski

Senior Member
I've ordered some MCP23017's which look nice, however, in the meantime my TPIC6C595 have turned up and I have since used this code
Code:
symbol SRCK = 0	
symbol MOSI = 1	
symbol RCK = 2 	




symbol counter = b7	' variable used during loop
symbol var_out = W0	' data variable used during shiftout
symbol bits = 8		' number of bits



symbol dataout = B0	' data to transmit




low SRCK		 
low MOSI	
low RCK			


Main:

if pin3 = 1 then let B0 = %11111111
 
else B0 = %00000000
endif

gosub shiftout

goto main

shiftout:
	for counter = 1 to bits
		if bit7 = 1 then   	' as data if shifted, if its a 1 it stays high, else goes low
			high MOSI 
		else
			low MOSI				
		endif
		pulsout SRCK,1 		' pulse clockpin for 10us 
		var_out = var_out * 2 		' shift variable left for MSB 
	next counter
	pulsout RCK,1
	return
to interface an 08M with it, a press button and led to test and it works nicely, so seeing as it works, I might stick with it. But I'll have a further think about it

I will likely end up using and 18M2 and either use a shift register (3pins) OR transistor array (4pins minimum) to sink the relay current.
 
Top