ROBOT Electronics

http://www.robot-electronics.co.uk

robot1.gif (8205 bytes)¡¡

ÃÊÀ½ÆÄ °Å¸® °èÃø ¸ðµâ SRF ½Ã¸®Áî

¡¡

SRF-01

½Ã¸®¾ó ÀÎÅÍÆäÀ̽º(TTL ·¹º§ 9600BPS ) Áö¿ø ÃÊÀ½ÆÄ ¸ðµâ

Voltage - 3.3v to 12v
Current - 25mA Ranging. 11mA Standby. 55uA Sleep.
Frequency - 40KHz
Range - 18cm to 600cm (Industrial spec', no calibration required).
Range - 0cm to 600cm (Hobby spec' after auto-calibration).
Connection - One Pin Serial Bus @ 9600 baud.
Up to 16 SRF01's connected to a single pin on your controller.
Units - Range reported in cm or inches.
Very light weight, just 2.7gm

Supplied with Mounting Grommet.
¡¡

SRF-01 Àº 3.3V ·Î µ¿ÀÛ °¡´ÉÇÑ ÃÊÀ½ÆÄ ¸ðµâÀÔ´Ï´Ù. ½Ã¸®¾ó ·Î µ¥ÀÌÅ͸¦ Ãâ·ÂÇÕ´Ï´Ù. ±âº» Åë½Å ¼Óµµ´Â 9600 BPS ÀÔ´Ï´Ù.

¡¡

SRF02

½Ã¸®¾ó ÀÎÅÍÆäÀ̽º(TTL ·¹º§) / I2C ÃÊÀ½ÆÄ ¸ðµâ

SERIAL ÀÎÅÍÆäÀ̽º ¸ðµå : Mode Pin -> 0V(GND)

±â¼ú »ç¾ç: http://www.robot-electronics.co.uk/htm/srf02techSer.htm

I2C ÀÎÅÍÆäÀ̽º ¸ðµå : Mode Pin -> Open(¿¬°áÇÏÁö ¾ÊÀ½/³»ºÎ Pull-up)

±â¼ú »ç¾ç: http://www.robot-electronics.co.uk/htm/srf02techI2C.htm

SRF-02 ´Â ½Ã¸®¾ó ÀÎÅÍÆäÀ̽º¿Í I2C ÀÎÅÍÆäÀ̽º¸¦ Áö¿øÇÕ´Ï´Ù. 

¡¡

SRF04 ÃÊÀ½ÆÄ ¸ðµâ

·Îº¸Æ½½º ¾÷°è Ç¥ÁØ ÃÊÀ½ÆÄ ¼¾¼­

srf_conect.jpg (33195 bytes)

SRF04 ÀÀ¿ë ¿¹Á¦ ÇÁ·Î±×·¥

main.c

SRF-04 ´Â Æ®¸®°Å ÆÞ½º¸¦ ÀÔ·ÂÇÏ¸é °Å¸®¿¡ µû¸¥ ÆÞ½º ÆøÀÌ Ãâ·ÂµË´Ï´Ù. ¸¶ÀÌÅ©·Î ÇÁ·Î¼¼¼­¿¡¼­ ŸÀ̸ӱâ´ÉÀ» ÀÌ¿ëÇÏ¿© ÆÞ½ºÆø ½Ã°£À» ÃøÁ¤ÇÑÈÄ °Å¸®·Î ȯ»êÇÕ´Ï´Ù. SRF-05 ¿¡ ºñÇÏ¿© ÃÊÀ½ÆÄ À½¾ÐÃâ·ÂÀÌ ³ô½À´Ï´Ù. 

¡¡

SRF05 ÃÊÀ½ÆÄ ¸ðµâ

http://www.robot-electronics.co.uk/htm/srf05tech.htm

SRF-05 ´Â Æ®¸®°Å ÆÞ½º ÀÔ·ÂbÈÄ °Å¸®¿¡ ºñ·ÊÇÑ ÆÞ½º¸¦ Ãâ·ÂÇÕ´Ï´Ù. SRF-04 ¿Í ½ÅÈ£ ȣȯµË´Ï´Ù. ¸¶ÀÌÅ©·Î ÇÁ·Î¼¼¼­ Æ÷Æ® ÇÉ 1 °³·Î µ¿ÀÛÇÒ ¼ö ÀÖµµ·Ï ¼³°èµÇ¾î ÀÖ¾î µô·¹ÀÌ ·çÇÁ¿¡ ÀÇÇÑ °£´ÜÇÑ °Å¸® ÃøÁ¤ ½Ã Æí¸®ÇÏ°Ô »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. 

¡¡

SRF06 ÃÊÀ½ÆÄ ¸ðµâ

4 ~ 20mA Àü·ù Ãâ·ÂÇü

* 70 mS ~ 100mS ÁÖ±â·Î ¿¬¼Ó ÃøÁ¤ÇÕ´Ï´Ù. (¿ÜºÎ Æ®¸®°Å ¾øÀ½)
* Áֱ⠴ÜÀ§·Î 0.5V ÀÇ ³ëÀÌÁî ÆÞ½º°¡ ³ª¿É´Ï´Ù. 2.2uF ¿¡¼­ 10uF ÀÇ Ä³ÆнÃÅ͸¦
   ÀúÇ×°ú º´¿­ ¿¬°áÇÏ¿© ³ëÀÌÁ Á¦°ÅÇÕ´Ï´Ù. 

* ´ÜÀÚ´ë 2°³¸¸ »ç¿ëÇÕ´Ï´Ù. +12V »ç¿ëÀ» ±ÇÀåÇÕ´Ï´Ù. (»ç¿ë¹üÀ§ 9V ~ 24V)
* ¿øÂÊÀÇ 5 °³ÀÇ ½º·çȦÀº ³»ºÎ ÇÁ·Î¼¼¼­ ÇÁ·Î±×·¥¿ëÀÔ´Ï´Ù. »ç¿ëÇÏÁö ¾Ê½À´Ï´Ù.
* ÀúÇ× 250 Ohm 1/2W ¿Í ¸ð³ë¸®µñ ijÆнÃÅÍ 4.7uF °¡ Æ÷ÇԵ˴ϴÙ.
Âü°íÀÚ·á:
http://www.robot-electronics.co.uk/htm/srf06tech.htm

¡¡

SRF08 ÃÊÀ½ÆÄ ¸ðµâ

SRF08Àº I2C ÀÎÅÍÆäÀ̽º ¹æ½ÄÀ» »ç¿ëÇÏ¿© CPU ¿Í ¿¬°áÇÕ´Ï´Ù.
Ãâ·Â µ¥ÀÌÅÍ ÇüÅ´ CM, Inch, Time ÀÇ 3 Á¾·ù°¡ °¡´ÉÇÕ´Ï´Ù.

srf08con.jpg (16356 bytes)

SRF-08 Àº I2C ÀÎÅÍÆäÀ̽º¸¦ Áö¿øÇÕ´Ï´Ù. ÀÎÄ¡, ¼¾Ä¡, ¸¶ÀÌÅ©·Î ¼¼Ä¿µå ÀÇ 3 °¡Áö Á¾·ù·Î Ãâ·Â µ¥ÀÌÅÍ Çü½ÄÀ» ¼±ÅÃÇÒ ¼ö ÀÖ½À´Ï´Ù.

¡¡

¡¡

SRF10 ÃÊÀ½ÆÄ ¸ðµâ

http://www.robot-electronics.co.uk/htm/srf10tech.htm

ºê¶óŶ ¼¼Æ®´Â ¼±Åà »çÇ× Ç°¸ñÀÔ´Ï´Ù. ¼­º¸ ¸ðÅÍ È¸ÀüÆÇ¿¡ ¿¬°á ½Ã »ç¿ëÇÕ´Ï´Ù.

SRF-10 Àº I2C ÀÎÅÍÆäÀ̽º¸¦ Áö¿øÇÕ´Ï´Ù. ÀÎÄ¡, ¼¾Ä¡, ¸¶ÀÌÅ©·Î ¼¼Ä¿µå ÀÇ 3 °¡Áö Á¾·ù·Î Ãâ·Â µ¥ÀÌÅÍ Çü½ÄÀ» ¼±ÅÃÇÒ ¼ö ÀÖ½À´Ï´Ù.

¡¡

SRF235 ÃÊÀ½ÆÄ ¸ðµâ

http://www.robot-electronics.co.uk/htm/srf235tech.htm

SRF-235 Àº I2C ÀÎÅÍÆäÀ̽º¸¦ Áö¿øÇÕ´Ï´Ù. ÀÎÄ¡, ¼¾Ä¡, ¸¶ÀÌÅ©·Î ¼¼Ä¿µå ÀÇ 3 °¡Áö Á¾·ù·Î Ãâ·Â µ¥ÀÌÅÍ Çü½ÄÀ» ¼±ÅÃÇÒ ¼ö ÀÖ½À´Ï´Ù. SRF-235 ´Â 235 KHz ÀÇ ³ôÀº ÃÊÀ½ÆÄ ÁÖÆļö¸¦ »ç¿ëÇÕ´Ï´Ù. ½Ç¿ë»ó ÃøÁ¤ °Å¸®´Â ÃÖ´ë 30 cm À̳» ÀÔ´Ï´Ù. ÃøÁ¤ ¹°Ã¼°¡ Æò¸éÀ̾î¾ß Çϸç ÃÊÀ½ÆÄ ÁøÇà ¹æÇâ°ú Á¤È®ÇÑ Á÷°¢ »óŸ¦ À¯Áö ÇÏ¿©¾ß ÇÕ´Ï´Ù. SRF-235 ´Â 0.5mm ´ÜÀ§ÀÇ Á¤¹ÐÇÑ À§Ä¡ µ¥ÀÌÅÍ ÃøÁ¤ÀÌ °¡´ÉÇÕ´Ï´Ù.

¡¡

¡¡

SRF485 ÃÊÀ½ÆÄ ¸ðµâ

http://www.robot-electronics.co.uk/htm/srf485tech.htm

SRF485 Å×½ºÆ® ÇÁ·Î±×·¥

SRF48.ZIP : ¾ÐÃàÀ» ÇØÁöÇÏ°í Release Æú´õÀÇ SRF48.exe ¸¦ ½ÇÇàÇÕ´Ï´Ù.

PC ¿Í UBS-485 ¸¦ ¿¬°áÇÏ¿© 4 °³ÀÇ SRF-485¸¦ ±¸µ¿ÇÑ ¿¹ÀÔ´Ï´Ù.

Voltage - 8v to 24v
Current - 10mA
Frequency - 40KHz
Range - 30cm to 500cm
Connection - Standard RS485 Bus
Up to 127 SRF485's connected to your controller.
Units - Range reported in uS, cm or inches.
Temperature Compensation -30 to +50 centigrade
SRF-485 ´Â RS-485 ÀÎÅÍÆäÀ̽º¸¦ »ç¿ëÇϸç 127 °³ ±îÁö
ÃÊÀ½ÆÄ ³×Æ®¿÷ ±¸¼ºÀÌ °¡´ÉÇÕ´Ï´Ù. 

¡¡

USB-RS485

SRF-485 ¸¦ PC ¿Í ¿¬°áÇÒ ¶§ »ç¿ëÇÕ´Ï´Ù.

¡¡

USB-I2C


SRF-02, SRF-08, SRF-10, SRF-235 ¿Í ¿¬°áÇÏ´Â ÄÉÀ̺íÀÌ Æ÷ÇԵ˴ϴÙ.

Á¦Á¶»ç »ç¿ë ¼³¸í¼­ ¿ø¹®

http://www.robot-electronics.co.uk/htm/usb_i2c_tech.htm

¡¡

¡¡

SRF-02, SRF-08, SRF-10, SRF235 ¿Í °°ÀÌ I2C ÀÎÅÍÆäÀ̽º¸¦ »ç¿ëÇϴ 
ÃÊÀ½ÆÄ ¸ðµâÀ» PC ¿Í ¿¬°áÇÕ´Ï´Ù.

µå¶óÀ̹ö ÇÁ·Î±×·¥ (ŸÀÌƲ¿¡ SRF08 ·Î Ç¥½ÃµÇ¾î ÀÖÀ¸³ª SRF02, SRF10, SRF235 ÀüºÎ »ç¿ëµË´Ï´Ù. Light ´Â SRF-08 ¿¡ ±¤¼¾¼­ µ¥ÀÌÅÍ °ªÀÔ´Ï´Ù. ´Ù¸¥ ¸ðµ¨¿¡¼­´Â Àû¿ëµÇÁö ¾Ê½À´Ï´Ù.

¾Æ·¡ÀÇ »çÁøÀ» Âü°íÇÏ¿© Á¤È®È÷ °á¼±µÇ¾î ÀÖ´ÂÁö È®ÀÎÇϽñ⠹ٶø´Ï´Ù.

¸ðµç °ÍÀÌ Á¤»óÀ̸é ÃÊÀ½ÆÄ ¼¾¼­¿¡ ºÎÂøµÈ Àû»ö LED °¡ ÃÊ´ç ¼öȸ ¹Ý¦ÀÔ´Ï´Ù.

¹è¼±ÀÇ »ö»ó ¼ø¼­¸¦ ÀÓÀÇ·Î ÇÏÁö ¸¶½Ã°í »çÁø°ú
 °°ÀÌ ¼ø¼­¿Í ¹æÇâÀ» ÀÏÄ¡½ÃÄÑ¾ß ½Ç¼ö·Î ¼¾¼­¸¦ 
ÆļÕÇÏ´Â °¡´É¼ºÀÌ ³·¾ÆÁý´Ï´Ù. 

USB_I2C_SRF08.exe

C Source Program

¡¡

¡¡

¡¡

SRF-02, SRF-08, SRF-10, SRF-235 ¿¡¼­ »ç¿ëÇÏ´Â I2C ÇÁ·ÎÅäÄÝ ÀÎÅÍÆäÀ̽º ¿¹Á¦

/*************************************************************************
* *
* Devanteck SRF Series ULTRA SONIC SENSOR Module Demonstration Program *
* *
* SRF-02 *
* SRF-08 *
* SRF-10 *
* SRF-235 *
* SENSCOMP Series *
* *
* Witten by Junghoon Kim *
* *
* (c) SAMPLE Electronics co. 09 March 2004 *
* *
*+---------------------------------------------------------------------+*
*|Speed Of Sound |*
*| |*
*|The speed of sound at 20 deg is 343.2 m/s(1125 ft/s). It varies only |*
*|slightly with humidity (max. 0.35% at 20 deg C) and is virtually |*
*|independent of pressure and, thus, of height above sea level. |*
*| |*
*|Only temperature has some influence:331.3 m/s at 0 deg C , 347.7 m/s |*
*|at 40 deg C; i.e., 7% variation from 0 deg to 40 deg. Variation |*
*|with frequency is negligible. |*
*| |*
*| ----- POLAROID ULTRASONIC RANGING SYSTEM HANDBOOK ----- |*
*| APPLICATION NOTES/TECHNICAL PAPERS |*
*+---------------------------------------------------------------------+*
* *
* *
* *
* $Rxx<CR> Requst Ranging Data *
* $050<CR> Ranging Mode - Results in inches *
* $051<CR> Ranging Mode - Results in centimeters *
* $052<CR> Ranging Mode - Results in micro-seconds *
* $053<CR> ANN Mode - Results in inches *
* $054<CR> ANN Mode - Results in centimeters *
* $055<CR> ANN Mode - Results in micro-seconds *
* $1xx<CR> Set Gain Register *
* $2xx<CR> Set Range Register *
* $6xx<CR> Set Denumerator Constant in mili meter display *
* $7xx<CR> Set Numerator Constant in mili meter display *
* $8xx<CR> Set SRF-xx Base Address *
* $9xx<CR> Change I2C Address *
* *
* *
* *
* (1) If SMOD == 0 *
* (CLOCK) *
* TH1 = 256 - -------------- *
* (384 x BAUD) *
* *
* (2) If SMOD == 1 *
* (CLOCK) *
* TH1 = 256 - -------------- *
* (192 x BAUD) *
* *
* *
* ex) Xtal Frequency = 12MHz, Baud Rate = 4800 Bps -> TH1 = 0xF3 *
* *
* *
* SIG - Signal Type *
* P2.7 *
* 0 : I2C Bus Type - SRF-02, SRF-08, SRF-10, SRF-235 *
* 1 : Pulse Width Type - SRF-04, SRF-05, SENSCOMP *
* *
* DU - Display Mode *
* P2.6 P2.5 *
* 0 0 : Micro Second Display *
* 0 1 : Milli Meter Display *
* 1 0 : Inches Display *
* 1 1 : Centi Meter Display *
* *
* --- Conversion and Display Mode --- *
* SIG DU1 DU0 *
* 0 0 0 : Non Conversion Micro Second Display I2C Bus *
* 0 0 1 : Conversion Milli Meter Display I2C Bus *
* 0 1 0 : Non Conversion Inches Display I2C Bus *
* 0 1 1 : Non Conversion Centi Meter Display I2C Bus *
* 1 0 0 : Non Conversion Micro Second Display Pulse Width *
* 1 0 1 : Conversion Milli Meter Display Pulse Width *
* 1 1 0 : Conversion Inches Display Pulse Width *
* 1 1 1 : Conversion Centi Meter Display Pulse Width *
* *
* *
* PWO - Pulse Width Offset *
* P2.6 *
* 0 : SENSCOMP Series Offset *
* 1 : SRF-04, SRF-05 Offset *
* *
* *
* THL - Threshold Level *
* P2.3 *
* 0 : Shumitte *
* 1 : No Shumitte *
* *
* FLT - Filter Level *
* P2.2 *
* 0 : Filter *
* 1 : No Filter *
* *
* CPM - Comparator Mode *
* P2.1 *
* 0 : Level Mode *
* 1 : Sandwitch Mode *
* *
* PGM - Program *
* P2.0 *
* 0 : Program Mode *
* 1 : Operation Mode *
* *
* *
* *
* +------------------------------------------------------------------+ *
* | UST DU1 DU0 OFS THL FTL CPM PGM | *
* | 7 6 5 4 3 2 1 0 | *
* +------------------------------------------------------------------+ *
* *
* *
* *
* *
* *
* C-18 P1-fl. Main-bd. ET-LAND *
* 16-9 Hangangno-3ga Yongsan-gu *
* SEOUL 140-879 South KOREA *
* TEL: +82-2-701-8051 *
* FAX: +82-2-701-8058 *
* Email: sample@korea.com *
* Web: HTTP://WWW.SAMPLE.CO.KR *
* *
*************************************************************************/
#include <sfr.h>
#include <os.h>
//////////////////////////////////////////////
// 7 Segment LED ÆÐÅÏ µ¥ÀÌÅÍ
// hgfedcba
#define DIG0 0xC0 // 11000000b ; 0 Px.0
#define DIG1 0xF9 // 11111001b ; 1 +-----a-----+
#define DIG2 0xA4 // 10100100b ; 2 | |
#define DIG3 0xB0 // 10110000b ; 3 Px.5 f b Px.1
#define DIG4 0x99 // 10011001b ; 4 | |
#define DIG5 0x92 // 10010010b ; 5 | Px.6 |
#define DIG6 0x82 // 10000010b ; 6 +-----g-----+
#define DIG7 0xD8 // 11011000b ; 7 | |
#define DIG8 0x80 // 10000000b ; 8 Px.4 e c Px.2
#define DIG9 0x98 // 10011000b ; 9 | |
// ; | Px.3 |
#define DIGM 0xBF // 10111111b ; - +-----d-----+ * h Px.7
#define DIGP 0x7F // 01111111b ; .
#define DIGB 0xFF // 11111111b ; "Blank"

#define ON 0 // 8051 Port On
#define OFF 1 // 8051 Port Off
#define TRUE 1 //
#define FALSE 0 //
#define I2C_DELAY 1 //
#define ACK 1 // I2C Acknowlwdge
#define NACK 0 // I2C Acknowlwdge

//////////////////////////////////////////////
_sfrbit FNDSEL0 = _p1^3; // Select 0
_sfrbit FNDSEL1 = _p1^4; // Select 1
_sfrbit FNDSEL2 = _p1^5; // Select 2
_sfrbit FNDSEL3 = _p1^6; // Select 3
_sfrbit FNDSEL4 = _p1^7; // Select 4
//////////////////////////////////////////////
_sfrbit RELAY = _p3^5; // Relay 

_sfrbit SDA = _p3^6; // SDA 
_sfrbit SCL = _p3^7; // SCL 

_sfrbit TRIG_SRF = _p1^0; // Triger for SRF-04, SRF-05
_sfrbit TRIG_SC = _p1^2; // Triger for SENSCOMP

//////////////////////////////////////////////
unsigned char fnd_state;
unsigned char fnd[5];
unsigned char mfnd[5];

unsigned char cmd_buffer[5];
unsigned char srf_address;
unsigned char new_srf_adrs;
unsigned char command;
unsigned char max_gain;
unsigned char range_reg;
unsigned char numerator;
unsigned char denumerator;
unsigned char display_mode;
unsigned char offset_msb;
unsigned char offset_lsb;
unsigned char config;

bit cmd_flag;
bit xout_flag;
//////////////////////////////////////////////
const char segment_pattern[] = { DIG0, DIG1, DIG2,\
DIG3, DIG4, DIG5, DIG6, DIG7, DIG8, DIG9 };
//////////////////////////////////////////////
void _interrupt IVN_TIMER0 time_base() { // Timer 0 Interrupt Service
_tl0 = 0x18; _th0 = 0xFC; // 1000 1 mSec / 12 MHz Xtal 
//////////////////////////////////////////////
FNDSEL0 = OFF; 
FNDSEL1 = OFF; 
FNDSEL2 = OFF; 
FNDSEL3 = OFF;
FNDSEL4 = OFF;

_p0 = fnd[fnd_state];

if (fnd_state == 0) FNDSEL0 = ON;
if (fnd_state == 1) FNDSEL1 = ON;
if (fnd_state == 2) FNDSEL2 = ON;
if (fnd_state == 3) FNDSEL3 = ON;
if (fnd_state == 4) FNDSEL4 = ON;

fnd_state++;
if(fnd_state>4) { fnd_state = 0x00; }

}

///////////////////////////////////////////////////////////

void _interrupt IVN_SERIALPORT _using 2 _SerialInterrupt() {
if (_ri) {

_ri = 0;

if (cmd_flag==0) {
cmd_buffer[0] = cmd_buffer[1];
cmd_buffer[1] = cmd_buffer[2];
cmd_buffer[2] = cmd_buffer[3];
cmd_buffer[3] = cmd_buffer[4];
cmd_buffer[4] = _sbuf;
}
if ((cmd_buffer[0]=='$') && (cmd_buffer[4]==0xD)) {
cmd_flag = 1;
}
}
else if (_ti) {
// transmit interrupt if here
_ti = 0;
xout_flag = FALSE; 
}
}

/////////////////////////////////////////////

void delay(unsigned long int i) {
while(i--);
}

//////////////////////// I2C Routine ///////////////////

void i2c_delay(void) {
unsigned char i;

i = I2C_DELAY;
while(i--);

}

void i2c_start(void) {

SDA = 1; // i2c start bit sequence
i2c_delay();
SCL = 1;
i2c_delay();
SDA = 0;
i2c_delay();
SCL = 0;
i2c_delay();
}

void i2c_stop(void) {

SDA = 0; // i2c stop bit sequence
i2c_delay();
SCL = 1;
i2c_delay();
SDA = 1;
i2c_delay();
}

void i2c_tx(unsigned char d) { // I2C Byte Write Sequence

char x;

for(x=8; x; x--) {
if(d&0x80) SDA = 1;
else SDA = 0;
SCL = 1;
i2c_delay();
d <<= 1;
SCL = 0;
i2c_delay();
}
SDA = 1;
SCL = 1;
i2c_delay();
SCL = 0;
i2c_delay();
}

unsigned char i2c_rx(char ack) { // I2C Byte Read Sequence

char x, d=0;

SDA = 1; 
for(x=0; x<8; x++) {
d <<= 1;
SCL = 1;
i2c_delay();
if(SDA) d |= 1;
SCL = 0;
i2c_delay();

if(ack) SDA = 0;
else SDA = 1;
SCL = 1;
i2c_delay(); 
SCL = 0;
SDA = 1;
i2c_delay();

return d;
}

////////////////////////////////////////////////////////

void put(unsigned char c) {

while (xout_flag); // wait for previous byte to complete
_sbuf = c;
xout_flag = TRUE;
}

void data_out(unsigned char c) {
unsigned char d;

d = c;
d >>= 4;
d &= 0x0F;
d |= 0x30;
if (d > '9') { d += 0x07; }
put(d);
d = c;
d &= 0x0F;
d |= 0x30;
if (d > '9') { d += 0x07; }
put(d);
}

void set_max_gain_register(void) {

i2c_start(); 
i2c_tx(srf_address);
i2c_tx(0x01);
i2c_tx(max_gain);
i2c_stop();
}

void set_range_register(void) {

i2c_start(); 
i2c_tx(srf_address);
i2c_tx(0x02);
i2c_tx(range_reg);
i2c_stop();
}

void set_new_srf_address(void) {

i2c_start(); 
i2c_tx(srf_address);
i2c_tx(0x00);
i2c_tx(0xA0);
i2c_tx(0xAA);
i2c_tx(0xA5);
i2c_tx(new_srf_adrs);
i2c_stop();

srf_address = new_srf_adrs;

}

void main(void) {

unsigned char t0,t1,t2,t3,b0;
unsigned char boat;
unsigned long int trailer;
unsigned long int table;

_tmod = 0x21; // Timer0 = Mode1, Timer, use TR0
// Timer1 = 8 Bit Auto reloaded Timer/Counter
_tl0 = 0xFF;
_th0 = 0xFF;

_scon = 0X50; // SCON serial port control - 8 bit uart (1 stop bit)
_tl1 = 0XF3; // Timer1 lo
_th1 = 0XF3; // 2400 baud (12.000MHz) 
_pcon |= 0X80; // 4800 baud (SMOD == 1)
_tmod = 0X20; // 8 bit autoreload for timer 1 ( baud rate generator)
_tcon = 0;
_tr1 = 1; // start baud rate generator
_es = 1; // enable serial port interrupts

_tr0 = 1; // Timer 0 µ¿ÀÛ½ÃÀÛ
_et0 = 1; // ŸÀÌ¸Ó 0 ÀÎÅÍ·´Æ® °¡´É»óÅ ¼³Á¤

_c_t2 = 0; // Counter Mode
_cp_rl2 = 1; //
_exen2 = 1;

_ea = 1; // ±Û·Î¹ú ÀÎÅÍ·´Æ® °¡´É»óÅ ¼³Á¤

command = 0x51; // Default 0x51
max_gain = 0x00; // Max Gain Register
range_reg = 0x00; // Range Register
denumerator = 0x00; // Denumeraator
numerator = 0x00; // Numerator
srf_address = 0xE0; // Default SFR-xx Base Address
cmd_flag = 0; // Clear command flag
xout_flag = 0; // Buffer out flag

TRIG_SRF = 0;
TRIG_SC = 0;

config = _p2; // Configuration DIP Switch

boat = config & 0x60;
command = 0x52; // Default Micro Second Display

if (boat == 0x60) {
command = 0x51; // Centi Meter Display
}
if (boat == 0x40) {
command = 0x50; // Inches Display
}

while(1) {

if (cmd_flag) {

if (cmd_buffer[3] > '9') { cmd_buffer[3] -= 0x07; }
cmd_buffer[3] &= 0x0F;
if (cmd_buffer[2] > '9') { cmd_buffer[2] -= 0x07; }
cmd_buffer[2] <<= 4;
cmd_buffer[2] &= 0xF0;
boat = cmd_buffer[2] | cmd_buffer[3];

if (cmd_buffer[1]=='0') { command = boat; } // 0x50 - inches, 0x51 - centi-meters, 0x52 - micro-seconds
if (cmd_buffer[1]=='1') { max_gain = boat; } // Set Gain Register
if (cmd_buffer[1]=='2') { range_reg = boat; set_range_register(); } // Range Register
if (cmd_buffer[1]=='O') { offset_msb = boat; } // Range Offset MSB 
if (cmd_buffer[1]=='P') { offset_lsb = boat; } // Range Offset LSB
if (cmd_buffer[1]=='M') { display_mode = boat; } // FND Display mode: 0x00 - unmodified, 0x01 - modified
if (cmd_buffer[1]=='D') { denumerator = boat; } // Denumerator Constant in mili meter display
if (cmd_buffer[1]=='N') { numerator = boat; } // Numerator Constant in mili meter display
if (cmd_buffer[1]=='A') { srf_address = boat; } // Set SRF-xx Base Address
if (cmd_buffer[1]=='S') { new_srf_adrs = boat; set_new_srf_address(); } // Change I2C Address

cmd_flag = 0;
}

_tr2 = 0;

TRIG_SRF = 1;

i2c_start(); 
i2c_tx(srf_address);
i2c_tx(0x00);
i2c_tx(command);
i2c_stop();

_tl2 = 0;
_th2 = 0;
_tf2 = 0;

_tr2 = 1;

TRIG_SRF = 0;
TRIG_SC = 1;
/////////////////////////////////////////////////////////////////// 
delay(8000); 
///////////////////////////////////////////////////////////////////
TRIG_SC = 0;

i2c_start(); 
i2c_tx(srf_address);
i2c_tx(0x00);

i2c_start();
boat = srf_address | 0x01;
i2c_tx(boat);

t0 = i2c_rx(ACK); 
t1 = i2c_rx(ACK); 
t2 = i2c_rx(ACK); // MSB SRF-02, SRF-08, SRF-10, SRF-235
t3 = i2c_rx(NACK); // LSB

i2c_stop();


if (config & 0x80) { // SRF-04, SRF-05, SENSCOMP Series
t2 = _rldh; // MSB SRF-04, SRF-05, SENSCOMP
t3 = _rldl; // LSB
}


trailer = t2;
trailer = trailer * 256 + t3;

boat = config & 0xE0; // Display Window


if (boat == 0x00) { ; } // Non Conversion Micro Second Display I2C Bus
if (boat == 0x20) { // Conversion Milli Meter Display I2C Bus
trailer = trailer * 1716 / 10000; }
if (boat == 0x40) { ; } // Non Conversion Inches Display I2C Bus
if (boat == 0x60) { ; } // Non Conversion Centi Meter Display I2C Bus
if (boat == 0x80) { ; } // Non Conversion Micro Second Display Pulse Width
if (boat == 0xA0) { // Conversion Milli Meter Display Pulse Width
trailer = trailer * 1716 / 10000; }
if (boat == 0xC0) { // Conversion Inches Display Pulse Width
trailer = trailer * 1716 / 254000; }
if (boat == 0xE0) { // Conversion Centi Meter Display Pulse Width
trailer = trailer * 1716 / 100000; }

if (trailer > 500) { RELAY = ON; } else { RELAY = OFF; }

boat = trailer % 10;
mfnd[4] = segment_pattern[boat];
trailer /= 10;

boat = trailer % 10;
mfnd[3] = segment_pattern[boat];
trailer /= 10;

boat = trailer % 10;
mfnd[2] = segment_pattern[boat];
trailer /= 10;

boat = trailer % 10;
mfnd[1] = segment_pattern[boat];
trailer /= 10;

boat = trailer % 10;
mfnd[0] = segment_pattern[boat];
trailer /= 10;

boat = config & 0x60; // Display Window

if (boat == 0x20) { mfnd[1] &= DIGP ; } // Milli Meter Display I2C Bus
if (boat == 0x40) { mfnd[4] &= DIGP ; } // Inches Display I2C Bus
if (boat == 0x60) { mfnd[2] &= DIGP ; } // Conversion Centi Meter Display I2C Bus



fnd[0] = mfnd[0]; // Most Signeficant Digit
fnd[1] = mfnd[1]; // & DIGP;
fnd[2] = mfnd[2];
fnd[3] = mfnd[3];
fnd[4] = mfnd[4];

data_out(t0);
data_out(t1);
data_out(t2);
data_out(t3);

put(0x0D); // Carriage Return
put(0x0A); // Line Feed
}

}
/////////////// EOF //////////////////////////

¡¡

¡¡

¿µ¹® À½¼ºÇÕ¼º ¸ðµâ SP03

SP03Àº ¿µ¾î ´Ü¾î(ASCII Code)¸¦ ÀÔ·ÂÇÏ¸é ¿Àµð¿À ½ÅÈ£·Î Ãâ·ÂÇÏ´Â À½¼ºÇÕ¼º±â ÀÔ´Ï´Ù.
´Ü¼øÈ÷ ¹Ì¸® ³ìÀ½ÇÑ À½¼ºÀ» Ãâ·ÂÇÏ´Â °ÍÀÌ ¾Æ´Ï¸ç ¾ËÆĺªÀ» Á¶ÇÕÇÏ¿©
¿µ¾î¿¡ °¡±î¿î À½¼ºÀ» Ãâ·ÂÇÕ´Ï´Ù.
SP03Àº ´Ü¾îÀÇ Á¦ÇÑÀÌ ¾øÀ¸¹Ç·Î
À¥ÆäÀÌÁö, À̸ÞÀÏÀÇ ¿µ¾î Ãâ·Â±â, È­»ó ÀÎ½Ä ½Ã½ºÅÛ°ú Á¶ÇÕÇÏ¿© ¿µ¹®¼­¸¦
À½¼ºÀ¸·Î º¯È¯ÇÏ´Â Àåºñ¿¡ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.

sp03070.jpg (44716 bytes)
CP03 Àº ¿µ¹®ÀÚ¸¦ À½¼ºÀ¸·Î º¯È¯ÇÏ´Â À½¼º ÇÕ¼º±â ¸ðµâ ÀÔ´Ï´Ù.
sp03071.jpg (42780 bytes)
4CM ÀÇ ½ºÇÇÄ¿°¡ ºÎÂøµÇ¾î ÀÖ½À´Ï´Ù.
sp03073.jpg (45168 bytes)
À½¼ºÇÕ¼º ĨÀº Winbond »çÀÇ WTS701 (¿µ¾îÆÇ)ÀÔ´Ï´Ù.
sp03074.jpg (44936 bytes)
CP03¿¡´Â ¿Àµð¿À ¾ÚÇÁ LM386ÀÌ ³»ÀåµÇ¾î ÀÖ½À´Ï´Ù.
sp03075.jpg (44952 bytes)
CP03Àº ½Ã¸®¾ó µå¶óÀ̹ö°¡ ³»ÀåµÇ¾î PC ÀÇ ½Ã¸®¾ó Æ÷Æ®·Î Á÷Á¢ ¿¬°á°¡´ÉÇÕ´Ï´Ù.

¡¡

sp03wire.gif (32744 bytes)

SP03ÀÇ Ä¿³ØÅÍ

¡¡

sp03rs232.jpg (14467 bytes)

PC ÀÇ ½Ã¸®¾ó Æ÷Æ®·Î ¿¬°á

¡¡

sp03mnt.gif (4789 bytes)

¡¡

¡¡

sp03.gif (12207 bytes)

À½¼ºÇÕ¼º ¿¹: (¾Æ·¡ ¿¹Á¦¸¦ Ŭ¸¯Çϸé À½¼ºÀ» µéÀ» ¼ö ÀÖ½À´Ï´Ù.)
¿¹Á¦ 21, ¿¹Á¦ 22, ¿¹Á¦ 23, ¿¹Á¦ 24, ¿¹Á¦ 25

¡¡

¡¡

sp03demo.gif (11655 bytes)

SP03 Àº ¿µ¾î ÇÕ¼º ¸ðµâÀÌÁö¸¸ ¹Ì±¹ »ç¶÷½Ä ÇÑ±Û ¹ßÀ½µµ °¡´ÉÇÕ´Ï´Ù.
¾Æ·¡ÀÇ À½¼ºÃâ·Â ¿¹Á¦´Â À§ÀÇ ±×¸²°ú °°ÀÌ ÀÔ·ÂÇßÀ» ¶§ SP03 ¿¡¼­ ³ª¿À´Â ¼Ò¸®¸¦ ±×´ë·Î Ç¥ÇöÇÑ °ÍÀÔ´Ï´Ù.

¿¹Á¦1: "À£ÄÄÅõ »ùÇà ÀÏ·ºÆ®·Î´Ð½º ¹Ý°©½À´Ï´Ù"

¿¹Á¦2: "Á¤¸» °¨»çÇÕ´Ï´Ù"

¿¹Á¦3: "¿À ¼­ ¿À½Ã ¿ä"

¿¹Á¦4: "¾È³çÈ÷ °¡½Ã¿ä Àß °¡½Ã¿ä ¶Ç ¿À½Ã¿ä"

¿¹Á¦5: "»ùÇÃÀüÀÚ ÀüÈ­¹øÈ£´Â Ä¥ °ø ÀÏ ÆÈ °ø ¿À ÀÏ ÀÔ´Ï´Ù"

¡¡

°ü·Ã ÀÚ·á ´Ù¿î·Îµå

SP03 ÇÁ·Î±×·¥ ¼ÒÇÁÆ®¿þ¾î SP03.exe

WINBOND À½¼ºÇÕ¼º Ĩ ȨÆäÀÌÁö

Winbond WTS701ET À½¼ºÇÕ¼º Ĩ µ¥ÀÌÅÍ

ROBOT Electronics»çÀÇ À½¼ºÇÕ¼º ¸ðµâ SP03 »ç¿ë¼³¸í¼­(¿µ¹®)

¡¡

¡¡

ÀüÀÚ ³ªÄ§¹Ý / Compass Module

¡¡

xcmps03.gif (1749 bytes)

¡¡

cmps3pin.jpg (37315 bytes)

¡¡

¡¡

i2c.gif (4233 bytes)

¡¡

CMPS¸¦ ÀÌ¿ëÇÑ ÀüÀÚ ³ªÄ§¹Ý SE-CMPS

¡¡

°¡ °Ý Á¤ º¸

Ç° ¸ñ »ç ¾ç ¡¡
SRF-01 ½Ã¸®¾ó ÀÎÅÍÆäÀ̽º ¡¡
SRF-02 I2C, ½Ã¸®¾ó ÀÎÅÍÆäÀ̽º ¡¡
SRF-04 5 Cm - 2.4 Meter, ¼¾¼­Áö¸§ 16mm ¡¡
SRF-05 Æ®¸®°Å, ¿¡ÄÚ °â¿ë, ¼¾¼­Áö¸§ 16mm ¡¡
SRF-08 I2C ÀÎÅÍÆäÀ̽º, CDS¼¾¼­, ¼¾¼­Áö¸§ 16mm ¡¡
SRF-10 I2C ÀÎÅÍÆäÀ̽º, ¼¾¼­Áö¸§ 10mm ¡¡
SRF235 ±ÙÁ¢, Á¤¹ÐÃøÁ¤ ¡¡
CMPS03 ÀüÀÚ ³ªÄ§ÆÇ 3µµ Á¤¹Ðµµ 0.1µµ ºÐÇØ´É ¡¡
SP03 À½¼ºÇÕ¼º ¸ðµâ ¡¡
*** ÃÊÀ½ÆĸðµâÀº Àü¿øÀ» ¹Ý´ë·Î ¿¬°áÇϸé Æļյ˴ϴÙ. ***
I2C ÇÁ·ÎÅäÄÝ ¼­ºê·çƾÀ» °¡Áö°í ÀÖÀ» ¶§ SRF-02, SRF08, SRF10, SRF235À» »ç¿ëÇÕ´Ï´Ù. I2C´Â µ¥ÀÌÅÍ ½ÃÆ®¸¦ º¸°í ÇÁ·Î±×·¡¹ÖÇÒ ¼ö ÀÖÀ» Á¤µµ·Î °£´ÜÇÏÁö ¾Ê½À´Ï´Ù. ½ÅÈ£»ç¾çÀ» Á¤È®È÷ ¼÷ÁöÇϽñ⠹ٶø´Ï´Ù.
»ùÇÃÀüÀÚ¸¦ °æÀ¯ÇÏ¿© ÆÇ¸ÅµÈ ÃÊÀ½ÆÄ ¸ðµâÀº Æ÷ÀåÀÌ °³ºÀµÇÁö ¾ÊÀº »óÅ¿¡¼­ ȯºÒÀ̳ª ±³È¯ÀÌ °¡´ÉÇÕ´Ï´Ù.
SRF-02, SRF-08, SRF-10, SRF-235 ¿¡ »ç¿ëµÇ´Â I2C ÇÁ·ÎÅäÄÝ ÀÎÅÍÆäÀ̽º ¿¹Á¦ C ¼Ò½º ÀÔ´Ï´Ù. 8051 ÇÁ·Î¼¼¼­¿ë À̹ǷΠAVR µî¿¡¼­´Â Port ¼³Á¤À» ¼öÁ¤ÇÏ¿©¾ß ÇÕ´Ï´Ù.

i2c-exam.txt

¡¡

¡¡

¡¡

¡¡

¡¡