ior5e.h File Reference

This module contains the defintions for the IOR5E booard from modtronix. More...

#include "dev.h"

Go to the source code of this file.

Defines

#define RLY1   23
 address all replays
#define RLY2   22
#define RLY3   21
#define RLY4   20
#define RLY5   19
#define RLY_NC3   18
#define RLY_NC2   17
#define RLY_NC1   16
#define LD5_A   15
 address all LEDS
#define LD5_B   14
#define LD6_A   13
#define LD6_B   12
#define LD7_A   11
#define LD7_B   10
#define LD8_A   9
#define LD8_B   8
#define LD1_A   7
#define LD1_B   6
#define LD2_A   5
#define LD2_B   4
#define LD3_A   3
#define LD3_B   2
#define LD4_A   1
#define LD4_B   0
#define LED_PWR   LD1_A
#define I2C_RTC   0x68
 address of the real time clock

Typedefs

typedef byte(* t_portb_handler )(byte)
 A Handler function.

Functions

void IOR_Update (void)
 Update the IOR board.
void LED_On (unsigned nbr)
 Turn an led on.
void LED_Off (unsigned nbr)
 Turn an led off.
void Set_LEDS (unsigned p)
 set all leds.
void Relay_On (unsigned nbr)
 Turn a realy on.
void Relay_Off (unsigned nbr)
 Turn a relay off.
void get_time (byte *h, byte *m, byte *s)
 get the current time from the real time clock.
void get_date (byte *y, byte *m, byte *d)
 get the date

Variables

t_portb_handler portb_interrupt
__code t_dev output_handler
 device handler for output hardware like led's and relays.
__code t_dev portb_handler
 device handler for the input port


Detailed Description

This module contains the defintions for the IOR5E booard from modtronix.

The IO borad provides 16 LED's, 5 relays, digital io's and analog inputs and an onboard realtime clock with backup battery.

Electrical interfaces

On the front panel of the module you find the following
          LED Array                IO Ports
         1 2 3 4 5 6 7 9      Analog in       Relay
      B  X X X X X X X X      1 2 3 4 5      1 2 3 4
      A  X X X X X X X X     \---------/    \-------/
                                  X5            X1
In order to address the led array, use the defintions LDx_y to address the led. x=1..8 addresses the led 1..8 and A is the lower row and B selects the upper row of LED's.

The relays are addressed by the definitions RLYx where x=1,2,3,4.

The board is self is connected via the I2C bus and the port A, B, C to the main board. LED's and relays are controlled via a shift register which is connected to port C.

Port utilization

Port A is utilized as shown below:
  Bit  0  1  2  3  4  5    6  7
  X5   3  4  5  6  8  7
      \----------------/
          Analog in
The PORTB is utilized as shown below:
  Port B:

  Bit  0   1    2   3   4     5      6   7
      SDA SCL  5/6 7/8 9/10 11/12   LED RST
     \------/ \------------------/ \-------/
       I2C      IOR5e X2 connector  SBC44UC
                   Input           Outp/Inp.

Port C is used ot control the 74HC595 shitf register which is used to control the Relays and the LED's. There components are controlled via a shift register. Port C is used to generate the input for the shift registers.

  Port C:

  Bit  0   1    2     3   4    5    6    7
      DS SH_CP ST_CP                   NOT_OE
The actual transmission of data is done by the procedure IOR_Update. It always sends a 24 bits bit train by pusling DS and SH_CP via software. At the end of the transmission the ST_CP pulse is generated to take over the actual data.

The ior5e module maintains an internal view of the status for each bit in the shift register, which means calling the method LED_On sets only the bit in the internal view. Only the Update_IOR method does the actual transmission to the IOR5e board.

Realtime clock

The IOR5E board contains a battery backed up realtime clock which is accessed via the i2c interface. If you intend to access the RTC you need also to initialize the i2c interface in your application init.

Trace facilities

The module trace.c implements the interface trace.h, which means the different kernel indications are mapped on the 16 LED's of the ior5e board.

     LDx_B  1   2   3   4   5   6   7   8
            X   X   X   X   X   X   X   X  <-- used by application
           PWR IDL ERR  N   N   N   N   N  <-- used by kernel

 PWR (Power) - Power on reset done
 IDL (Alive) - Flashing activity indication of the idle task
 ERR (Process_Error) - Watchdog reset occured.

Definition in file ior5e.h.


Function Documentation

void get_time byte h,
byte m,
byte s
 

get the current time from the real time clock.

Parameters:
h pointer to hours
m pointer to minutes
s pointer to seconds

void IOR_Update void   ) 
 

Update the IOR board.

This message updates all LED and Relay bits according the the latest status.

void LED_Off unsigned  nbr  ) 
 

Turn an led off.

Parameters:
nbr indicates the led.

void LED_On unsigned  nbr  ) 
 

Turn an led on.

Parameters:
nbr indicates one of the 16 led's on the IOR 4e board.
Note:
please note that only the call to IOR_Update actually turns on the led.

void Relay_Off unsigned  nbr  ) 
 

Turn a relay off.

IOR_Update needs to be called in order to update the hardware.

Parameters:
nbr indicates the relay. Use the definition RLYx to address the correct relay.

void Relay_On unsigned  nbr  ) 
 

Turn a realy on.

IOR Update is needed to update the hardware.

Parameters:
nbr indicates the relay. Use the definition RLYx to address the correct relay.


Generated on Mon Sep 29 19:56:48 2008 for mKernel by  doxygen 1.4.6