قسم الميكروكنترولر والروبوت ودوائر الاتصال بالحاسب الالي قسم المتحكمات الـ microcontroller و المعالجات microprocessor و التحكم الرقمي بالكمبيوتر CNC والانظمة الآلية والروبوت Robots

أدوات الموضوع

sskk77
:: مهندس متميز ::
تاريخ التسجيل: Jan 2005
المشاركات: 714
نشاط [ sskk77 ]
قوة السمعة:0
قديم 30-05-2011, 06:56 AM المشاركة 1   
افتراضي سؤال حول PCF8583 Twitter FaceBook Google+



السلام عليكم
شباب ممكن احد يساعدني في خطوات التعامل مع PCF8583
اقصد تسلسل القيم التي يجب ارسالها او استلامها
واذا امكن كود بهذا الخصوص
ولكم الشكر الجزيل

اعلانات

sskk77
:: مهندس متميز ::
تاريخ التسجيل: Jan 2005
المشاركات: 714
نشاط [ sskk77 ]
قوة السمعة:0
قديم 31-05-2011, 05:01 AM المشاركة 2   
افتراضي


السلام عليكم
شباب ممكن احد يساعدني في خطوات التعامل مع PCF8583
اقصد تسلسل القيم التي يجب ارسالها او استلامها
واذا امكن كود بهذا الخصوص
ولكم الشكر الجزيل
ياشباب مافي جواب

اعلانات اضافية ( قم بتسجيل الدخول لاخفائها )
  

geniusse01
:: عضو ذهبي ::
تاريخ التسجيل: Apr 2008
الدولة: Jordan - Amman
المشاركات: 1,139
نشاط [ geniusse01 ]
قوة السمعة:106
قديم 31-05-2011, 06:24 PM المشاركة 3   
افتراضي


السلام عليكم

يمكنك الاستفادة من هذا الموضوع يوضح بروتوكول I2C مع الايبروم وهو نفس الخطوات للقراءة والكتابة لكن المهم هو معرفة العنوان (هل تملك انت هذا الايسي PCF8583 فانا في الاردن لم اجد الا DS1307 واستخدمته مثلا ) هذا رابط الموضوع :

http://www.qariya.com/vb/showthread.php?t=57192


وهذا مثال لاستخدام المتكاملة DS1307 كساعة زمن حقيقي :

http://www.qariya.com/vb/showthread.php?t=89794

لا تترد في اي استفسار ...ارجو لك التوفيق..

واخر دعوانا ان الحمدلله رب العالمين .. وصلى الله على سيدنا محمد وعلى اله وصحبه وسلم..


sskk77
:: مهندس متميز ::
تاريخ التسجيل: Jan 2005
المشاركات: 714
نشاط [ sskk77 ]
قوة السمعة:0
قديم 01-06-2011, 05:44 AM المشاركة 4   
افتراضي


السلام عليكم

يمكنك الاستفادة من هذا الموضوع يوضح بروتوكول I2C مع الايبروم وهو نفس الخطوات للقراءة والكتابة لكن المهم هو معرفة العنوان (هل تملك انت هذا الايسي PCF8583 فانا في الاردن لم اجد الا DS1307 واستخدمته مثلا ) هذا رابط الموضوع :

http://www.qariya.com/vb/showthread.php?t=57192


وهذا مثال لاستخدام المتكاملة DS1307 كساعة زمن حقيقي :

http://www.qariya.com/vb/showthread.php?t=89794

لا تترد في اي استفسار ...ارجو لك التوفيق..

واخر دعوانا ان الحمدلله رب العالمين .. وصلى الله على سيدنا محمد وعلى اله وصحبه وسلم..
الف شكر لك أخي على تجاوبك
لكن لايوجد عندي مشكلة مع البروتوكول لكن مشكلتي مع الآي سي نفسها
بالنسبة للاي سي DS1307 جربتها لكنها لم تعمل معي علماً ان المحاكات سليمة واعطت نتائج ممتازة اما على الواقع لم تعمل ابداً
كنت استخدم PIC16F628
فظننت أن المشكلة في الكود فبحثت عن طريقة العمل على الميزة الآلية للمعالج PIC16f877
وكذلك الأمر لم يعمل على الواقع بالرغم من عمله في بروتوس
علماً ان المعالج يعمل بشكل جيد وليس فيه اي مشكلة ودليل ذلك أني استخدمت المنفذ بي لاظهار القيم التي يتلقاها من DS1307 وقد كتبت برنامج صغير ببداية البرنامج يجعل هذا المنفذ يومض مرتين قبل البدء بعمله وهو يعمل على الواقع دليل ان المعالج ليس فيه اي خطأ
هذا رابط فيه المشكلة
http://www.arabteam2000-forum.com/in...ic=233159&st=0

