cancel
Showing results for 
Search instead for 
Did you mean: 

I/O expansion

fggnrc
Associate II
Posted on April 19, 2005 at 10:30

I/O expansion

2 REPLIES 2
fggnrc
Associate II
Posted on April 08, 2005 at 09:58

I use a ST7FLITE29 micro in my application.

Now I am planning to add a temperature sensor according to AN1755 ''A HIGH PRECISION/RESOLUTION THERMOMETER USING ST7 AND NE555''.

Unfortunately I have no I/O pin for it, so I need to expand the number of outputs.

Here is my pin usage:

PA0: Lite Input Capture (mains zero cross detection and RC calibration - see AN 1324)

PA1: drives a LED

PA2: output 1 (digital or PWM)

PA3: output 2 (digital or PWM)

PA4: output 3 (digital or PWM)

PA5: output 4 (digital or PWM)

PA6: push-button input

PA7: drives a LED

PB0: Analog key-press detection (see AN 979)

PB1: input 1 (digital or analog)

PB2: input 2 (digital or analog)

PB3: input 3 (digital or analog)

PB4: input 4 (digital or analog)

PB5: RS485 Driver or Receiver enable

PB6: RS485 data

I could use the input capture function associated to PA1, but I have to give up an high sink output which drives a led.

I have to expand the outputs to drive two leds with only a pin (PA7).

I found a solution: a M74HC161 (syncronous 4-bit counter with asyncronous clear) and some wiring.

The clear pin of M74HC161 is wired to ST7FLITE29 reset.

The clock pin of M74HC161 is wired to PA7.

The data-in pins of M74HC161 are pulled down to GND.

The load pin of M74HC161 is wired to the zero crossing detector (PA0).

The count enable pins of M74HC161 are pulled up.

The ouputs of M74HC161 drive the leds (up to four).

This circuit should work in the following way:

whenever a zero-crossing happens, the M74HC161 loads 0 when it receives the first pulse from PA7.

Then it counts the PA7 pulses.

By sending the right number of pulses after each zero-cross, it would be possible to light the leds up.

Is there a better (and cheaper) way to do the same thing?

I could obviously use a mid-range ST7 micro, but it would probably be more expensive.

Any suggestion is welcomed...

Regards,

EtaPhi

BTW:

The new ST7FLITE1xB family shows that I/O shortage is an issue.

It is strange that no B-step exists for the ST7FLITE2x family...

fggnrc
Associate II
Posted on April 19, 2005 at 10:30

I have found a better way to expand the number of I/O.

My previuous solution has the following cons:

- the number of pulses grows exponentially. Therefore it can be used for at most 4 outputs (i.e. 15 pulses).

- it needs an external signal (e.g. the zero-crossing pulse from a detector) to reset the counter value.

- it is a bit complex to implement in software

It has also the following pros:

- it needs no syncronization between the sender (ST7FLITE29) and the receiver (M74HC161)

- it needs only an I/O pin

My new solution is simpler. It uses a two-wire interface (Clock + Data) like the traditional trick of expanding the outputs by a standard shift register (74HC164).

This does not contrast to the number of available pins.

I missed the fact that one pin (PA6 in my application) can be changed from input to output when the input/output circuits are decoupled by a 4.7 K resistor, like it happens with the In-Circuit-Debugging.

Now the number of outputs is no more an issue for my application, since shift registers can be cascaded.