.

QuickBuilder
for Microchip PICs

Home - About- Consulting* - Articles - FAQs - Contact
Tour - Application Example - Sub circuits - Projects - Download
Sub-circuits: Miscellaneous

A Sub-circuit is a stand alone circuit function consisting of a software module and schematic.

 

I2C card reader (ST14C02)

Description
I2C smart card reader based on the ST Microelectronics ST14C02 I2C memory smart card and equivalents. This sub-circuit utilises the Molex 91322-0004 smart card socket as the physical interface to the card. Use is made of the card detection switch contacts to apply power to the card through a current (approx. 50mA) limiting resistor. Series resistors to the SDA and SCL line limit I/O current to approx. 5mA.

Software functions

int ST1402_READ( int address )
    Read and return data from address.

void ST1402_WRITE( int address,int data )
    Write data to address.

int ST1402_PRESENT( void )
    Returns card presence state 0=absent, 1=present


Example: Read 16-bytes of card data

    if (ST1402_PRESENT()) {
        for (i=0 ; i<16 ; i++)
            CardData[i] = ST1402_READ(i);
    }

Schematic

Projects
This sub-circuit is demonstrated in the following project:

 

I2C real time clock (PCF8593)

Description
Real time clock based on the PCF8593 with battery backup.

Software functions

void PCF8593_ENABLE( BYTE state )
    Stop or start the clock according 
to state as follows:
0=off, 1=on.

void PCF8593_SETTIME(BYTE item, value)
    Set value of clock item. See table 1.

BYTE PCF8593_GETTIME(BYTE item)
    Get clock item. See table 1.

BYTE PCF8593_READ(int addr)
    Reads data from addr. Consult PCF8593 
data sheet.

void PCF8593_WRITE(BYTE addr,BYTE data)
    Write data to addr. Consult PCF8593 
data sheet.

Schematic

 

 

Stepper motor MOSFET drive

Description
Stepper motor driver for uniphase stepper motors. Three stepper modes: half, full hi-torque, full lo-torque. Call SETP_DO() at regular intervals, set STEP_STEPS to move stepper motor.

 

Software functions

STEP_DO()    : stepper motor drive state machine. Call at
regular intervals e.g from timer tick interrupt service
routine every 1ms.

STEP_STEPS : 16bit variable for setting the number steps the stepper motor is to move by, also indicates the number of steps to complete. The motor can be stopped at anytime by setting this variable to zero.

STEP_DIR : 8bit variable for setting the direction of
rotation. 0=clockwise(default),-1=anticlock.

STEP_SPEEDT : 8bit variable for setting the speed of the
stepper motor by setting the length of time in ticks between
steps (default 100). Eg if STEP_DO() is called every 1ms, a
value of 100 would cause a step change every 100ms.

STEP_MODE : 0=half step(default), 1=full step hi torque, 2=full step low torque.

Example: Move clockwise 20 steps. This example assumes
STEP_DO() is called at regular intervals by a timer interrupt routine.
STEP_MODE = 1; // single step, hi-torque
STEP_DIR = 0; // rotate right
STEP_STEPS = 20; // 20 steps
while( STEP_STEPS ); // wait until steps complete

Schematic

 

 

4-bit port

Description
4-bit port built from individual port bits

Software functions

PORT4BIT_READ()  : returns value of 4 bit port
PORT4BIT_WRITE() : write value to 4 bit port

Schematic

Similar sub-circuits:

  • 1-bit port
  • 2-bit port
  • 3-bit port
 

Piezo sounder (4 tones)

Description
Audio tone generator with tones SOUND_BEEP, SOUND_BLIP and SOUND_BUZ. Use SOUND_REPEAT to set the number of times the sound is repeated.

Software functions

SOUND_ENV(count, halft) : produces train 
of count pulses with a period of 2*halft
(units of microsecconds)

SOUND_BEEP() : ~1Khz tone for 250
cycles

SOUND_BLIP() : ~1khz tone for 10 cycles
followed by 10ms pause

SOUND_BUZ() : ~400hz for 4 cycles followed
by 10ms pauses repeated 14 times

SOUND_REPEAT : set this variable to specify
how many times the sound is played. Does
not appy to SOUND_ENV()

Schematic

 

LTC1286 12-bit A-D

Description
LTC1286 12bit analogue to digital convertor

Software functions

LTC1286_READ() : return 12bit result

Schematic

 

Relay 12V SP

Description
12V single pole relay transistor driven

Software functions

RL_STATE()       : returns switch state: 0=de
energised, 1=energised

RL_SET( state ) : set relay state: 0=de-energise
energised

Schematic

 
Copyright 2002-2009 Summit Electronics Ltd
www.quickbuilder.co.uk