وهذا رابط لموضوع آخر
http://www.qariya.com/vb/showthread.php?t=90604

فنصحني الأخ faidamine مشكوراً باستخدام PCF8583 حسب ما ذكر ان اشكالاتها اقل لكني الى الآن لم استطع التعامل مع PCF8583 لعدم معرفتي بالخطوات اللازمة
ولم استطع التعامل مع DS1307 على الواقع مع اني استخدمت منها 3 لاحتمال ان تكون مضروبة فلم افلح الى الآن
فلا يهمني ان كانت DS1307 او PCF8583 او غيرها
ان ما يهمني ان تعمل معي الدارة
ولكم الشكر والتقدير


التعديل الأخير تم بواسطة : sskk77 بتاريخ 01-06-2011 الساعة 05:47 AM

geniusse01
:: عضو ذهبي ::
تاريخ التسجيل: Apr 2008
الدولة: Jordan - Amman
المشاركات: 1,139
نشاط [ geniusse01 ]
قوة السمعة:106
قديم 01-06-2011, 07:51 PM المشاركة 5   
افتراضي


السلام عليكم

ان العنوان محدد في الداتاشيت والصورة التالي توضح ذلك :



تلاحظ ان توصيل الطرف الخارجي (A0) للمتكاملة يحدد العنوان

المطلوب ...يمكن ان تحصل على مثال للقراءة من المتكاملة من خلال الامثلة

المرفقة في الميكروسي مثل المثال التالي:

