اطلاعیه

Collapse
No announcement yet.

کانفیگ MMC روی PORT C

Collapse
X
 
  • فیلتر
  • زمان
  • Show
Clear All
new posts

    کانفیگ MMC روی PORT C

    سلام
    بقیه پورت ها مشغولند و میخوام MMC رو به پورت C وصل کنم ؛ اما نمیشه و خطا میده، دوتا پینTOC1,TOC رو برای کریستال ساعت استفاده کردم و بقیه برای استفاده آزاد هستند.

    فایل کانفیگ MMC رو هم دستکاری کردم و روی نرم هم افزاری گذاشتمش ! نشد که نشد!

    دوستان ، آقای تروشه و یا بقیه دوستان که به بحث تسلط دارند راهنمایی بفرمایند لطفا.
    متشکرم
    چون من گدایی بی نشان مشکل شود یاری چنان
    سلطان کجا عیش نهان با رند بازاری کند...
    [حافظ]

    #2
    پاسخ : کانفیگ MMC روی PORT C

    سلام میتونی محتوایت فایل کانفیگت رو بزاری؟
    الهم عجل لولیک الفرج

    فقط 313 نفر...

    دیدگاه


      #3
      پاسخ : کانفیگ MMC روی PORT C

      [pre]
      '-------------------------------------------------------------------------------
      ' Config_MMC.BAS
      ' Config File for MMC Flash Cards Driver
      ' (c) 2003-2005 , MCS Electronics / Vo"gel Franz Josef
      '-------------------------------------------------------------------------------
      ' Place MMC.LIB in the LIB-Path of BASCOM-AVR installation
      '
      'Connection as following
      'MMC M128/M103
      '1 MMC_CS PORTc.0
      '2 MOSI PORTC.1
      '3 GND
      '4 +3.3V
      '5 CLOCK PORTC.3
      '6 GND
      '7 MISO, PORTC.2

      ' you can vary MMC_CS on HW-SPI and all pins on SOFT-SPI, check settings
      ' ========== Start of user definable range =====================================

      ' you can use HW-SPI of the AVR (recommended) or a driver build in Soft-SPI, if
      ' the HW-SPI of the AVR is occupied by an other SPI-Device with different settings

      ' Declare here you SPI-Mode
      ' using HW-SPI: cMMC_Soft = 0
      ' not using HW_SPI: cMMC_Soft = 1

      Const Cmmc_soft = 1

      #if Cmmc_soft = 0

      ' --------- Start of Section for HW-SPI ----------------------------------------

      ' define Chip-Select Pin
      Config Pinc.0 = Output ' define here Pin for CS of MMC/SD Card
      Mmc_cs Alias Portc.0
      Set Mmc_cs

      ' Define here SS Pin of HW-SPI of the CPU (f.e. Pinb.0 on M128)
      ' If an other Pin than SS is used for MMC_SS, SS must be set to OUTPUT and high for proper work of SPI
      ' otherwise AVR starts SPI-SLAVE if SS-Pin is INPUT and goes to LOW
      Config Pinc.0 = Output ' define here Pin of SPI SS
      Spi_ss Alias Portc.0
      Set Spi_ss ' Set SPI-SS to Output and High por Proper work of
      ' SPI as Master

      ' HW-SPI is configured to highest Speed
      Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = High , Phase = 1 , Clockrate = 4 , Noss = 1
      ' Spsr = 1 ' Double speed on ATMega128
      Spiinit ' Init SPI

      ' --------- End of Section for HW-SPI ------------------------------------------

      #else ' Config here SPI pins, if not using HW SPI

      ' --------- Start of Section for Soft-SPI --------------------------------------

      ' Chip Select Pin => Pin 1 of MMC/SD
      Config Pinc.0 = Output
      Mmc_cs Alias Portc.0
      Set Mmc_cs

      ' MOSI - Pin => Pin 2 of MMC/SD
      Config Pinc.1 = Output
      Set Pinc.1
      Mmc_portmosi Alias Portc
      Bmmc_mosi Alias 1

      ' MISO - Pin => Pin 7 of MMC/SD
      Config Pinc.2 = Input
      Mmc_portmiso Alias Pinc
      Bmmc_miso Alias 2

      ' SCK - Pin => Pin 1 of MMC/SD
      Config Pinc.3 = Output
      Set Pinc.3
      Mmc_portsck Alias Portc
      Bmmc_sck Alias 3

      ' --------- End of Section for Soft-SPI ----------------------------------------

      #endif

      ' ========== End of user definable range =======================================


      ' Error
      Const Cperrdrivereset = 225 ' Error response Byte at Reset command
      Const Cperrdriveinit = 226 ' Error response Byte at Init Command
      Const Cperrdrivereadcommand = 227 ' Error response Byte at Read Command
      Const Cperrdrivewritecommand = 228 ' Error response Byte at Write Command
      Const Cperrdrivereadresponse = 229 ' No Data response Byte from MMC at Read
      Const Cperrdrivewriteresponse = 230 ' No Data response Byte from MMC at Write
      Const Cperrdrive = 231
      Const Cperrdrivenotsupported = 232 ' return code for DriveGetIdentity, not supported yet

      Waitms 1 ' Wait some time before initialising MMC/SD
      Dim Gbdriveerror As Byte ' General Driver Error register
      Dim Gbdriveerrorreg As Byte ' Driver load Error-Register of HD in case of error
      Dim Gbdrivestatusreg As Byte ' Driver load Status-Register of HD on case of error
      Dim Gbdrivedebug As Byte
      $lib "MMC.LIB" ' link driver library
      $external _mmc
      Gbdriveerror = Driveinit() ' Init MMC/SD Card
      [/pre]
      چون من گدایی بی نشان مشکل شود یاری چنان
      سلطان کجا عیش نهان با رند بازاری کند...
      [حافظ]

      دیدگاه


        #4
        پاسخ : کانفیگ MMC روی PORT C

        JTAG رو غیر فعال کردی؟

        دیدگاه


          #5
          پاسخ : کانفیگ MMC روی PORT C

          سلام
          JTAG رو لازم نبود غیر فعال کنم! مموری رو وارد نکرده بودم!

          ممنون از همه گی
          چون من گدایی بی نشان مشکل شود یاری چنان
          سلطان کجا عیش نهان با رند بازاری کند...
          [حافظ]

          دیدگاه


            #6
            پاسخ : کانفیگ MMC روی PORT C

            این کاری که میگم بکن:
            یه ترانزیستورو سر راه تغذیه ی MMC بزار وقتی میخوای فایل کانفیگت رو اینکلود کنی بیس ترلنزیستورو ست کن و از این طریق تغذیه ی mmc رو فراهم کن احتمال 100 درصد مشکلت رفع میشه. :bye
            الهم عجل لولیک الفرج

            فقط 313 نفر...

            دیدگاه

            لطفا صبر کنید...
            X