• 0
  • مالي خلق
  • أتهاوش
  • متضايق
  • مريض
  • مستانس
  • مستغرب
  • مشتط
  • أسولف
  • مغرم
  • معصب
  • منحرج
  • آكل
  • ابكي
  • ارقص
  • اصلي
  • استهبل
  • اضحك
  • اضحك  2
  • تعجبني
  • بضبطلك
  • رايق
  • زعلان
  • عبقري
  • نايم
  • طبيعي
  • كشخة
  • النتائج 1 إلى 2 من 2

    الموضوع: ساعدوني بليس؟؟؟؟؟؟؟؟؟؟

    1. #1
      التسجيل
      03-05-2007
      المشاركات
      2
      المواضيع
      2
      شكر / اعجاب مشاركة

      ساعدوني بليس؟؟؟؟؟؟؟؟؟؟

      شباب عندي برنامج بالسى واريد احوله الى لغه الاسمبلي لغه AVR لكن صعب كثير لاني ما اعرف لغه AVR كثير فياليت تحوله لي ولكم جزيل الشكر علما بان البرنامج تم تصميمه ليقيس درجه الحراره باستخدام DS1620 وميكروكنترول AVR اتمني لو تساعدوني.



      define F_CPU 3686400UL
      include <ctype.h>#
      include <math.h>#
      include <string.h>#
      include <stdio.h>#
      include <stdio.h>#
      include <avr/io.h>#
      include <avr/pgmspace.h>#
      include <util/delay.h>#
      ( define sbi(port, bit) (port) |= (1 << (bit))#
      (define cbi(port, bit) (port) &= ~(1 << (bit))#
      define CLK 1
      define RST 2


      void delay(int m) // this is just a delay function
      {
      int i
      for(i=0; i<m; i++)
      {
      _delay_ms(1)
      }
      }

      void write( unsigned char m) // this is the write to DS1620 function
      {
      int i
      unsigned char j=m


      for(i=0; i<8; i++)
      {

      cbi(PORTA, CLK); // clearing the clock of the sensor
      PORTB= j
      sbi(PORTA, CLK); //setting the clock of the sensor
      j= j>>1
      }

      }

      unsigned char read(void) // this is the read from DS1620 FUNCTION
      {
      int i
      unsigned char x=0, k

      for(i=0; i<8; i++)
      {
      sbi(PORTA, CLK); // setting the clock of the sensor
      k= PINB
      cbi(PORTA, CLK); // clearing the clock of the sensor
      k &= 0b10000000
      x = x | k

      x= x>>1
      }

      return x;
      }

      int main()
      {



      DDRA = 0xFF; // PORTA is output(to control the clock and the reset
      DDRB = 0x7F; // port b for write(first it was used to write, ;then it will be e used to read)d)
      DDRC= 0xFF
      DDRD = 0xFF

      unsigned char x,r,q


      sbi(PORTA,RST)
      write(0x0c); // Sending (0x0c) to open the configuration register
      write(0x03); //configuring the CPU register for continues conversion mode
      cbi(PORTA,RST);//clearing the RESET (the CPU configuration ends)

      delay(2); //delay for 1ms








      while(1) // repeat forever
      {
      DDRB = 0x7F; // setting portB to write to SD1620

      sbi(PORTA,RST); //SETTING the RESET
      write(0xee); //Sending the start command for the sensor to start converting the temperature continuously each 1 second .
      cbi(PORTA,RST); //SETTING the RESET

      delay(1000); //Delay for 1000 ms

      sbi(PORTA,RST);
      write(0xAA);
      DDRB = 0b01111110;//setting portB to READ FROM DS1620
      x=read(); //read the temperature serially
      x=x/2; //to get the actuall reading since the resolution is 0.5
      q=x/10; // t
      r=x-10*q;

      cbi(PORTA,RST);


      PORTC=q; // to disply into 2 digits disiply
      PORTD=r; //to disply into 2 digits disiply
      delay(1000);
      }
      return 0;
      }

    2. #2
      التسجيل
      08-03-2007
      المشاركات
      93
      المواضيع
      18
      شكر / اعجاب مشاركة

      رد: ساعدوني بليس؟؟؟؟؟؟؟؟؟؟

      لو قلت حولولي من فيجوال بيسك إلى أسمبلي كنا قلنا مش مشكلة

    ضوابط المشاركة

    • لا تستطيع إضافة مواضيع جديدة
    • لا تستطيع الرد على المواضيع
    • لا تستطيع إرفاق ملفات
    • لا تستطيع تعديل مشاركاتك
    •