كود:
/* * Project name: RTC_Read (Reading date/time stamp from PCF8583 through I2C) * Copyright: (c) MikroElektronika, 2005-2008 * Revision History: 20050130: - initial release; * Description: This project is simple demonstration how to read date and time from PCF8583 RTC (real-time clock). The code can be used with any MCU that has MSSP module at PORTC. Date and time are printed at LCD. * Test configuration: MCU: PIC16F877A/PIC18F4520 Dev.Board: EasyPIC5 Oscillator: HS, 8.000MHz Ext. Modules: RTC module (PCF8583), LCD 2x16 chars SW: mikroC v8.0 * NOTES: - In order to use the example, address pin A0 of PCF8583 must be set to 0V! - For proper I2C communication, pins on PORTC must be in the pull-up mode, and the LEDs on board switched OFF! */ unsigned char sec, min1, hr, day, mn, year; char *txt, tnum[4]; void Zero_Fill(char *value) { // fill text repesentation if (value[1] == 0) { // with leading zero value[1] = value[0]; value[0] = 48; value[2] = 0; } }//~ //--------------------- Reads time and date information from RTC (PCF8583) void Read_Time(char *sec, char *min, char *hr, char *day, char *mn, char *year) { I2C_Start(); I2C_Wr(0xA0); I2C_Wr(2); I2C_Repeated_Start(); I2C_Wr(0xA1); *sec =I2C_Rd(1); //while (I2C_Is_Idle() == 0) ; *min =I2C_Rd(1); //while (I2C_Is_Idle() == 0) ; *hr =I2C_Rd(1); //while (I2C_Is_Idle() == 0) ; *day =I2C_Rd(1); //while (I2C_Is_Idle() == 0) ; *mn =I2C_Rd(0); //while (I2C_Is_Idle() == 0) ; I2C_Stop(); }//~ //-------------------- Formats date and time void Transform_Time(char *sec, char *min, char *hr, char *day, char *mn, char *year) { *sec = ((*sec & 0xF0) >> 4)*10 + (*sec & 0x0F); *min = ((*min & 0xF0) >> 4)*10 + (*min & 0x0F); *hr = ((*hr & 0xF0) >> 4)*10 + (*hr & 0x0F); *year = (*day & 0xC0) >> 6; *day = ((*day & 0x30) >> 4)*10 + (*day & 0x0F); *mn = ((*mn & 0x10) >> 4)*10 + (*mn & 0x0F); }//~ //-------------------- Output values to LCD void Display_Time(char sec, char min, char hr, char day, char mn, char year) { ByteToStr(day,tnum); txt = rtrim(tnum); Zero_Fill(txt); LCD_Out(1,6,txt); ByteToStr(mn,tnum); txt = rtrim(tnum); Zero_Fill(txt); LCD_Out(1,9,txt); LCD_Chr(1,15,52+year); ByteToStr(hr,tnum); txt = rtrim(tnum); Zero_Fill(txt); LCD_Out(2,6,txt); ByteToStr(min,tnum); txt = rtrim(tnum); Zero_Fill(txt); LCD_Out(2,9,txt); ByteToStr(sec,tnum); txt = rtrim(tnum); Zero_Fill(txt); LCD_Out(2,12,txt); }//~ //------------------ Performs project-wide init void Init_Main() { ADCON1 = 0x0F; Lcd_Config(&PORTB, 4, 5, 6, 3, 2, 1, 0); // Lcd_Init_EP5, see Autocomplete I2C_Init(100000); // initialize I2C txt = "Date:"; // prepare and output static text on LCD LCD_Out(1,1,txt); LCD_Chr(1,8,':'); LCD_Chr(1,11,':'); txt = "Time:"; LCD_Out(2,1,txt); LCD_Chr(2,8,':'); LCD_Chr(2,11,':'); txt = "200"; LCD_Out(1,12,txt); LCD_Cmd(LCD_CURSOR_OFF); // cursor off }//~ //----------------- Main procedure void main() { Init_Main(); // perform initialization while (1) { Read_Time(&sec,&min1,&hr,&day,&mn,&year); // read time from RTC(PCF8583) Transform_Time(&sec,&min1,&hr,&day,&mn,&year); // format date and time Display_Time(sec, min1, hr, day, mn, year); // prepare and display on LCD Delay_ms(1000); // wait 1s } }
ومثال للكتابة كالتالي:

كود:
/* * Project name: RTC_Write (Writing date/time data to PCF8583 through I2C) * Copyright: (c) MikroElektronika, 2005-2008 * Revision History: 20050130: - initial release; * Description: This project is simple demonstration how to set date and time on PCF8583 RTC (real-time clock). The code can be used with any MCU that has MSSP module at PORTC. The example sets the following: TIME: 11:30:00 DATE: 08/24/2004 Please refer to PCF8583 datasheet for more information on config. word and time format settings. * Test configuration: MCU: PIC16F877A/PIC18F4520 Dev.Board: EasyPIC5 Oscillator: HS, 8.000MHz Ext. Modules: RTC module (PCF8583) SW: mikroC v8.0 * NOTES: - In order to use the example, address pin A0 of PCF8583 must be set to 0V! - For proper I2C communication, pins on PORTC must be in the pull-up mode, and the LEDs on board switched OFF! */ void main() { I2C_Init(10000); // initialize full master mode I2C_Start(); // issue start signal I2C_Wr(0xA0); // address PCF8583 I2C_Wr(0); // start from word at address 0 (configuration word) I2C_Wr(0x80); // write $80 to config. (pause counter...) I2C_Wr(0); // write 0 to cents word I2C_Wr(0); // write 0 to seconds word I2C_Wr(0x30); // write $30 to minutes word I2C_Wr(0x11); // write $11 to hours word I2C_Wr(0x24); // write $24 to year/date word I2C_Wr(0x08); // write $08 to weekday/month I2C_Stop(); // issue stop signal I2C_Start(); // issue start signal I2C_Wr(0xA0); // address PCF8530 I2C_Wr(0); // start from word at address 0 I2C_Wr(0); // write 0 to config word (enable counting) I2C_Stop(); // issue stop signal }//~!

ارجو ان تكون الامور واضحة ..وفي حال اي استفسار فيمكن طرحه هنا للحصول على مساعدة الاعضاء الكرام ..ربنا يوفقك ..

واخر دعوانا ان الحمدلله رب العالمين .. وصلى الله على سيدنا محمد وعلى اله وصحبه وسلم..


sskk77
:: مهندس متميز ::
تاريخ التسجيل: Jan 2005
المشاركات: 714
نشاط [ sskk77 ]
قوة السمعة:0
قديم 02-06-2011, 05:14 AM المشاركة 6   
افتراضي


السلام عليكم

ان العنوان محدد في الداتاشيت والصورة التالي توضح ذلك :



تلاحظ ان توصيل الطرف الخارجي (A0) للمتكاملة يحدد العنوان

المطلوب ...يمكن ان تحصل على مثال للقراءة من المتكاملة من خلال الامثلة

المرفقة في الميكروسي مثل المثال التالي:

كود:
/* * Project name: RTC_Read (Reading date/time stamp from PCF8583 through I2C) * Copyright: (c) MikroElektronika, 2005-2008 * Revision History: 20050130: - initial release; * Description: This project is simple demonstration how to read date and time from PCF8583 RTC (real-time clock). The code can be used with any MCU that has MSSP module at PORTC. Date and time are printed at LCD. * Test configuration: MCU: PIC16F877A/PIC18F4520 Dev.Board: EasyPIC5 Oscillator: HS, 8.000MHz Ext. Modules: RTC module (PCF8583), LCD 2x16 chars SW: mikroC v8.0 * NOTES: - In order to use the example, address pin A0 of PCF8583 must be set to 0V! - For proper I2C communication, pins on PORTC must be in the pull-up mode, and the LEDs on board switched OFF! */ unsigned char sec, min1, hr, day, mn, year; char *txt, tnum[4]; void Zero_Fill(char *value) { // fill text repesentation if (value[1] == 0) { // with leading zero value[1] = value[0]; value[0] = 48; value[2] = 0; } }//~ //--------------------- Reads time and date information from RTC (PCF8583) void Read_Time(char *sec, char *min, char *hr, char *day, char *mn, char *year) { I2C_Start(); I2C_Wr(0xA0); I2C_Wr(2); I2C_Repeated_Start(); I2C_Wr(0xA1); *sec =I2C_Rd(1); //while (I2C_Is_Idle() == 0) ; *min =I2C_Rd(1); //while (I2C_Is_Idle() == 0) ; *hr =I2C_Rd(1); //while (I2C_Is_Idle() == 0) ; *day =I2C_Rd(1); //while (I2C_Is_Idle() == 0) ; *mn =I2C_Rd(0); //while (I2C_Is_Idle() == 0) ; I2C_Stop(); }//~ //-------------------- Formats date and time void Transform_Time(char *sec, char *min, char *hr, char *day, char *mn, char *year) { *sec = ((*sec & 0xF0) >> 4)*10 + (*sec & 0x0F); *min = ((*min & 0xF0) >> 4)*10 + (*min & 0x0F); *hr = ((*hr & 0xF0) >> 4)*10 + (*hr & 0x0F); *year = (*day & 0xC0) >> 6; *day = ((*day & 0x30) >> 4)*10 + (*day & 0x0F); *mn = ((*mn & 0x10) >> 4)*10 + (*mn & 0x0F); }//~ //-------------------- Output values to LCD void Display_Time(char sec, char min, char hr, char day, char mn, char year) { ByteToStr(day,tnum); txt = rtrim(tnum); Zero_Fill(txt); LCD_Out(1,6,txt); ByteToStr(mn,tnum); txt = rtrim(tnum); Zero_Fill(txt); LCD_Out(1,9,txt); LCD_Chr(1,15,52+year); ByteToStr(hr,tnum); txt = rtrim(tnum); Zero_Fill(txt); LCD_Out(2,6,txt); ByteToStr(min,tnum); txt = rtrim(tnum); Zero_Fill(txt); LCD_Out(2,9,txt); ByteToStr(sec,tnum); txt = rtrim(tnum); Zero_Fill(txt); LCD_Out(2,12,txt); }//~ //------------------ Performs project-wide init void Init_Main() { ADCON1 = 0x0F; Lcd_Config(&PORTB, 4, 5, 6, 3, 2, 1, 0); // Lcd_Init_EP5, see Autocomplete I2C_Init(100000); // initialize I2C txt = "Date:"; // prepare and output static text on LCD LCD_Out(1,1,txt); LCD_Chr(1,8,':'); LCD_Chr(1,11,':'); txt = "Time:"; LCD_Out(2,1,txt); LCD_Chr(2,8,':'); LCD_Chr(2,11,':'); txt = "200"; LCD_Out(1,12,txt); LCD_Cmd(LCD_CURSOR_OFF); // cursor off }//~ //----------------- Main procedure void main() { Init_Main(); // perform initialization while (1) { Read_Time(&sec,&min1,&hr,&day,&mn,&year); // read time from RTC(PCF8583) Transform_Time(&sec,&min1,&hr,&day,&mn,&year); // format date and time Display_Time(sec, min1, hr, day, mn, year); // prepare and display on LCD Delay_ms(1000); // wait 1s } }
ومثال للكتابة كالتالي:

كود:
/* * Project name: RTC_Write (Writing date/time data to PCF8583 through I2C) * Copyright: (c) MikroElektronika, 2005-2008 * Revision History: 20050130: - initial release; * Description: This project is simple demonstration how to set date and time on PCF8583 RTC (real-time clock). The code can be used with any MCU that has MSSP module at PORTC. The example sets the following: TIME: 11:30:00 DATE: 08/24/2004 Please refer to PCF8583 datasheet for more information on config. word and time format settings. * Test configuration: MCU: PIC16F877A/PIC18F4520 Dev.Board: EasyPIC5 Oscillator: HS, 8.000MHz Ext. Modules: RTC module (PCF8583) SW: mikroC v8.0 * NOTES: - In order to use the example, address pin A0 of PCF8583 must be set to 0V! - For proper I2C communication, pins on PORTC must be in the pull-up mode, and the LEDs on board switched OFF! */ void main() { I2C_Init(10000); // initialize full master mode I2C_Start(); // issue start signal I2C_Wr(0xA0); // address PCF8583 I2C_Wr(0); // start from word at address 0 (configuration word) I2C_Wr(0x80); // write $80 to config. (pause counter...) I2C_Wr(0); // write 0 to cents word I2C_Wr(0); // write 0 to seconds word I2C_Wr(0x30); // write $30 to minutes word I2C_Wr(0x11); // write $11 to hours word I2C_Wr(0x24); // write $24 to year/date word I2C_Wr(0x08); // write $08 to weekday/month I2C_Stop(); // issue stop signal I2C_Start(); // issue start signal I2C_Wr(0xA0); // address PCF8530 I2C_Wr(0); // start from word at address 0 I2C_Wr(0); // write 0 to config word (enable counting) I2C_Stop(); // issue stop signal }//~!

ارجو ان تكون الامور واضحة ..وفي حال اي استفسار فيمكن طرحه هنا للحصول على مساعدة الاعضاء الكرام ..ربنا يوفقك ..

واخر دعوانا ان الحمدلله رب العالمين .. وصلى الله على سيدنا محمد وعلى اله وصحبه وسلم..
الف شكر لك أخي العزيز على المساعدة
بالنسبة للعنوان مفهوم
لكن اذا سمحت ممكن يكون الكود اسمبلي لاني لا اعرف السي
واذا ممكن يكون البرنامج على شكل برنامجين فرععيين من دون برنامج للعرض على شاشة
قراءة :ارسل اليه العنوان فيعود بالقيمة كما هي بدون اي برامج اخرى
كتابة:ارسل اليه العنوان والقيمة فيكتبها داخل الآي سي
وجزاك الله عني خيراً


sskk77
:: مهندس متميز ::
تاريخ التسجيل: Jan 2005
المشاركات: 714
نشاط [ sskk77 ]
قوة السمعة:0
قديم 02-06-2011, 10:35 AM المشاركة 7   
افتراضي


سؤال آخر
هل يمكن التعامل مع PCF8583 أو DS1307 بواسطة الحاسب واستخدام المنفذ التسلسلي والقراءة منها والكتابة عليها بدون اي اضافات أخرى غير الكرستالة والمقاومات الخاصة بها والضرورية لعملها


geniusse01
:: عضو ذهبي ::
تاريخ التسجيل: Apr 2008
الدولة: Jordan - Amman
المشاركات: 1,139
نشاط [ geniusse01 ]
قوة السمعة:106
قديم 02-06-2011, 06:05 PM المشاركة 8   
افتراضي


سؤال آخر
هل يمكن التعامل مع PCF8583 أو DS1307 بواسطة الحاسب واستخدام المنفذ التسلسلي والقراءة منها والكتابة عليها بدون اي اضافات أخرى غير الكرستالة والمقاومات الخاصة بها والضرورية لعملها

السلام عليكم

في البداية انا ليس لي معرفة بالاسيمبلي لذلك لا استطيع افادتك في كتابة الكود المطلوب للاسف ...

اما استخدام التوصيل من خلال الحاسب فلا اعرف ان كان يمكن ذلك خصوصا اختلاف بروتوكول النقل بين الطريقتين ..

ارجو لك التوفيق..

واخر دعوانا ان الحمدلله رب العالمين .. وصلى الله على سيدنا محمد وعلى اله وصحبه وسلم.

إضافة رد

العلامات المرجعية

«     الموضوع السابق       الموضوع التالي    »
أدوات الموضوع

الانتقال السريع إلى


الساعة معتمدة بتوقيت جرينتش +3 الساعة الآن: 12:55 AM
موقع القرية الالكترونية غير مسؤول عن أي اتفاق تجاري أو تعاوني بين الأعضاء
فعلى كل شخص تحمل مسئولية نفسه إتجاه مايقوم به من بيع وشراء وإتفاق وأعطاء معلومات موقعه
التعليقات المنشورة لا تعبر عن رأي موقع القرية الالكترونية ولايتحمل الموقع أي مسؤولية قانونية حيال ذلك (ويتحمل كاتبها مسؤولية النشر)

Powered by vBulletin® Version 3.8.6, Copyright ©2000 - 2025