FRIENDz

FAILURE IS THE SIGN OF SUCCESS!!

Connect Transmitter Receiver module with 8051 code

The mikroC PRO for 8051 provides a library for handling Manchester coded signals. The Manchester code is a code in which data and clock signals are combined to form a single self-synchronizing data stream; each encoded bit contains a transition at the midpoint of a bit period, the direction of transition determines whether the bit is 0 or 1; the second half is the true bit value and the first half is the complement of the true bit value .

Notes:
  • The Manchester receive routines are blocking calls (Man_Receive_Init and Man_Synchro). This means that MCU will wait until the task has been performed (e.g. byte is received, synchronization achieved, etc).
  • Manchester code library implements time-based activities, so interrupts need to be disabled when using it.

Connect Keypad with 8051 code

The mikroC PRO for 8051 provides a library for working with 4x4 keypad. The library routines can also be used with 4x1, 4x2, or 4x3 keypad. For connections explanation see schematic at the bottom of this page.
Note: Since sampling lines for 8051 MCUs are activated by logical zero Keypad Library can not be used with hardwares that have protective diodes connected with anode to MCU side, such as mikroElektronika's Keypad extra board HW.Rev v1.20
External dependencies of Keypad Library
The following variable must be defined in all projects using Keypad Library:
Description:
Example :
extern sfr char keypadPort;
Keypad Port.
char keypadPort at P0;
Library Routines
  • Keypad_Init
  • Keypad_Key_Press
  • Keypad_Key_Click

Connect CAN Protocol with 8051 Atmel

The SPI module is available with a number of the 8051 compliant MCUs. The mikroC PRO for 8051 provides a library (driver) for working with mikroElektronika's CANSPI Add-on boards (with MCP2515 or MCP2510) via SPI interface.
The CAN is a very robust protocol that has error detection and signalization, selfchecking and fault confinement. Faulty CAN data and remote frames are re-transmitted automatically, similar to the Ethernet.
Data transfer rates depend on distance. For example, 1 Mbit/s can be achieved at network lengths below 40m while 250 Kbit/s can be achieved at network lengths below 250m. The greater distance the lower maximum bitrate that can be achieved. The lowest bitrate defined by the standard is 200Kbit/s. Cables used are shielded twisted pairs.
CAN supports two message formats:
  • Standard format, with 11 identifier bits and
  • Extended format, with 29 identifier bits
Notes:
  • Consult the CAN standard about CAN bus termination resistance.
  • An effective CANSPI communication speed depends on SPI and certainly is slower than “real” CAN.
  • CANSPI module refers to mikroElektronika's CANSPI Add-on board connected to SPI module of MCU.

Connect ADC with 8051 Code

ADC (Analog to Digital Converter) module is available with a number of MCUs. Library routines are included to provide you comfortable work with the module in single-ended mode.

Library Routines

  • ADCx_Init
  • ADCx_Init_Advanced
  • ADCx_Get_Sample
Notes:
  • Some of the MCUs do not support ADCx_Init_Advanced routine. Please, refer to the appropriate datasheet.
  • ADC routines require you to specify the module you want to use. To select the desired module, simply change the letter x in the prototype for a number from 1 to 3
    Number of ADC modules per MCU differs from chip to chip. Please, read the appropriate datasheet before utilizing this library.

Extend I/O Ports using PIC

The mikroC PRO for PIC provides a library for communication with the Microchip’s Port Expander MCP23S17 via SPI interface. Connections of the PIC compliant MCU and MCP23S17 is given on the schematic at the bottom of this page.
  Important :
  • The library uses the SPI module for communication. User must initialize the appropriate SPI module before using the Port Expander Library.
  • Library does not use Port Expander interrupts.

External dependencies of Port Expander Library

The following variables must be defined in all projects using Port Expander Library: Description : Example :
extern sfr sbit SPExpanderRST; Reset line. sbit SPExpanderRST at RC0_bit;
extern sfr sbit SPExpanderCS; Chip Select line. sbit SPExpanderCS at RC1_bit;
extern sfr sbit SPExpanderRST_Direction; Direction of the Reset pin. sbit SPExpanderRST_Direction at TRISC0_bit;
extern sfr sbit SPExpanderCS_Direction; Direction of the Chip Select pin. sbit SPExpanderCS_Direction at TRISC1_bit;

Connect Memory Card using PIC18F4520 Code

The Multi Media Card (MMC) is a Flash memory card standard. MMC cards are currently available in sizes up to and including 32 GB and are used in cellular phones, digital audio players, digital cameras and PDA’s.
mikroC PRO for PIC provides a library for accessing data on Multi Media Card via SPI communication. This library also supports SD (Secure Digital) and high capacity SDHC (Secure Digital High Capacity) memory cards .

Secure Digital Card

Secure Digital (SD) is a Flash memory card standard, based on the older Multi Media Card (MMC) format.
SD cards are currently available in sizes of up to and including 2 GB, and are used in digital cameras, digital camcorders, handheld computers, media players, mobile phones, GPS receivers, video games and PDAs.

Create Musical Tone using PIC Code

The mikroC PRO for PIC provides a Sound Library to supply users with routines necessary for sound signalization in their applications. Sound generation needs additional hardware, such as piezo-speaker (example of piezo-speaker interface is given on the schematic at the bottom of this page).

Library Routines

  • Sound_Init
  • Sound_Play

Sound_Init

Prototype void Sound_Init(char *snd_port, char snd_pin);
Returns Nothing.
Description Configures the appropriate MCU pin for sound generation.
Parameters :
  • snd_port: sound output port address
  • snd_pin: sound output pin