اطلاعیه

Collapse
No announcement yet.

کاربرد دستور READ در بسکام

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

    کاربرد دستور READ در بسکام

    سلام
    در مثال بسکام دیدم زیاد از این دستور استفاده کرده ولی هیچی ازش نمی فهمم ،این دستور داره یک متغیر رو میخونه ولی چطور ؟
    مثال بسکام
    کد:
    [COLOR=#000080][FONT=Courier New][B]$regfile[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New]=[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#008080][FONT=Courier New]"m48def.dat"[/FONT][/COLOR][FONT=Courier New]                                      [/FONT][COLOR=#008000][FONT=Courier New]' specify the  used micro[/FONT][/COLOR]
     [COLOR=#000080][FONT=Courier New][B]$crystal[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New]=[/FONT][/COLOR][FONT=Courier New] 4000000                                          [/FONT][COLOR=#008000][FONT=Courier New]' used  crystal frequency[/FONT][/COLOR]
     [COLOR=#000080][FONT=Courier New][B]$baud[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New]=[/FONT][/COLOR][FONT=Courier New] 19200                                                [/FONT][COLOR=#008000][FONT=Courier New]' use  baud rate[/FONT][/COLOR]
     [COLOR=#000080][FONT=Courier New][B]$hwstack[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New]=[/FONT][/COLOR][FONT=Courier New] 32                                                [/FONT][COLOR=#008000][FONT=Courier New]' default  use 32 for the hardware stack[/FONT][/COLOR]
     [COLOR=#000080][FONT=Courier New][B]$swstack[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New]=[/FONT][/COLOR][FONT=Courier New] 10                                                [/FONT][COLOR=#008000][FONT=Courier New]' default  use 10 for the SW stack[/FONT][/COLOR]
     [COLOR=#000080][FONT=Courier New][B]$framesize[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New]=[/FONT][/COLOR][FONT=Courier New] 40                                              [/FONT][COLOR=#008000][FONT=Courier New]' default use  40 for the frame space[/FONT][/COLOR]
     [COLOR=#000000][FONT=Arial] [/FONT][/COLOR]
     [COLOR=#000080][FONT=Courier New][B]Dim[/B][/FONT][/COLOR][FONT=Courier New] A [/FONT][COLOR=#000080][FONT=Courier New][B]As[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Integer[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New],[/FONT][/COLOR][FONT=Courier New] B1 [/FONT][COLOR=#000080][FONT=Courier New][B]As[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Byte[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New],[/FONT][/COLOR][FONT=Courier New] Count [/FONT][COLOR=#000080][FONT=Courier New][B]As[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Byte[/B][/FONT][/COLOR]
     [COLOR=#000080][FONT=Courier New][B]Dim[/B][/FONT][/COLOR][FONT=Courier New] S [/FONT][COLOR=#000080][FONT=Courier New][B]As[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]String[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New]*[/FONT][/COLOR][FONT=Courier New] 15[/FONT]
     [COLOR=#000080][FONT=Courier New][B]Dim[/B][/FONT][/COLOR][FONT=Courier New] L [/FONT][COLOR=#000080][FONT=Courier New][B]As[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Long[/B][/FONT][/COLOR]
     [COLOR=#000080][FONT=Courier New][B]Restore[/B][/FONT][/COLOR][FONT=Courier New] Dta1                                                [/FONT][COLOR=#008000][FONT=Courier New]'point to  stored data[/FONT][/COLOR]
     [COLOR=#000080][FONT=Courier New][B]For[/B][/FONT][/COLOR][FONT=Courier New] Count [/FONT][COLOR=#ff0000][FONT=Courier New]=[/FONT][/COLOR][FONT=Courier New] 1 [/FONT][COLOR=#000080][FONT=Courier New][B]To[/B][/FONT][/COLOR][FONT=Courier New] 3                                          [/FONT][COLOR=#008000][FONT=Courier New]'for number of  data items[/FONT][/COLOR]
     [FONT=Courier New]  [/FONT][COLOR=#000080][FONT=Courier New][B]Read[/B][/FONT][/COLOR][FONT=Courier New] B1 [/FONT][COLOR=#ff0000][FONT=Courier New]:[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Print[/B][/FONT][/COLOR][FONT=Courier New] Count [/FONT][COLOR=#ff0000][FONT=Courier New];[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#008080][FONT=Courier New]"  "[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New];[/FONT][/COLOR][FONT=Courier New] B1[/FONT]
     [COLOR=#000080][FONT=Courier New][B]Next[/B][/FONT][/COLOR]
     [COLOR=#000000][FONT=Arial] [/FONT][/COLOR]
     [COLOR=#000080][FONT=Courier New][B]Restore[/B][/FONT][/COLOR][FONT=Courier New] Dta2                                                [/FONT][COLOR=#008000][FONT=Courier New]'point to  stored data[/FONT][/COLOR]
     [COLOR=#000080][FONT=Courier New][B]For[/B][/FONT][/COLOR][FONT=Courier New] Count [/FONT][COLOR=#ff0000][FONT=Courier New]=[/FONT][/COLOR][FONT=Courier New] 1 [/FONT][COLOR=#000080][FONT=Courier New][B]To[/B][/FONT][/COLOR][FONT=Courier New] 2                                          [/FONT][COLOR=#008000][FONT=Courier New]'for number of  data items[/FONT][/COLOR]
     [FONT=Courier New]  [/FONT][COLOR=#000080][FONT=Courier New][B]Read[/B][/FONT][/COLOR][FONT=Courier New] A [/FONT][COLOR=#ff0000][FONT=Courier New]:[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Print[/B][/FONT][/COLOR][FONT=Courier New] Count [/FONT][COLOR=#ff0000][FONT=Courier New];[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#008080][FONT=Courier New]"  "[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New];[/FONT][/COLOR][FONT=Courier New] A[/FONT]
     [COLOR=#000080][FONT=Courier New][B]Next[/B][/FONT][/COLOR]
     [COLOR=#000000][FONT=Arial] [/FONT][/COLOR]
     [COLOR=#000080][FONT=Courier New][B]Restore[/B][/FONT][/COLOR][FONT=Courier New] Dta3[/FONT]
     [COLOR=#000080][FONT=Courier New][B]Read[/B][/FONT][/COLOR][FONT=Courier New] S [/FONT][COLOR=#ff0000][FONT=Courier New]:[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Print[/B][/FONT][/COLOR][FONT=Courier New] S[/FONT]
     [COLOR=#000080][FONT=Courier New][B]Read[/B][/FONT][/COLOR][FONT=Courier New] S [/FONT][COLOR=#ff0000][FONT=Courier New]:[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Print[/B][/FONT][/COLOR][FONT=Courier New] S[/FONT]
     [COLOR=#000000][FONT=Arial] [/FONT][/COLOR]
     [COLOR=#000000][FONT=Arial] [/FONT][/COLOR]
     [COLOR=#000080][FONT=Courier New][B]Restore[/B][/FONT][/COLOR][FONT=Courier New] Dta4[/FONT]
     [COLOR=#000080][FONT=Courier New][B]Read[/B][/FONT][/COLOR][FONT=Courier New] L [/FONT][COLOR=#ff0000][FONT=Courier New]:[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Print[/B][/FONT][/COLOR][FONT=Courier New] L                                            [/FONT][COLOR=#008000][FONT=Courier New]'long  type[/FONT][/COLOR]
     [COLOR=#000000][FONT=Arial] [/FONT][/COLOR]
     [COLOR=#000000][FONT=Arial] [/FONT][/COLOR]
     [COLOR=#008000][FONT=Courier New]'demonstration of  readlabel[/FONT][/COLOR]
     [COLOR=#000080][FONT=Courier New][B]Dim[/B][/FONT][/COLOR][FONT=Courier New] W [/FONT][COLOR=#000080][FONT=Courier New][B]As[/B][/FONT][/COLOR][FONT=Courier New] Iram [/FONT][COLOR=#000080][FONT=Courier New][B]Word[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]At[/B][/FONT][/COLOR][FONT=Courier New] 8 [/FONT][COLOR=#000080][FONT=Courier New][B]Overlay[/B][/FONT][/COLOR][FONT=Courier New]                             [/FONT][COLOR=#008000][FONT=Courier New]' location is used by restore  pointer[/FONT][/COLOR]
     [COLOR=#008000][FONT=Courier New]'note that W does  not use any RAM it is an overlayed pointer to the data pointer[/FONT][/COLOR]
     [FONT=Courier New]W [/FONT][COLOR=#ff0000][FONT=Courier New]=[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#000080][FONT=Courier New][B]Loadlabel[/B][/FONT][/COLOR][COLOR=#ff0000][FONT=Courier New]([/FONT][/COLOR][FONT=Courier New]dta1[/FONT][COLOR=#ff0000][FONT=Courier New])[/FONT][/COLOR][FONT=Courier New]                                          [/FONT][COLOR=#008000][FONT=Courier New]' loadlabel  expects the labelname[/FONT][/COLOR]
     [COLOR=#000080][FONT=Courier New][B]Read[/B][/FONT][/COLOR][FONT=Courier New] B1[/FONT]
     [COLOR=#000080][FONT=Courier New][B]Print[/B][/FONT][/COLOR][FONT=Courier New] B1[/FONT]
     [COLOR=#000080][FONT=Courier New][B]End[/B][/FONT][/COLOR]
     [COLOR=#000000][FONT=Arial] [/FONT][/COLOR]
     [COLOR=#000000][FONT=Arial] [/FONT][/COLOR]
     [FONT=Courier New]Dta1[/FONT][COLOR=#ff0000][FONT=Courier New]:[/FONT][/COLOR]
     [COLOR=#000080][FONT=Courier New][B]Data[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New]&[/FONT][/COLOR][FONT=Courier New]B10 [/FONT][COLOR=#ff0000][FONT=Courier New],[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New]&[/FONT][/COLOR][FONT=Courier New]HFF [/FONT][COLOR=#ff0000][FONT=Courier New],[/FONT][/COLOR][FONT=Courier New] 10[/FONT]
     [FONT=Courier New]Dta2[/FONT][COLOR=#ff0000][FONT=Courier New]:[/FONT][/COLOR]
     [COLOR=#000080][FONT=Courier New][B]Data[/B][/FONT][/COLOR][FONT=Courier New] 1000[/FONT][COLOR=#ff0000][FONT=Courier New]%[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New],[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New]-[/FONT][/COLOR][FONT=Courier New]1[/FONT][COLOR=#ff0000][FONT=Courier New]%[/FONT][/COLOR]
     [COLOR=#000000][FONT=Arial] [/FONT][/COLOR]
     [FONT=Courier New]Dta3[/FONT][COLOR=#ff0000][FONT=Courier New]:[/FONT][/COLOR]
     [COLOR=#000080][FONT=Courier New][B]Data[/B][/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#008080][FONT=Courier New]"Hello"[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#ff0000][FONT=Courier New],[/FONT][/COLOR][FONT=Courier New] [/FONT][COLOR=#008080][FONT=Courier New]"World"[/FONT][/COLOR]
     [COLOR=#008000][FONT=Courier New]'Note that integer  values (>255 or <0) must end with the %-sign[/FONT][/COLOR]
     [COLOR=#008000][FONT=Courier New]'also note that the  data type must match the variable type that is[/FONT][/COLOR]
     [COLOR=#008000][FONT=Courier New]'used for the READ  statement[/FONT][/COLOR]
     [COLOR=#000000][FONT=Arial] [/FONT][/COLOR]
     [FONT=Courier New]Dta4[/FONT][COLOR=#ff0000][FONT=Courier New]:[/FONT][/COLOR]
     [COLOR=#000080][FONT=Courier New][B]Data[/B][/FONT][/COLOR][FONT=Courier New] 123456789[/FONT][COLOR=#ff0000][FONT=Courier New]&[/FONT][/COLOR]
     [COLOR=#008000][FONT=Courier New]'Note that LONG  values must end with the &-sign[/FONT][/COLOR]
     [COLOR=#008000][FONT=Courier New]'Also note that the  data type must match the variable type that is used[/FONT][/COLOR]
     [COLOR=#008000][FONT=Courier New]'for the READ  statement[/FONT][/COLOR]

    #2
    پاسخ : کاربرد دستور READ در بسکام

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

    دیدگاه


      #3
      پاسخ : کاربرد دستور READ در بسکام

      این دستور مرتبط با دستورهای DATA ، LOOKUP و RESTORE است. در انتهای کدی که گذاشتی، چند دستور DATA وجود دارد که به دنبال آن تعدادی داده پشت سر هم آورده شده است. دستور READ این دیتاها را هر بار و به ترتیب درون متغیر مربوطه می ریزد.

      دیدگاه


        #4
        پاسخ : کاربرد دستور READ در بسکام

        شبیه دستور lin input توی avr dos هستش از نظر کارکرد
        با هر بار اجرا یک واحد از حافظه فلش بعد از دستور end رو میخونه و آدرس پذیر نیست

        دیدگاه


          #5
          پاسخ : کاربرد دستور READ در بسکام

          دوستان تشکر
          با راهنماییی شما وشبیه سازی در بسکام به طور کامل فهمیدم(البته برای استفاده از دستور ،قبلش باید اون خط دیتا رو restore کنیم(برای دوستانی که در اینده سری به این تاپپیک میزنن)
          جدیدترین ویرایش توسط gmaissam; ۱۲:۵۵ ۱۳۹۵/۰۷/۳۰.

          دیدگاه

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